0

I run a Postfix server that handles several domains, and a handful of users on each domain, and I am using virtual.pcre to allow various useful aliases (for example, /user-.*@ myuser to deliver email to user@example.com, user-shadywebsite@example.com, etc to the myuser account).

However, a thing that I keep running into is if an outgoing email address happens to match one of the PCRE rules (for example, user-information@someotherdomain.example), it gets delivered directly to the myuser account, rather than being sent out.

I would like to avoid having to configure these mappings for all of my incoming domains, and would only like Postfix to actually handle the virtual addresses that it's configured to look at.

A simplified/genericized version of my /etc/postfix/virtual.pcre is below:

/somedomain\.example/ VIRTUAL
/otherdomain\.example/ VIRTUAL

/someuser@/ myuser
/someuser-.*@/ myuser
/abuse@/ myuser

/otheruser@/ other
/otheruser-.*@/ other

And in my main.cf I have:

virtual_alias_maps = pcre:/etc/postfix/virtual.pcre
virtual_alias_domains = $virtual_alias_maps

I had thought that the initial VIRTUAL match on the domain is what was necessary to configure Postfix to only try to handle said domain (via the virtual_alias_domains directive in main.cf), but it seems that I am missing something, as this ends up intercepting all outgoing email (for example, someuser@somewhere-else.example gets delivered to the myuser account).

So, is there a way to make Postfix only handle the virtual domains that I declare in /etc/postfix/virtual.pcre, without undergoing a combinatorial explosion of username/domain pairs?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.