summary refs log tree commit diff stats
path: root/system/services
diff options
context:
space:
mode:
authorene <ene@sils.li>2023-03-25 13:41:53 +0100
committerene <ene@sils.li>2023-03-25 13:41:53 +0100
commit8d8ad7a9f79ba88cc5b07e8f5f4d1a4cded4ff1b (patch)
tree055d3638608bec66546d0e8c593f89993b074b99 /system/services
parentFix(acme): Store certs permanently. (diff)
downloadnixos-server-8d8ad7a9f79ba88cc5b07e8f5f4d1a4cded4ff1b.tar.gz
nixos-server-8d8ad7a9f79ba88cc5b07e8f5f4d1a4cded4ff1b.zip
Feat(system/services/fail2ban): Add fail2ban
This should clear the logs somewhat.
Diffstat (limited to '')
-rw-r--r--system/services/default.nix1
-rw-r--r--system/services/fail2ban/default.nix14
2 files changed, 15 insertions, 0 deletions
diff --git a/system/services/default.nix b/system/services/default.nix
index f36cb29..5d9e5b6 100644
--- a/system/services/default.nix
+++ b/system/services/default.nix
@@ -7,5 +7,6 @@
     ./nix
     ./opensshd
     ./rust-motd
+    ./fail2ban
   ];
 }
diff --git a/system/services/fail2ban/default.nix b/system/services/fail2ban/default.nix
new file mode 100644
index 0000000..5b5e9e7
--- /dev/null
+++ b/system/services/fail2ban/default.nix
@@ -0,0 +1,14 @@
+# vim: ts=2
+{...}: {
+  services.fail2ban = {
+    enable = true;
+    maxretry = 2; # ban after 2 failures
+    bantime-increment = {
+      enable = true;
+      rndtime = "8m";
+      overalljails = true;
+      multipliers = "2 4 16 128 256";
+      maxtime = "72h";
+    };
+  };
+}