Fix: Postfix mydestination mit vollem Pfad /usr/sbin/postconf und korrektem myhostname
parent
315608a108
commit
be3502f197
|
|
@ -341,19 +341,21 @@ JAILEOF
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Postfix: Hostname in mydestination eintragen damit System-Mails (cron, PHP)
|
# Postfix: myhostname + $myhostname in mydestination eintragen damit System-Mails
|
||||||
# nicht als Relay-Versuch gewertet werden und fail2ban die eigene IP nicht bannt
|
# (cron, PHP mail()) nicht als Relay-Versuch gewertet werden
|
||||||
if command -v postconf >/dev/null 2>&1; then
|
local POSTCONF=/usr/sbin/postconf
|
||||||
local srv_host
|
local POSTFIX=/usr/sbin/postfix
|
||||||
srv_host=$(hostname -f 2>/dev/null || hostname 2>/dev/null || true)
|
if [[ -x "$POSTCONF" ]]; then
|
||||||
if [[ -n "$srv_host" ]]; then
|
local pf_host
|
||||||
local current_dest
|
pf_host=$("$POSTCONF" -h myhostname 2>/dev/null || true)
|
||||||
current_dest=$(postconf -h mydestination 2>/dev/null || true)
|
local current_dest
|
||||||
if ! echo "$current_dest" | grep -qF "$srv_host"; then
|
current_dest=$("$POSTCONF" -h mydestination 2>/dev/null || true)
|
||||||
postconf -e "mydestination = $srv_host, localhost.localdomain, localhost"
|
local need_update=0
|
||||||
postfix reload >/dev/null 2>&1 || true
|
[[ -n "$pf_host" ]] && ! echo "$current_dest" | grep -qF "$pf_host" && need_update=1
|
||||||
echo "[✓] Postfix: $srv_host zu mydestination hinzugefügt (System-Mails lokal zugestellt)."
|
if [[ "$need_update" -eq 1 ]]; then
|
||||||
fi
|
"$POSTCONF" -e "mydestination = $pf_host, \$myhostname, localhost.localdomain, localhost"
|
||||||
|
[[ -x "$POSTFIX" ]] && "$POSTFIX" reload >/dev/null 2>&1 || true
|
||||||
|
echo "[✓] Postfix: $pf_host zu mydestination hinzugefügt (System-Mails lokal zugestellt)."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue