Unban ip Failban

Step 1: Find IP Address to Unblock

Log in to your server via SSH and type in the following command:

iptables -L -n

Look for the IP address you want to unblock / unban.

Step 2: Get Jail Name of fail2ban Blocked IP Address

Now we must find the jail name this IP address is in. To do so, type the following to find the jail list settings:

fail2ban-client status

Step 3: Unban IP Address from fail2ban

For this example, we will remove an IP address jailed within ssh. To do so, type in the following:

fail2ban-client set <jail-name> unbanip 123.123.123.123

The IP address should now be unbanned from fail2ban.

fail2ban-client set apache-auth unbanip 83.99.83.189
fail2ban-client set apache-badbots unbanip 83.99.83.189
fail2ban-client set apache-botsearch unbanip 83.99.83.189
fail2ban-client set apache-modsecurity unbanip 83.99.83.189
fail2ban-client set apache-nohome unbanip 83.99.83.189
fail2ban-client set apache-overflows unbanip 83.99.83.189
fail2ban-client set apache-shellshock unbanip 83.99.83.189
fail2ban-client set courier-auth unbanip 83.99.83.189
fail2ban-client set courier-smtp unbanip 83.99.83.189
fail2ban-client set cyrus-imap unbanip 83.99.83.189
fail2ban-client set dovecot unbanip 83.99.83.189
fail2ban-client set dropbear unbanip 83.99.83.189
fail2ban-client set drupal-auth unbanip 83.99.83.189
fail2ban-client set ispconfig unbanip 83.99.83.189
fail2ban-client set php-url-fopen unbanip 83.99.83.189
fail2ban-client set postfix unbanip 83.99.83.189
fail2ban-client set postfix-rbl unbanip 83.99.83.189
fail2ban-client set postfix-sasl unbanip 83.99.83.189
fail2ban-client set pure-ftpd unbanip 83.99.83.189
fail2ban-client set recidive unbanip 83.99.83.189
fail2ban-client set roundcube-auth unbanip 83.99.83.189
fail2ban-client set selinux-ssh unbanip 83.99.83.189
fail2ban-client set sendmail-auth unbanip 83.99.83.189
fail2ban-client set sendmail-reject unbanip 83.99.83.189
fail2ban-client set sshd unbanip 83.99.83.189
fail2ban-client set sshd-ddos unbanip 83.99.83.189
fail2ban-client set wordpress unbanip 83.99.83.189

OR

iptables -L f2b-recidive -n | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' | grep -v 0.0.0.0 | xargs -n 1 fail2ban-client set recidive unbanip

Leave a Reply