fail2ban: add 'log' command (#3299)

Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
This commit is contained in:
Casper 2023-05-03 00:13:44 +02:00 committed by GitHub
parent 869caf35ec
commit 423188176f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 2 deletions

View file

@ -48,6 +48,16 @@ This following configuration files inside the `docker-data/dms/config/` volume w
[github-file-f2bjail]: https://github.com/docker-mailserver/docker-mailserver/blob/master/config-examples/fail2ban-jail.cf
[github-file-f2bconfig]: https://github.com/docker-mailserver/docker-mailserver/blob/master/config-examples/fail2ban-fail2ban.cf
### Viewing All Bans
When just running
```bash
setup fail2ban
```
the script will show all banned IP addresses.
### Managing Bans
You can manage F2B with the `setup` script. The usage looks like this:
@ -56,7 +66,11 @@ You can manage F2B with the `setup` script. The usage looks like this:
docker exec <CONTAINER NAME> setup fail2ban [<ban|unban> <IP>]
```
When just running `setup fail2ban`, the script will show all banned IP addresses.
### Viewing the Log File
```bash
docker exec <CONTAINER NAME> setup fail2ban log
```
## Running Inside A Rootless Container

View file

@ -3,7 +3,11 @@
# shellcheck source=../scripts/helpers/index.sh
source /usr/local/bin/helpers/index.sh
function __usage { echo "Usage: ./setup.sh fail2ban [<ban|unban> <IP>]" ; }
function __usage
{
echo "Usage: ./setup.sh fail2ban [<ban|unban> <IP>]"
echo " ./setup.sh fail2ban log"
}
fail2ban-client ping &>/dev/null || _exit_with_error "Fail2ban not running"
@ -73,6 +77,10 @@ else
fi
;;
( 'log' )
cat /var/log/mail/fail2ban.log
;;
( * )
__usage
_exit_with_error "Unknown command '${1}'"

View file

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