mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00: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:
parent
da984e5696
commit
85603193a2
|
@ -58,6 +58,12 @@ setup fail2ban
|
||||||
|
|
||||||
the script will show all banned IP addresses.
|
the script will show all banned IP addresses.
|
||||||
|
|
||||||
|
To get a more detailed `status` view, run
|
||||||
|
|
||||||
|
```bash
|
||||||
|
setup fail2ban status
|
||||||
|
```
|
||||||
|
|
||||||
### Managing Bans
|
### Managing Bans
|
||||||
|
|
||||||
You can manage F2B with the `setup` script. The usage looks like this:
|
You can manage F2B with the `setup` script. The usage looks like this:
|
||||||
|
|
|
@ -6,6 +6,7 @@ source /usr/local/bin/helpers/index.sh
|
||||||
function __usage() {
|
function __usage() {
|
||||||
echo "Usage: ./setup.sh fail2ban [<ban|unban> <IP>]"
|
echo "Usage: ./setup.sh fail2ban [<ban|unban> <IP>]"
|
||||||
echo " ./setup.sh fail2ban log"
|
echo " ./setup.sh fail2ban log"
|
||||||
|
echo " ./setup.sh fail2ban status"
|
||||||
}
|
}
|
||||||
|
|
||||||
fail2ban-client ping &>/dev/null || _exit_with_error "Fail2ban not running"
|
fail2ban-client ping &>/dev/null || _exit_with_error "Fail2ban not running"
|
||||||
|
@ -72,6 +73,12 @@ else
|
||||||
cat /var/log/mail/fail2ban.log
|
cat /var/log/mail/fail2ban.log
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
( 'status' )
|
||||||
|
for JAIL in "${JAILS[@]}"; do
|
||||||
|
printf '%s\n\n' "$(fail2ban-client status "${JAIL}" 2>&1)"
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
|
||||||
( * )
|
( * )
|
||||||
__usage
|
__usage
|
||||||
_exit_with_error "Unknown command '${1}'"
|
_exit_with_error "Unknown command '${1}'"
|
||||||
|
|
|
@ -60,6 +60,7 @@ ${RED}[${ORANGE}SUB${RED}]${ORANGE}COMMANDS${RESET}
|
||||||
setup fail2ban ${CYAN}ban${RESET} <IP>
|
setup fail2ban ${CYAN}ban${RESET} <IP>
|
||||||
setup fail2ban ${CYAN}unban${RESET} <IP>
|
setup fail2ban ${CYAN}unban${RESET} <IP>
|
||||||
setup fail2ban ${CYAN}log${RESET}
|
setup fail2ban ${CYAN}log${RESET}
|
||||||
|
setup fail2ban ${CYAN}status${RESET}
|
||||||
|
|
||||||
${LBLUE}COMMAND${RESET} debug ${RED}:=${RESET}
|
${LBLUE}COMMAND${RESET} debug ${RED}:=${RESET}
|
||||||
setup debug ${CYAN}fetchmail${RESET}
|
setup debug ${CYAN}fetchmail${RESET}
|
||||||
|
|
Loading…
Reference in a new issue