I have multiple jails with several thousands of banned IPs. The server was running for about a week non-stop, then when I was restarting it it took quite a long time ~2 mins to shutting down, and when the server was back on the CPU usage was unusually high.
I looked into journalctl
and found out that fail2ban
was unbanning all the IPs when shutting down, and restoring all of them again when newly started.
What is going on here and how do I prevent this?
Assuming systemd, copy
/lib/systemd/system/fail2ban.service
to/etc/systemd/system
and then edit/etc/systemd/system/fail2ban.service
, replacingwith
However, in the future, if you want to stop fail2ban you can't use
systemctl
and will need to run/usr/bin/fail2ban-client stop