mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
Simplify fail2ban output (#2703)
This commit is contained in:
parent
57aeb6db2a
commit
11f8cc7ee9
|
@ -9,7 +9,6 @@ fail2ban-client ping &>/dev/null || _exit_with_error "Fail2ban not running"
|
|||
|
||||
unset JAILS
|
||||
declare -a JAILS
|
||||
IP_REGEXP='((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)'
|
||||
|
||||
for LIST in $(fail2ban-client status | grep "Jail list" | cut -f2- | sed 's/,/ /g')
|
||||
do
|
||||
|
@ -22,13 +21,11 @@ then
|
|||
|
||||
for JAIL in "${JAILS[@]}"
|
||||
do
|
||||
BANNED_IPS=$(fail2ban-client status "${JAIL}" \
|
||||
| grep 'Banned IP list' \
|
||||
| grep -oE "${IP_REGEXP}")
|
||||
BANNED_IPS=$(fail2ban-client status "${JAIL}" | grep -oP '(?<=Banned IP list:\s).+')
|
||||
|
||||
if [[ -n ${BANNED_IPS} ]]
|
||||
then
|
||||
echo "Banned in ${JAIL}: ${BANNED_IPS//$'\n'/, }"
|
||||
echo "Banned in ${JAIL}: ${BANNED_IPS}"
|
||||
IPS_BANNED=1
|
||||
fi
|
||||
done
|
||||
|
|
Loading…
Reference in a new issue