Hier werden die Unterschiede zwischen zwei Versionen gezeigt.
| Beide Seiten, vorherige Überarbeitung Vorherige Überarbeitung Nächste Überarbeitung | Vorherige Überarbeitung | ||
|
lpi2:postfix-virtual-domains [2014/02/27 00:19] ingo_wichmann [Postfix konfigurieren] |
lpi2:postfix-virtual-domains [2024/08/10 13:08] (aktuell) ingo_wichmann |
||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| ====== Postfix: virtuelle Domains und Benutzer in Textdateien ====== | ====== Postfix: virtuelle Domains und Benutzer in Textdateien ====== | ||
| - | //in der Praxis würde ich LDAP oder eine Datenbank bevorzugen// | ||
| - | Voraussetzung: [[postfix-dovecot-imapd]] mit lmtp | + | Voraussetzung: [[postfix-dovecot-imapd]] mit [[wpde>LMTP]] und [[dovecot-virtual-domains]] |
| ===== Maps erstellen ===== | ===== Maps erstellen ===== | ||
| - | ''/etc/postfix/virtual_mailbox_domains.txt'' : | + | <file txt /etc/postfix/virtual_mailbox_domains.txt> |
| - | <file> | + | |
| # postmap hash:/etc/postfix/virtual_mailbox_domains.txt | # postmap hash:/etc/postfix/virtual_mailbox_domains.txt | ||
| example.com yes | example.com yes | ||
| Zeile 13: | Zeile 11: | ||
| postmap hash:/etc/postfix/virtual_mailbox_domains.txt | postmap hash:/etc/postfix/virtual_mailbox_domains.txt | ||
| + | -> erzeugt ''/etc/postfix/virtual_mailbox_domains.txt.db'' | ||
| Domain nachschlagen testen: | Domain nachschlagen testen: | ||
| postmap -q example.com hash:/etc/postfix/virtual_mailbox_domains.txt | postmap -q example.com hash:/etc/postfix/virtual_mailbox_domains.txt | ||
| - | + | -> ''yes'' | |
| - | ''/etc/postfix/virtual_alias_maps.txt'' : | + | <file txt /etc/postfix/virtual_alias_maps.txt> |
| - | <file> | + | |
| # postmap hash:/etc/postfix/virtual_alias_maps.txt | # postmap hash:/etc/postfix/virtual_alias_maps.txt | ||
| postmaster@example.com user1@example.com | postmaster@example.com user1@example.com | ||
| Zeile 29: | Zeile 27: | ||
| Empfänger nachschlagen testen: | Empfänger nachschlagen testen: | ||
| postmap -q postmaster@example.com hash:/etc/postfix/virtual_alias_maps.txt | postmap -q postmaster@example.com hash:/etc/postfix/virtual_alias_maps.txt | ||
| - | postmap -q user2@example.com hash:/etc/postfix/virtual_alias_maps.txt | + | -> ''user1@example.com'' |
| + | postmap -q user1@example.com hash:/etc/postfix/virtual_alias_maps.txt | ||
| + | -> ''user1@example.com'' | ||
| ===== Postfix konfigurieren ===== | ===== Postfix konfigurieren ===== | ||
| - | ''/etc/postfix/main.cf'' : | + | <file txt /etc/postfix/main.cf> |
| - | <file> | + | mydestination = localhost |
| virtual_mailbox_domains = hash:/etc/postfix/virtual_mailbox_domains.txt | virtual_mailbox_domains = hash:/etc/postfix/virtual_mailbox_domains.txt | ||
| virtual_mailbox_maps = hash:/etc/postfix/virtual_alias_maps.txt | virtual_mailbox_maps = hash:/etc/postfix/virtual_alias_maps.txt | ||
| Zeile 41: | Zeile 42: | ||
| virtual_transport = lmtp:unix:private/dovecot-lmtp | virtual_transport = lmtp:unix:private/dovecot-lmtp | ||
| </file> | </file> | ||
| + | postfix reload | ||
| + | |||
| + | ===== testen ===== | ||
| + | Client: | ||
| + | swaks --from user1@example.com --to user2@example.com -s example.com -a -au user1@example.com -ap xxxxxx | ||
| + | -> ''Ok: queued as 46AE13EB41'' | ||
| + | |||
| + | Server: | ||
| + | journalctl -g 46AE13EB41 | ||
| + | -> ''postfix/lmtp[…]: 46AE13EB41: to=<user2@example.com>, relay=example.com[private/dovecot-lmtp], …, status=sent'' | ||
| ====== Dokumentation ====== | ====== Dokumentation ====== | ||
| * http://www.postfix.org/VIRTUAL_README.html#virtual_mailbox | * http://www.postfix.org/VIRTUAL_README.html#virtual_mailbox | ||
| - | * https://workaround.org/ispmail/squeeze/postfix-domain-types | ||