version courte :
liste tous les ips actuellement bloqués:
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"
annuler une adresse IP:
fail2ban-client set postfix-mail unbanip 111.222.333.444
version longue :
si vous recherchez le moyen "officiel" de le faire, il existe un client en ligne de commande pour 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
alors vous pouvez courir
~ # 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
ou vous pouvez utiliser ma commande, qui itère sur toutes les prisons existantes:
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"
qui produit:
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
?