How to purge all banned IP's from fail2ban 0.9.x

Microsoft bingbot is a repeat offender on my RPi and as a consequence it’s subjected to extended periods of jail time. However, being a good netizen I like to provide an even playing field for all web crawlers. With that in mind, what would be the easiest way of purging all IP addresses from fail2ban?

Fail2ban 0.9.x doesn’t have a command to flush all bans at once, so the easiest approach is to simply delete the database.

First we’ll ask fail2ban for the database location:

fail2ban-client get dbfile
Current database file is:
`- /var/lib/fail2ban/fail2ban.sqlite3

Next, we’ll stop fail2ban, delete the database and finally restart the service. The following examples are from Slackware Linux (SBo), actual paths may vary.

/etc/rc.d/rc.fail2ban stop
rm /var/lib/fail2ban/fail2ban.sqlite3
/etc/rc.d/rc.fail2ban start

Fail2ban will simply create a new database on startup, so deleting the database is harmless.

Roger Comply avatar
Roger Comply
Thank you for reading!
Feel free to waste more time by subscribing to my RSS feed.