Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
|
postfix_test [2025/10/18 15:11] jango |
postfix_test [2025/10/24 13:01] (aktuell) jango |
||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| - | =====Version 1===== | + | Beispiele für [[Postfix]] Setups mit [[SASL]] für [[PAM]], [[LDAP]] etc. |
| + | |||
| + | =====SASL mit PAM===== | ||
| Ubuntu 24.04 | Ubuntu 24.04 | ||
| Zeile 5: | Zeile 7: | ||
| <code bash> | <code bash> | ||
| # Postfix und LibSASL installieren | # Postfix und LibSASL installieren | ||
| - | sudo apt install postfix libsasl2-modules sasl2-bin | + | sudo apt install |
| - | # SASL gegen PAM (lokale User) | + | # SASL soll gegen PAM authentifizieren. |
| sudo sed -i ' | sudo sed -i ' | ||
| sudo sed -i ' | sudo sed -i ' | ||
| + | |||
| sudo systemctl enable --now saslauthd | sudo systemctl enable --now saslauthd | ||
| sudo systemctl status saslauthd | sudo systemctl status saslauthd | ||
| + | |||
| + | # Postfix user muss in die SASL Gruppe! | ||
| sudo adduser postfix sasl | sudo adduser postfix sasl | ||
| - | # SASL für Postfix | + | # SASL Konfiguration |
| sudo mkdir -p / | sudo mkdir -p / | ||
| sudo tee / | sudo tee / | ||
| Zeile 22: | Zeile 27: | ||
| EOF | EOF | ||
| - | + | # SASL serverseitig | |
| - | # SASL einschalten | + | |
| sudo postconf -e " | sudo postconf -e " | ||
| sudo postconf -e " | sudo postconf -e " | ||
| Zeile 29: | Zeile 33: | ||
| sudo postconf -e " | sudo postconf -e " | ||
| - | # WICHTIG: Keine TLS-Pflicht für AUTH (sonst | + | # WICHTIG: Keine TLS-Pflicht für AUTH (sonst ohne Zertifikat kein AUTH) |
| sudo postconf -e " | sudo postconf -e " | ||
| sudo postconf -e " | sudo postconf -e " | ||
| Zeile 37: | Zeile 41: | ||
| sudo postconf -e " | sudo postconf -e " | ||
| - | # Optional wie auf smtp02: | + | # Relay Host konfigurieren. Kein AUTH! Postfix dürfen am Exchange anonym senden. Evtl aendern. |
| sudo postconf -e " | sudo postconf -e " | ||
| #sudo postconf -e " | #sudo postconf -e " | ||
| - | # master.cf smtpd Socket NICHT im Chroot!! 2 x n | + | # proxy-protocol |
| - | smtp inet n | + | |
| - | -o smtpd_sasl_auth_enable=yes | + | |
| - | + | ||
| - | # proxy-protocol | + | |
| sudo postconf -e " | sudo postconf -e " | ||
| sudo postconf -e " | sudo postconf -e " | ||
| sudo postconf -e " | sudo postconf -e " | ||
| sudo postconf -e " | sudo postconf -e " | ||
| + | |||
| + | cat <<EOF | ||
| + | ### Add this to master.cf and dont forget to add users! | ||
| + | |||
| + | smtp inet n | ||
| + | -o smtpd_sasl_auth_enable=yes | ||
| + | -o smtpd_upstream_proxy_protocol=haproxy | ||
| + | 127.0.0.1: | ||
| + | -o smtpd_upstream_proxy_protocol= | ||
| + | EOF | ||
| </ | </ | ||
| + | =====SASL mit AD===== | ||
| - | =====Version 2===== | + | Die Datei / |
| - | Ubuntu 24.04 | + | Im ursprünglichen Setup wird MECHANISMS=" |
| + | |||
| + | - saslauthd delegiert die Authentifizierung an PAM | ||
| + | - PAM wiederum nutzt lokale Systemuser oder andere Module (z. B. pam_unix, pam_winbind, | ||
| + | - Die Konfiguration erfolgt dann über /etc/pam.d/ – nicht über eine eigene saslauthd.conf | ||
| + | |||
| + | Kein Bedarf für / | ||
| + | |||
| + | Sobald du MECHANISMS=" | ||
| + | |||
| + | < | ||
| + | sudo sed -i ' | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | sudo nano / | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | ldap_servers: | ||
| + | ldap_search_base: | ||
| + | ldap_bind_dn: | ||
| + | ldap_bind_pw: | ||
| + | ldap_filter: | ||
| + | ldap_auth_method: | ||
| + | </ | ||
| + | |||
| + | =====Alma Linux===== | ||
| <code bash> | <code bash> | ||
| # Postfix und LibSASL installieren | # Postfix und LibSASL installieren | ||
| - | sudo apt install postfix | + | sudo dnf install postfix |
| + | |||
| + | # SASL soll gegen PAM authentifizieren. (lokale User) | ||
| + | sudo sed -i ' | ||
| - | # SASL gegen PAM (lokale User) | ||
| - | sudo sed -i ' | ||
| - | sudo sed -i ' | ||
| sudo systemctl enable --now saslauthd | sudo systemctl enable --now saslauthd | ||
| sudo systemctl status saslauthd | sudo systemctl status saslauthd | ||
| - | sudo adduser postfix sasl | ||
| - | # SASL für Postfix | + | sudo groupadd sasl |
| + | sudo usermod -a -G sasl postfix | ||
| + | sudo systemctl restart saslauthd | ||
| sudo mkdir -p / | sudo mkdir -p / | ||
| sudo tee / | sudo tee / | ||
| Zeile 76: | Zeile 116: | ||
| EOF | EOF | ||
| - | |||
| - | # SASL einschalten (Server-Seite) | ||
| sudo postconf -e " | sudo postconf -e " | ||
| sudo postconf -e " | sudo postconf -e " | ||
| + | sudo postconf -e " | ||
| sudo postconf -e " | sudo postconf -e " | ||
| sudo postconf -e " | sudo postconf -e " | ||
| - | # WICHTIG: Keine TLS-Pflicht für AUTH (sonst gäbe es ohne Zertifikat kein AUTH) | ||
| sudo postconf -e " | sudo postconf -e " | ||
| sudo postconf -e " | sudo postconf -e " | ||
| sudo postconf -e " | sudo postconf -e " | ||
| - | # Gegen offenes Relay absichern (nur mynetworks ODER authentifiziert) | ||
| sudo postconf -e " | sudo postconf -e " | ||
| - | # Optional wie auf smtp02: | ||
| sudo postconf -e " | sudo postconf -e " | ||
| - | #sudo postconf -e " | + | sudo postconf -e " |
| - | # master.cf smtpd Socket NICHT im Chroot!! 2 x n | + | sudo systemctl restart postfix |
| - | smtp inet n | + | sudo systemctl restart saslauthd |
| - | -o smtpd_sasl_auth_enable=yes | + | |
| - | + | ||
| - | # proxy-protocol | + | |
| - | sudo postconf -e " | + | |
| - | sudo postconf -e " | + | |
| - | sudo postconf -e " | + | |
| - | sudo postconf -e " | + | |
| </ | </ | ||