versión corta :
enumerar todos los ips actualmente bloqueados:
fail2ban-client status | grep "Jail list:" | sed "s/ //g" | awk '{split($2,a,",");for(i in a) system("fail2ban-client status " a[i])}' | grep "Status\|IP list"
deshacer una ip:
fail2ban-client set postfix-mail unbanip 111.222.333.444
versión larga :
Si está buscando la forma "oficial" de hacerlo, hay un cliente de línea de comandos para fail2ban https://www.fail2ban.org/wiki/index.php/Commands :
~ # fail2ban-client status
Status
|- Number of jail: 8
`- Jail list: roundcube, sshd, sogo, postfix-sasl, postfix-mail, dovecot, ssh, sshd-ddos
entonces puedes correr
~ # fail2ban-client status roundcube
Status for the jail: roundcube
|- filter
| |- File list: /var/log/mail.log
| |- Currently failed: 0
| `- Total failed: 12
`- action
|- Currently banned: 1
| `- IP list: 111.222.333.444
`- Total banned: 1
o puede usar mi comando, que itera sobre todas las cárceles existentes:
fail2ban-client status | grep "Jail list:" | sed "s/ //g" | awk '{split($2,a,",");for(i in a) system("fail2ban-client status " a[i])}' | grep "Status\|IP list"
que salidas:
Status for the jail: roundcube
| `- IP list:
Status for the jail: sshd
| `- IP list:
Status for the jail: sogo
| `- IP list:
Status for the jail: postfix-sasl
| `- IP list:
Status for the jail: postfix-mail
| `- IP list:
Status for the jail: dovecot
| `- IP list:
Status for the jail: ssh
| `- IP list:
Status for the jail: sshd-ddos
| `- IP list:
sudo iptables -L -n
?