Skip to content

Instantly share code, notes, and snippets.

@ripsnortntear
Created March 31, 2025 06:26
Show Gist options
  • Save ripsnortntear/e1064acde4a061331e96ee4353b87658 to your computer and use it in GitHub Desktop.
Save ripsnortntear/e1064acde4a061331e96ee4353b87658 to your computer and use it in GitHub Desktop.
This script checks and displays the status of all Fail2Ban jails on the system by iterating through the list of active jails and retrieving their individual statuses.
#!/bin/bash
# Check the status of all Fail2Ban jails
for jail in $(sudo fail2ban-client status | grep 'Jail list:' | cut -d ':' -f 2 | tr -d ' ' | tr ',' ' '); do
sudo fail2ban-client status "$jail"
echo ""
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment