mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
fail2ban: add 'log' command (#3299)
Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
This commit is contained in:
parent
869caf35ec
commit
423188176f
|
@ -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-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
|
[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
|
### 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:
|
||||||
|
@ -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>]
|
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
|
## Running Inside A Rootless Container
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,11 @@
|
||||||
# shellcheck source=../scripts/helpers/index.sh
|
# shellcheck source=../scripts/helpers/index.sh
|
||||||
source /usr/local/bin/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"
|
fail2ban-client ping &>/dev/null || _exit_with_error "Fail2ban not running"
|
||||||
|
|
||||||
|
@ -73,6 +77,10 @@ else
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
( 'log' )
|
||||||
|
cat /var/log/mail/fail2ban.log
|
||||||
|
;;
|
||||||
|
|
||||||
( * )
|
( * )
|
||||||
__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 ${RESET}
|
setup fail2ban ${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}
|
||||||
|
|
||||||
${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