I have configured a Postfix server with the main domain and several virtual domains, cross-checking multiple tutorials and the official documentation on virtual hosting. The Postfix is also set up to ultimately pass all mails to Dovecot, which should handle the (Unix) user mailboxes. In other words, all I need Postfix to do is address rewriting on the receiving end.
The (to my knowledge) important excerpts from my configuration are as follows (if anything important is missing, please remind me, I'll edit the question):
/etc/postfix/main.cf
:
myhostname = mail.first_domain.tld
mydomain = first_domain.tld
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, mail.$mydomain
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
virtual_alias_domains = second_domain.tld, third_domain.tld, ...
virtual_alias_maps = hash:/etc/postfix/virtual
local_transport = dovecot
mailbox_transport = dovecot
virtual_transport = dovecot
/etc/postfix/master.cf
:
# ...
dovecot unix - n n - - pipe
flags=DRhu user=vmail:vmail argv=/usr/libexec/dovecot/deliver -f ${sender} -d ${recipient}
# ...
/etc/postfix/virtual
:
postmaster@second_domain.tld postmaster
postmaster@third_domain.tld postmaster
# ...
/etc/aliases
:
postmaster@first_domain.tld postmaster
# ...
In my use case, I don't need to make any distinction between local and virtual mail delivery. I'd like to simply rewrite the addresses if an appropriate rule is found. If not, just pass the mail as-is. However, the virtual hosting documentation very clearly states to "NEVER list a virtual alias domain name as a mydestination domain!"
Is there a way to use only virtual delivery for everything? Completely forgo the /etc/aliases
file for configuration simplicity. Ideally, I'd like to be able to just define all receiving addresses manually and don't mind explicitly writing them out.
0 Answers