move openssh

This commit is contained in:
Osman Faruk Bayram 2025-09-09 11:48:59 +03:00
parent 86c6c706a5
commit b6341d7943
2 changed files with 39 additions and 19 deletions

View file

@ -60,23 +60,4 @@
virtualisation.docker.enable = true;
# Enable the OpenSSH daemon.
services.openssh = {
enable = true;
startWhenNeeded = true;
settings = {
PermitRootLogin = "no";
# only allow key based logins and not password
PasswordAuthentication = false;
KbdInteractiveAuthentication = false;
AuthenticationMethods = "publickey";
PubkeyAuthentication = "yes";
ChallengeResponseAuthentication = "no";
UsePAM = false;
# kick out inactive sessions
ClientAliveCountMax = 5;
ClientAliveInterval = 60;
};
};
}

View file

@ -0,0 +1,39 @@
{
config,
lib,
...
}:
{
options = {
myModules.enableOpenssh = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Enable OpenSSH service";
};
};
config = lib.mkMerge [
(lib.mkIf config.myModules.enableOpenssh {
services.openssh = {
enable = true;
startWhenNeeded = true;
settings = {
PermitRootLogin = "no";
# only allow key based logins and not password
PasswordAuthentication = false;
KbdInteractiveAuthentication = false;
AuthenticationMethods = "publickey";
PubkeyAuthentication = "yes";
ChallengeResponseAuthentication = "no";
UsePAM = false;
# kick out inactive sessions
ClientAliveCountMax = 5;
ClientAliveInterval = 60;
};
};
})
];
}