Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagebash
sudo chkconfig fail2ban on
sudo service fail2ban start

Manually adding / removing ip (or ip ranges)

You might need (or want) to add an ip address to fail2ban manually from time to time.  You can use the fail2ban-client  commands for this:

manully add ip to a fail2ban jail

Code Block
sudo fail2ban-client set apache-custom banip <IP-ADDRESS>

manually remove ip (or CIDR) to a fail2ban jail

Code Block
sudo fail2ban-client set apache-custom unbanip <IP-ADDRESS>


Info

Replace <IP-ADDRESS> with the ip address you want to add/remove from fail2ban.

To DB or not to DB...

Fail2ban 0.9 introduced an integrated SQLite database for bans.  This means that on restarting (fail2ban or your server) the previously banned ip addresses will be rebanned (instead of being lost).  Although this is a great feature, I've found it does have some downsides - such as taking a lot of time to shutdown and startup fail2ban.  On one of my servers, with approximately 6000 banned ips - shutting down fail2ban would take 5 minutes or so, and starting it back up would take around 10 minutes as it (one by one) rebanned each banned ip from the database. 

...