Created
July 11, 2011 17:06
-
-
Save kamermans/1076290 to your computer and use it in GitHub Desktop.
Show status of all fail2ban jails at once
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
JAILS=`fail2ban-client status | grep "Jail list" | sed -E 's/^[^:]+:[ \t]+//' | sed 's/,//g'` | |
for JAIL in $JAILS | |
do | |
fail2ban-client status $JAIL | |
done |
Thanks, works well on CentOS 7.
Nice. Needs sudo, so sudo sh -c "fail2ban-client status | sed -n 's/,//g;s/.*Jail list://p' | xargs -n1 fail2ban-client status"
1# sudo apt-get remove fail2ban : remove the packet
2# sudo rm -rf fail2ban : delete fail2ban folder
3# re install again
doesn't ipset list do this?
@stefan1959 I don't know, although this post was over 5 years ago, so things have probably changed!
Thx
thank you
Thank you!
Thank you pal!
Thanks man!
Very handy, thank you
thanks!
Thanks !
thx!
Verify Github on Galxe. gid:hqaGx3KAt8heyLH9WYEKkm
Ta very much!
ty
Thanks.
Since fail2ban banned
lists all jails with their banned IP as a list of Python dictionaries, Python can also be used to get the list of jails:
$ fail2ban-client banned
[{'sshd': []}, {'apache-auth': []}, {'apache-badbots': []}, {'apache-noscript': ['AAA.BBB.CCC.DDD', 'AAA.BBB.CCC.DDD']}, {'apache-overflows': []}, {'apache-nohome': []}, {'apache-botsearch': []}, {'apache-fakegooglebot': []}, {'apache-modsecurity': []}, {'apache-shellshock': []}, {'php-url-fopen': []}, {'apache-pass': []}]
$ JAILS=$(python -c "print(' '.join(k for d in $(fail2ban-client banned) for k in d))")
$ echo $JAILS
sshd apache-auth apache-badbots apache-noscript apache-overflows apache-nohome apache-botsearch apache-fakegooglebot apache-modsecurity apache-shellshock php-url-fopen apache-pass
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice! Will use this script in my server, ty again <3