[Watchdog] More fixes for watchdog...

master
andryyy 2019-08-13 20:19:01 +02:00
parent 294e0bc07f
commit f00b563d9c
No known key found for this signature in database
GPG Key ID: 8EC34FF2794E25EF
3 changed files with 6 additions and 14 deletions

View File

@ -33,6 +33,7 @@ RUN apk add --update \
COPY watchdog.sh /watchdog.sh
ENTRYPOINT ["/sbin/tini", "-g", "--"]
#ENTRYPOINT ["/sbin/tini", "-g", "--"]
# Less verbose
CMD /watchdog.sh 2> /dev/null

View File

@ -529,19 +529,11 @@ olefy_checks() {
}
# Notify about start
if [[ ! -z ${WATCHDOG_NOTIFY_EMAIL} ]] && [[ ! -f /tmp/watchdog_reload ]]; then
if [[ ! -z ${WATCHDOG_NOTIFY_EMAIL} ]]; then
mail_error "watchdog-mailcow" "Watchdog started monitoring mailcow."
rm /tmp/watchdog_reload
fi
# Create watchdog agents
(
touch /tmp/watchdog_reload
sleep 86400
echo "Reloading watchdog"
killall watchdog
kill 1
) &
(
while true; do
@ -759,15 +751,14 @@ while true; do
log_msg "acme-mailcow did not complete successfully"
[[ ! -z ${WATCHDOG_NOTIFY_EMAIL} ]] && mail_error "${com_pipe_answer}" "Please check acme-mailcow for further information."
elif [[ ${com_pipe_answer} == "fail2ban" ]]; then
F2B_RES=($(redis-cli -h redis-mailcow --raw GET F2B_RES))
F2B_RES=($(timeout 4s redis-cli -h redis-mailcow --raw GET F2B_RES 2> /dev/null))
if [[ ! -z "${F2B_RES}" ]]; then
redis-cli -h redis-mailcow DEL F2B_RES > /dev/null
host=
for host in "${F2B_RES[@]}"; do
log_msg "Banned ${host}"
rm /tmp/fail2ban 2> /dev/null
timeout 2s whois ${host} > /tmp/fail2ban
sleep 2.5
timeout 2s whois "${host}" > /tmp/fail2ban
[[ ! -z ${WATCHDOG_NOTIFY_EMAIL} ]] && [[ ${WATCHDOG_NOTIFY_BAN} =~ ^([yY][eE][sS]|[yY])+$ ]] && mail_error "${com_pipe_answer}" "IP ban: ${host}"
done
fi

View File

@ -366,7 +366,7 @@ services:
- /lib/modules:/lib/modules:ro
watchdog-mailcow:
image: mailcow/watchdog:1.55
image: mailcow/watchdog:1.56
# Debug
#command: /watchdog.sh
build: ./data/Dockerfiles/watchdog