ssh.nix (324B)
1 { username, sshkey, sshport, ... }: 2 3 { 4 # SSH service 5 services.openssh = { 6 enable = true; 7 ports = [ sshport ]; 8 settings.PasswordAuthentication = false; 9 }; 10 # Fail2ban service 11 services.fail2ban.enable = true; 12 # Import SSH key 13 users.users.${username}.openssh.authorizedKeys.keys = [ "${sshkey}" ]; 14 15 }