diff --git a/docs/content/config/security/fail2ban.md b/docs/content/config/security/fail2ban.md index 0ea052a1..04e9a681 100644 --- a/docs/content/config/security/fail2ban.md +++ b/docs/content/config/security/fail2ban.md @@ -58,6 +58,12 @@ setup fail2ban the script will show all banned IP addresses. +To get a more detailed `status` view, run + +```bash +setup fail2ban status +``` + ### Managing Bans You can manage F2B with the `setup` script. The usage looks like this: diff --git a/target/bin/fail2ban b/target/bin/fail2ban index 2ae9deaf..8a76fcda 100755 --- a/target/bin/fail2ban +++ b/target/bin/fail2ban @@ -6,6 +6,7 @@ source /usr/local/bin/helpers/index.sh function __usage() { echo "Usage: ./setup.sh fail2ban [ ]" echo " ./setup.sh fail2ban log" + echo " ./setup.sh fail2ban status" } fail2ban-client ping &>/dev/null || _exit_with_error "Fail2ban not running" @@ -72,6 +73,12 @@ else cat /var/log/mail/fail2ban.log ;; + ( 'status' ) + for JAIL in "${JAILS[@]}"; do + printf '%s\n\n' "$(fail2ban-client status "${JAIL}" 2>&1)" + done + ;; + ( * ) __usage _exit_with_error "Unknown command '${1}'" diff --git a/target/bin/setup b/target/bin/setup index 29782b6f..ac0d6328 100755 --- a/target/bin/setup +++ b/target/bin/setup @@ -60,6 +60,7 @@ ${RED}[${ORANGE}SUB${RED}]${ORANGE}COMMANDS${RESET} setup fail2ban ${CYAN}ban${RESET} setup fail2ban ${CYAN}unban${RESET} setup fail2ban ${CYAN}log${RESET} + setup fail2ban ${CYAN}status${RESET} ${LBLUE}COMMAND${RESET} debug ${RED}:=${RESET} setup debug ${CYAN}fetchmail${RESET}