Added ssh config

This commit is contained in:
Alejandro Angulo 2023-03-19 18:37:46 -07:00
parent e329727100
commit be3bf8c098
Signed by: alejandro-angulo
GPG key ID: 75579581C74554B6
2 changed files with 44 additions and 9 deletions

View file

@ -0,0 +1,42 @@
{
options,
config,
lib,
pkgs,
format,
...
}:
with lib; let
cfg = config.aa.services.openssh;
user = config.users.users.${config.aa.user.name};
user-id = builtins.toString user.uid;
default-key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEmPdQcM0KCQ3YunF1gwN+B+i1Q8KrIfiUvNtgFQjTy2";
in {
options.aa.services.openssh = with types; {
enable = mkEnableOption "ssh";
authorizedKeys = mkOption {
type = listOf str;
default = [default-key];
description = "The public keys to authorize";
};
config = mkIf config.enable {
services.openssh = {
enable = true;
settings = {
PasswordAuthentication = false;
PermitRootLogin =
if format == "install-iso"
then true
else false;
};
};
aa.home.extraOptions = {
programs.openssh.authorizedKeys.keys = cfg.authorizedKeys;
};
};
};
}

View file

@ -25,6 +25,8 @@
apps.neovim.enable = true;
apps.tmux.enable = true;
services.openssh.enable = true;
};
boot.binfmt.emulatedSystems = ["aarch64-linux" "armv6l-linux"];
@ -136,15 +138,6 @@
# List services that you want to enable:
# Enable the OpenSSH daemon.
services.openssh = {
enable = true;
settings = {
PermitRootLogin = "no";
PasswordAuthentication = false;
};
};
services.geoclue2.enable = true;
security.rtkit.enable = true;