2023-11-12 00:40:26 +01:00
|
|
|
{ lib, config, ... }:
|
|
|
|
with lib;
|
|
|
|
{
|
|
|
|
options.server.networking.enableSSH = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
|
|
|
example = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
config = {
|
|
|
|
services.openssh = mkIf config.server.networking.enableSSH {
|
|
|
|
enable = true;
|
2024-07-27 11:43:04 +02:00
|
|
|
settings = {
|
|
|
|
StrictModes = true;
|
|
|
|
PermitRootLogin = "no";
|
|
|
|
PasswordAuthentication = false;
|
|
|
|
KbdInteractiveAuthentication = false;
|
|
|
|
PermitEmptyPasswords = "no";
|
|
|
|
};
|
2023-11-12 00:40:26 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
networking.firewall.allowedTCPPorts = [
|
|
|
|
(mkIf config.services.nginx.enable 80)
|
|
|
|
(mkIf config.services.nginx.enable 443)
|
|
|
|
(mkIf config.server.networking.enableSSH 22)
|
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|