From 2c2f76f9121ec61678e0a2cc178ce1cd10de808b Mon Sep 17 00:00:00 2001 From: "RingOfStorms (Josh)" Date: Tue, 9 Jul 2024 17:32:02 -0500 Subject: [PATCH] add fail2ban on ssh --- hosts/_common/components/ssh.nix | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/hosts/_common/components/ssh.nix b/hosts/_common/components/ssh.nix index 33ec80ba..e569cf84 100644 --- a/hosts/_common/components/ssh.nix +++ b/hosts/_common/components/ssh.nix @@ -1,10 +1,19 @@ { ... }: { - # Enable the OpenSSH daemon. - services.openssh.enable = true; - services.openssh.settings.PermitRootLogin = "yes"; + # Use fail2ban + services.fail2ban = { + enable = true; + }; + # Open ports in the firewall. networking.firewall.allowedTCPPorts = [ 22 # sshd ]; + + # Enable the OpenSSH daemon. + services.openssh = { + enable = true; + logLevel = "VERBOSE"; + settings.PermitRootLogin = "yes"; + }; }