diff --git a/hosts/common/configs/system/sshd/default.nix b/hosts/common/configs/system/sshd/default.nix index e195489..fb3b584 100644 --- a/hosts/common/configs/system/sshd/default.nix +++ b/hosts/common/configs/system/sshd/default.nix @@ -1,15 +1,27 @@ { ... }: { - services.openssh = { - enable = true; - ports = [ 22 ]; - openFirewall = true; - settings = { - PasswordAuthentication = false; - PermitRootLogin = "no"; - PrintMotd = false; - }; + environment = { + enableAllTerminfo = true; + persistence."/persist"."/var/lib/fail2ban" = { }; }; - environment.enableAllTerminfo = true; + services = { + openssh = { + enable = true; + settings = { + PasswordAuthentication = false; + PrintMotd = false; + }; + }; + + fail2ban = { + enable = true; + bantime = "24h"; + bantime-increment = { + enable = true; + maxtime = "720h"; + overalljails = true; + }; + }; + }; }