Fix: Postfix mydestination ergänzt damit System-Mails lokal zugestellt werden

main v1.1.429
boban 2026-04-27 05:58:15 +02:00
parent 30d2c28504
commit 315608a108
1 changed files with 16 additions and 0 deletions

View File

@ -340,6 +340,22 @@ JAILEOF
echo "[✓] Fail2Ban Jails installiert (dovecot, postfix, nginx)."
fi
fi
# Postfix: Hostname in mydestination eintragen damit System-Mails (cron, PHP)
# nicht als Relay-Versuch gewertet werden und fail2ban die eigene IP nicht bannt
if command -v postconf >/dev/null 2>&1; then
local srv_host
srv_host=$(hostname -f 2>/dev/null || hostname 2>/dev/null || true)
if [[ -n "$srv_host" ]]; then
local current_dest
current_dest=$(postconf -h mydestination 2>/dev/null || true)
if ! echo "$current_dest" | grep -qF "$srv_host"; then
postconf -e "mydestination = $srv_host, localhost.localdomain, localhost"
postfix reload >/dev/null 2>&1 || true
echo "[✓] Postfix: $srv_host zu mydestination hinzugefügt (System-Mails lokal zugestellt)."
fi
fi
fi
}
# -------- Guards --------------------------------------------------------------