Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
|
postfix [2025/10/18 13:36] jango |
postfix [2025/10/22 18:54] (aktuell) jango [Proxy-Protocol] |
||
|---|---|---|---|
| Zeile 114: | Zeile 114: | ||
| =====SPF===== | =====SPF===== | ||
| - | Mit dem sender policy framework [[https:// | + | Mit dem [[spf|sender policy framework |
| < | < | ||
| Zeile 149: | Zeile 149: | ||
| =====DKIM===== | =====DKIM===== | ||
| - | [[https:// | + | [[dkim|DomainKeys Identified Mail (DKIM)]] |
| ====Installation Windows==== | ====Installation Windows==== | ||
| Zeile 417: | Zeile 417: | ||
| - | =====TPROXY===== | + | =====Transparenz hinter Proxy===== |
| - | HAProxy Backend nutzt usesrc und clientip. | + | ====TPROXY==== |
| + | |||
| + | Siehe [[TPROXY]]. | ||
| + | |||
| + | [[HAProxy]] Backend nutzt usesrc und clientip. | ||
| < | < | ||
| Zeile 435: | Zeile 439: | ||
| * usesrc clientip sorgt dafür das die Client IP verwendet wird | * usesrc clientip sorgt dafür das die Client IP verwendet wird | ||
| - | IPTables Regeln. | + | ====Proxy-Protocol==== |
| + | |||
| + | <box red> | ||
| + | |||
| + | In main.cf folgendes eintragen damit postscreen die Originale Client IP aus dem Header extrahieren kann. | ||
| < | < | ||
| - | iptables -t mangle -N DIVERT | + | smtpd_upstream_proxy_protocol = haproxy |
| - | iptables -t mangle -A PREROUTING -p tcp -m socket -j DIVERT | + | smtpd_upstream_proxy_timeout = 5s |
| - | iptables -t mangle -A DIVERT -j MARK --set-mark 1 | + | postscreen_upstream_proxy_protocol = haproxy |
| - | iptables -t mangle -A DIVERT -j ACCEPT | + | postscreen_upstream_proxy_timeout = 5s |
| + | </ | ||
| - | iptables | + | In master.cf dem smtpd Socket die nötigen Parameter mitgeben. |
| + | |||
| + | < | ||
| + | smtp inet n - y - | ||
| + | | ||
| </ | </ | ||
| - | Policy Routing. | + | und einen lokalen Socket auf Port 2525 für das Proxy-Protocol anlegen. |
| < | < | ||
| - | ip rule add fwmark 1 lookup 100 | + | 127.0.0.1:2525 inet n - n - - smtpd |
| - | ip route add local 0.0.0.0/0 dev lo table 100 | + | -o smtpd_upstream_proxy_protocol= |
| </ | </ | ||
| - | In /etc/sysctl.conf aktivieren. | + | =====Header Checks===== |
| + | |||
| + | * header_check: | ||
| + | * smtp_header_check: | ||
| + | |||
| + | ====header_check==== | ||
| + | |||
| + | In main.cf | ||
| < | < | ||
| - | echo 1 > /proc/sys/net/ | + | # Wird beim Verarbeiten der Nachricht im Cleanup-Dienst angewendet |
| - | </ | + | # Nachdem die Nachricht empfangen wurde, aber bevor sie in die Mailqueue gelangt. |
| + | header_checks = regexp:/etc/postfix/header_checks | ||
| + | </ | ||
| - | =====Proxy-Protocol===== | + | Wenn man Perl-Syntax will |
| + | |||
| + | < | ||
| + | header_checks | ||
| + | </ | ||
| + | |||
| + | Regeln definieren | ||
| + | |||
| + | < | ||
| + | / | ||
| + | / | ||
| + | / | ||
| + | </ | ||
| + | |||
| + | Aktionen | ||
| + | |||
| + | * REJECT: Mail wird abgelehnt. | ||
| + | * DISCARD: Mail wird angenommen, aber verworfen. | ||
| + | * REDIRECT: Mail wird an eine andere Adresse weitergeleitet. | ||
| + | * WARN: Nur ein Logeintrag, keine Aktion. | ||
| + | * PREPEND: Fügt einen Header hinzu. | ||
| + | |||
| + | Optional (binary) | ||
| + | |||
| + | < | ||
| + | sudo postmap / | ||
| + | </ | ||
| + | |||
| + | ====smtp_header_check==== | ||
| + | |||
| + | In main.cf | ||
| + | |||
| + | < | ||
| + | # Wird nur beim Senden über SMTP angewendet. | ||
| + | # Wenn Postfix eine Nachricht an einen anderen Mailserver übermittelt. | ||
| + | smtp_header_checks | ||
| + | </ | ||
| + | |||
| + | Regeln | ||
| + | |||
| + | < | ||
| + | /^From:/i PREPEND X-Custom-Header: | ||
| + | </ | ||
| + | |||
| + | Optional binary | ||
| + | |||
| + | < | ||
| + | sudo postmap / | ||
| + | </ | ||
| =====Links===== | =====Links===== | ||