Score:0

fail2ban unban every ip when the server is shutting down, restoring every ban back again when newrly started

ky flag

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?

Score:0
vn flag

Assuming systemd, copy /lib/systemd/system/fail2ban.service to /etc/systemd/system and then edit /etc/systemd/system/fail2ban.service, replacing

ExecStop=/usr/bin/fail2ban-client stop

with

ExecStop=/bin/true

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

ky flag
This doesn't seem to work; still unbanning and restoring every ban when fail2ban restarts. I copied `/lib/systemd/system/fail2ban.service` to `/etc/systemd/system` and replaced the `ExecStop` value as you said (I don't know what this does but `/bin/true` doesn't exist) but no change. Then I deleted the original `/lib/systemd/system/fail2ban.service` file but when tried to start the service, I got an error message to do `systemctl daemon-reload`. I did, the service started normally again, but still unbanning and restoring every ban.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.