Fix: Postfix mydestination ergänzt damit System-Mails lokal zugestellt werden
parent
30d2c28504
commit
315608a108
|
|
@ -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 --------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Reference in New Issue