Blog of Andrés Aravena
Best Practices:

Recovering from `fail2ban`

26 March 2018

Today Güney got banned from the dry-cloud server, so I had to learn how to ‘unban’ him.

The output of pstree reminded me that we are using fail2ban. The manual of this tool told me that there is a command line interface called fail2ban-client. The relevant commands require us to specify a jail id, which I don’t know.

Trying the command fail2ban-client status gave

Status
|- Number of jail:  1
`- Jail list:   sshd

So we learned that the jail name is sshd. Now we try fail2ban-client status sshd and we see that there is someone “on jail” and it happens to be the same IP address as Güney’s computer

Status for the jail: sshd
|- Filter
|  |- Currently failed: 1
|  |- Total failed: 9
|  `- File list:    /var/log/auth.log
`- Actions
   |- Currently banned: 1
   |- Total banned: 1
   `- Banned IP list:   172.26.86.182

We write set sshd unbanip 172.26.86.182 and the computer answers

172.26.86.182

Then we verify with fail2ban-client status sshd

Status for the jail: sshd
|- Filter
|  |- Currently failed: 1
|  |- Total failed: 9
|  `- File list:    /var/log/auth.log
`- Actions
   |- Currently banned: 0
   |- Total banned: 1
   `- Banned IP list:

And now Güney can connect.

Originally published at https://anaraven.bitbucket.io/blog/2018/best-practices/fail2ban.html