versione corta :
elenca tutti gli IP attualmente bloccati:
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"
sbloccare un ip:
fail2ban-client set postfix-mail unbanip 111.222.333.444
versione lunga :
se stai cercando il modo "ufficiale" per farlo, esiste un client da riga di comando per 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
allora puoi correre
~ # 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
oppure puoi usare il mio comando, che scorre su tutte le jail esistenti:
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"
che produce:
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
?