1
0
mirror of https://github.com/docker-mailserver/docker-mailserver.git synced 2025-08-09 23:07:35 +02:00

feat(setup): Add fail2ban sub-command status <JAIL> (#3455)

* Added status command to fail2ban setup script

* Switched to `printf` for command output

Co-authored-by: Casper <casperklein@users.noreply.github.com>

* Update docs/content/config/security/fail2ban.md

Co-authored-by: Casper <casperklein@users.noreply.github.com>

---------

Co-authored-by: Casper <casperklein@users.noreply.github.com>
This commit is contained in:
Nils Höll
2023-08-02 02:09:01 +02:00
committed by GitHub
parent da984e5696
commit 85603193a2
3 changed files with 14 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ source /usr/local/bin/helpers/index.sh
function __usage() {
echo "Usage: ./setup.sh fail2ban [<ban|unban> <IP>]"
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}'"

View File

@@ -60,6 +60,7 @@ ${RED}[${ORANGE}SUB${RED}]${ORANGE}COMMANDS${RESET}
setup fail2ban ${CYAN}ban${RESET} <IP>
setup fail2ban ${CYAN}unban${RESET} <IP>
setup fail2ban ${CYAN}log${RESET}
setup fail2ban ${CYAN}status${RESET}
${LBLUE}COMMAND${RESET} debug ${RED}:=${RESET}
setup debug ${CYAN}fetchmail${RESET}