From 1fc72de6b6606f6c97ccf9883a88705260dd3ac8 Mon Sep 17 00:00:00 2001 From: ene Date: Sat, 25 Mar 2023 13:59:51 +0100 Subject: Fix(system/services/fail2ban): Make db persistent --- system/services/fail2ban/default.nix | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'system/services/fail2ban/default.nix') diff --git a/system/services/fail2ban/default.nix b/system/services/fail2ban/default.nix index 5b5e9e7..949b486 100644 --- a/system/services/fail2ban/default.nix +++ b/system/services/fail2ban/default.nix @@ -3,6 +3,13 @@ services.fail2ban = { enable = true; maxretry = 2; # ban after 2 failures + daemonConfig = '' + [Definition] + logtarget = SYSLOG + socket = /run/fail2ban/fail2ban.sock + pidfile = /run/fail2ban/fail2ban.pid + dbfile = /srv/fail2ban/fail2ban.sqlite3 + ''; bantime-increment = { enable = true; rndtime = "8m"; -- cgit 1.4.1 From dce980ddb127a470b188fd6efbfb8ddb5b0fe315 Mon Sep 17 00:00:00 2001 From: ene Date: Sat, 25 Mar 2023 14:00:29 +0100 Subject: Feat(system/services/fail2ban): Add dovecot jail This should reduce the log spam even further. --- system/services/fail2ban/default.nix | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'system/services/fail2ban/default.nix') diff --git a/system/services/fail2ban/default.nix b/system/services/fail2ban/default.nix index 949b486..5aee097 100644 --- a/system/services/fail2ban/default.nix +++ b/system/services/fail2ban/default.nix @@ -17,5 +17,14 @@ multipliers = "2 4 16 128 256"; maxtime = "72h"; }; + jails = { + dovecot = '' + # block IPs which failed to log-in + # aggressive mode add blocking for aborted connections + enabled = true + filter = dovecot[mode=aggressive] + maxretry = 2 + ''; + }; }; } -- cgit 1.4.1