mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2026-03-04 15:54:48 +01:00
Address issues with postgrey, nsd, and rsyslogd introduced with jammy
1. `systemctl reload postgrey` is broken, so use restart in that case 2. `systemctl restart nsd` succeeds once /var/log is writable by systemd. However, nsd still fails to write to /var/log/nsd.log if the file already exists 3. the default configuration for rsyslogd is to no longer create a /var/run/rsyslogd.pid file, so use /usr/bin/pidof in that case
This commit is contained in:
@@ -116,18 +116,20 @@ detect_syslog_error() {
|
||||
awk '
|
||||
/status=(bounced|deferred|undeliverable)/ { exit 1 }
|
||||
/warning:/ && /spamhaus\.org: RBL lookup error:/ { exit 2 }
|
||||
!/postfix\/qmgr/ && /warning:/ { exit 1 }
|
||||
!/postfix\/qmgr/ && !/nsd\[[0-9]+\]/ && /warning:/ { exit 1 }
|
||||
/nsd\[[0-9]+\]: error: Cannot open .*nsd\.log/ { exit 2 }
|
||||
/named\[[0-9]+\]:.* receive error: .*: connection reset/ { exit 2 }
|
||||
/(fatal|reject|error):/ { exit 1 }
|
||||
/Error in / { exit 1 }
|
||||
/Exception on / { exit 1 }
|
||||
/named\[\d+\]:.* verify failed/ { exit 1 }
|
||||
/named\[[0-9]+\]:.* verify failed/ { exit 1 }
|
||||
' \
|
||||
>>$TEST_OF 2>&1 <<< "$line"
|
||||
if [ $? -eq 1 ]; then
|
||||
r=$?
|
||||
if [ $r -eq 1 ]; then
|
||||
let ec+=1
|
||||
record "$F_DANGER[ERROR] $line$F_RESET"
|
||||
elif [ $? -eq 2 ]; then
|
||||
elif [ $r -eq 2 ]; then
|
||||
let wc+=1
|
||||
record "$F_WARN[ WARN] $line$F_RESET"
|
||||
else
|
||||
@@ -256,8 +258,17 @@ check_logs() {
|
||||
[ ${#types[@]} -eq 0 ] && types=(syslog slapd mail)
|
||||
|
||||
# flush records
|
||||
kill -HUP $(cat /var/run/rsyslogd.pid)
|
||||
sleep 2
|
||||
local pid
|
||||
if [ -e /var/run/rsyslogd.pid ]; then
|
||||
# the pid file won't exist if rsyslogd was started with -iNONE
|
||||
pid=$(cat /var/run/rsyslogd.pid)
|
||||
else
|
||||
pid=$(/usr/bin/pidof rsyslogd)
|
||||
fi
|
||||
if [ ! -z "$pid" ]; then
|
||||
kill -HUP $pid
|
||||
sleep 2
|
||||
fi
|
||||
|
||||
if array_contains syslog ${types[@]}; then
|
||||
detect_syslog_error && $assert &&
|
||||
|
||||
@@ -39,14 +39,18 @@ postgrey_whitelist_recipents() {
|
||||
echo "$recipient" >> "$wl" || \
|
||||
die "Could not add postgrey whitelist recipient to $wl"
|
||||
done
|
||||
systemctl reload postgrey
|
||||
if ! systemctl reload postgrey >/dev/null 2>&1; then
|
||||
systemctl restart postgrey >>$TEST_OF 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
postgrey_reset_whitelists() {
|
||||
local wl="/etc/postgrey/whitelist_recipients.local"
|
||||
rm -f "$wl"
|
||||
systemctl reload postgrey
|
||||
if ! systemctl reload postgrey >/dev/null 2>&1; then
|
||||
systemctl restart postgrey >>$TEST_OF 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user