From 315608a10866460112e9b64242263944267cfc6b Mon Sep 17 00:00:00 2001 From: boban Date: Mon, 27 Apr 2026 05:58:15 +0200 Subject: [PATCH] =?UTF-8?q?Fix:=20Postfix=20mydestination=20erg=C3=A4nzt?= =?UTF-8?q?=20damit=20System-Mails=20lokal=20zugestellt=20werden?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/update.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/scripts/update.sh b/scripts/update.sh index e2e176d..116307e 100644 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -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 --------------------------------------------------------------