Inhaltsverzeichnis

Postfix: virtuelle Domains und Benutzer in Textdateien

Voraussetzung: postfix-dovecot-imapd mit LMTP und dovecot-virtual-domains

Maps erstellen

/etc/postfix/virtual_mailbox_domains.txt
# postmap hash:/etc/postfix/virtual_mailbox_domains.txt
example.com yes
postmap hash:/etc/postfix/virtual_mailbox_domains.txt

→ erzeugt /etc/postfix/virtual_mailbox_domains.txt.db Domain nachschlagen testen:

postmap -q example.com hash:/etc/postfix/virtual_mailbox_domains.txt

yes

/etc/postfix/virtual_alias_maps.txt
# postmap hash:/etc/postfix/virtual_alias_maps.txt
postmaster@example.com  user1@example.com
abuse@example.com       user1@example.com
user1@example.com       user1@example.com
user2@example.com       user2@example.com
admin@example.com       user1@example.com,user2@example.com
postmap hash:/etc/postfix/virtual_alias_maps.txt

Empfänger nachschlagen testen:

postmap -q postmaster@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

/etc/postfix/main.cf
mydestination = localhost
 
virtual_mailbox_domains = hash:/etc/postfix/virtual_mailbox_domains.txt
virtual_mailbox_maps    = hash:/etc/postfix/virtual_alias_maps.txt
virtual_alias_maps      = hash:/etc/postfix/virtual_alias_maps.txt
 
virtual_transport = lmtp:unix:private/dovecot-lmtp
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