Not sure if the solution I use is relevant here. I have the situation where there are multiple mail domains/sub-domains to accept and all I wanted to achieve was postfix to auto rewrite the domain portion of the address to deliver to the prime domain mailbox.
eg: {username}@<second.domain> is accepted, rewritten and delivered to {username}@<primary.domain> without needing to add an email alias for each user.
To do this, I have added: canonical_maps = regexp:/etc/postfix/rewrite to /etc/postfix/main.cf
and added the following regex line to a file: /etc/postfix/rewrite:
/^(.*)@secondary\.com$/ $1@primary.com
(add other domains similarly - each to a new line)
The server will still only accept legitimate users/aliases and reject unknowns (ie it isn’t a catchall).
Of course to do this, you will create a template fragment such as:
/etc/e-smith/templates-custom/etc/postfix/main.cf/20canonical_maps
expand the template: expand-template /etc/postfix/main.cf
and restart postfix: systemctl restart postfix
This is working for me with multiple domains and sub-domains both externally and internally (eg via webtop).
Klaus