Skip to content

Instantly share code, notes, and snippets.

@reikoNeko
Last active January 9, 2017 22:30
Show Gist options
  • Save reikoNeko/b08bb235313168758c215f880e5f618f to your computer and use it in GitHub Desktop.
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
#!/bin/env bash
CMD='sudo fail2ban-client status'; for J in `$CMD | awk -F':' '/Jail list/ {gsub(/,/,""); print $2}'` ; do $CMD $J ;done
@reikoNeko
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment