Removing a blocked ip from fail2ban on a Linode

Oct 31, 2013 • val antonini

I have a Linode setup with fail2ban running to ban ip's after several failed login attempts. Setting it up is as simple as following the directions provided by Linode here.

If your like me and manage to ban your own ip this how to fix it.

1. Log into the linode manager.

2. Click on the remote access tab.

3. In the console access click the 'Lish via Ajaxterm Launch Lish Ajax Console' link. This will launch a shell in the browser. Login with your username and password and become a superuser:

sudo su

4. Check if you are indeed banned (replace 192.168.1.1 with your ipaddress):

iptables -L -n | grep 192.168.1.1

If you get a line like the one below you have been banned.

DROP    all    --    192.168.1.1    0.0.0.0/0

5. Determine the name of the jail your in.

iptables -L | grep fail2ban

This should give you an output similar to this.

fail2ban-ssh   tcp   --   anywhere   anywhere   multiport dports ssh
Chain fail2ban-ssh (1 references)

In my case there was only 1 entry, fail2ban-ssh.

6. Use this in your next query to remove your ip:

iptables -D fail2ban-ssh -s 192.168.1.1 -j DROP

You should now be unbanned and can log out of the web console.