initial commit
This commit is contained in:
30
modules/ssh.nix
Normal file
30
modules/ssh.nix
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.modules.ssh;
|
||||
in {
|
||||
options.modules.ssh = {
|
||||
enable = mkEnableOption "Enables OpenSSH";
|
||||
allowedUsers = mkOption {
|
||||
type = types.listOf types.str;
|
||||
example = ["alice" "bob"];
|
||||
default = ["phundrak"];
|
||||
};
|
||||
passwordAuthentication = mkOption {
|
||||
type = types.bool;
|
||||
example = true;
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
config.services.openssh = mkIf cfg.enable {
|
||||
enable = true;
|
||||
settings = {
|
||||
AllowUsers = cfg.allowedUsers;
|
||||
PermitRootLogin = "no";
|
||||
PasswordAuthentication = cfg.passwordAuthentication;
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user