Last active
January 9, 2017 22:30
-
-
Save reikoNeko/b08bb235313168758c215f880e5f618f to your computer and use it in GitHub Desktop.
Quick command to get the status of every active jail on a server running fail2ban
This file contains hidden or 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/env bash | |
CMD='sudo fail2ban-client status'; for J in `$CMD | awk -F':' '/Jail list/ {gsub(/,/,""); print $2}'` ; do $CMD $J ;done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Of course, if you want to reduce log entries with a single sudo command, you could take sudo out of the CMD string and
alias fail2check='sudo ~/bin/fail2check.sh'
but I actually like it this way.