Saslauthd funktioniert nicht zuverlässig

Mir wurde vom Support nochmal bestätigt, was ich schon vermutet habe. Aktuell gibt keine andere Lösung als den saslauthd neuzustarten, falls Probleme auftreten. Das Problem gibt es seit 2018, aber das scheint mir ein Upstream-Problem zu sein, bei dem Univention nicht viel tun kann.

Ich behelfe mir in der Zwischenzeit mit einem Script über Cron das /var/log/mail.log checkt und bei Bedarf saslauthd.service neustartet.

Falls wer Interesse oder Verbesserungsvorschläge hat:

#!/bin/bash

# set variables
log="logger $0:"
failString="SASL authentication failure: cannot connect to saslauthd server: Connection refused"
logFile=/var/log/mail.log
statusFile=/tmp/logErrStatus
lockFile=/tmp/restartDaemonFromLog.lock

#check if script is already running
if [ -e $lockFile ]; then
    $log "restart script for saslauthd already running. Exiting ..."
    exit
else
    touch $lockFile
fi

#check if counter can be saved in $statusFile
if [[ ! -f "$statusFile" ]]; then
    touch $statusFile
fi

#count errors in log
countErr=$(grep -i "$failString" $logFile | wc -l)

#read errors from previous run
prevCountErr=$(cat "$statusFile")

#check if daemon restart is necessary
if [[ $countErr > $prevCountErr ]]; then
    $log "Restarting saslauthd: $countErr errors counted ($prevCountErr previous)"
    systemctl restart saslauthd.service
else
    $log "saslauthd running: $countErr errors counted ($prevCountErr previous); this is fine"
fi

#write new value in $statusFile
echo $countErr > $statusFile

#delete lockFile
rm $lockFile

exit
1 Like