feat(ssh): add enable option

This commit is contained in:
2026-05-22 10:23:22 +02:00
parent a5adea70ea
commit 086e091add
8 changed files with 93 additions and 70 deletions

View File

@@ -1,5 +1,7 @@
{ lib, config, ... }:
with lib;
let
cfg = config.services.openssh;
in
@@ -13,7 +15,7 @@ in
options.services.openssh.harden = mkEnableOption "harden ssh server configuration";
config = {
networking.firewall.allowedTCPPorts = [ 22 ];
networking.firewall.allowedTCPPorts = lib.mkIf config.ssh.enable [ 22 ];
services.openssh.settings = optionalAttrs cfg.harden {
PermitRootLogin = "no";