1
0
Fork 0
nix-configuration/modules/services/ssh.nix

33 lines
722 B
Nix
Raw Normal View History

2024-05-20 20:52:57 -04:00
{ config, lib, ... }:
let
cfg = config.aux.system.services.ssh;
2024-05-20 20:52:57 -04:00
in
{
options = {
aux.system.services.ssh = {
2024-09-08 11:58:56 -04:00
enable = lib.mkEnableOption "Enables SSH server.";
2024-05-20 20:52:57 -04:00
ports = lib.mkOption {
default = [ 22 ];
2024-05-20 20:52:57 -04:00
type = lib.types.listOf lib.types.int;
description = "Ports for SSH to listen on.";
};
};
};
config = lib.mkIf cfg.enable {
services.openssh = {
enable = true;
ports = cfg.ports;
settings = {
# require public key authentication and disable root logins
PasswordAuthentication = false;
KbdInteractiveAuthentication = false;
PubkeyAuthentication = true;
PermitRootLogin = "no";
};
};
};
}