Major config overhaul: use custom modules, setup for multi-host config, and less boilerplate
This commit is contained in:
25
modules/system/security/sshd/default.nix
Normal file
25
modules/system/security/sshd/default.nix
Normal file
@@ -0,0 +1,25 @@
|
||||
{ config, lib, ... }:
|
||||
|
||||
let
|
||||
cfg = config.systemSettings.security.sshd;
|
||||
in {
|
||||
options = {
|
||||
systemSettings.security.sshd = {
|
||||
enable = lib.mkEnableOption "Enable incoming ssh connections";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
# Enable incoming ssh
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
openFirewall = true;
|
||||
settings = {
|
||||
PasswordAuthentication = false;
|
||||
PermitRootLogin = "no";
|
||||
};
|
||||
};
|
||||
# Don't forget to set:
|
||||
# users.users.${username}.openssh.authorizedKeys.keys = "myAuthorizedKey";
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user