Discussion:
Virtual domains and mydestination
(too old to reply)
Dirk Stöcker
2016-02-13 20:49:36 UTC
Permalink
Hello,

with a recent update I got confused about virtual domains and
mydestination, as they seem to do different things with subdomains

I had following setup:

mydomain = stoecker.eu
myhostname = mail.stoecker.eu
mydestination = $myhostname, localhost.$mydomain, $mydomain
virtual_alias_domains = ...a bunch of domains...
virtual_alias_maps = pcre:/etc/postfix/virtual-sub

where the virtual-sub assigns different mail addresses and groups of
addresses to local users (including subdomains of stoecker.eu for each
user). Each target is a local mailbox later delivered with dovecot.

Now I got the Punycode variant of stoecker.eu (xn--stcker-xxa.eu) as well
and wanted to add it to virtual_alias_domains like all the other domains.
It did not work, as the subdomains have been rejected. I only used
subdomains for stoecker.eu before, so I never noticed that there is a
difference.

Now I checked the postfix virtual domain documentation and parameter
descriptions and I don't understand it much better. Is that intended
behaviour, that mydestination includes subdomains and
virtual_alias_domains not?

I now added "xn--stcker-xxa.eu" to mydestination and it works as expected
still I'd like to understand what I do.

Ciao
--
http://www.dstoecker.eu/ (PGP key available)
Viktor Dukhovni
2016-02-13 20:56:12 UTC
Permalink
Now I checked the postfix virtual domain documentation and parameter descriptions and I don't understand it much better. Is that intended behaviour, that mydestination includes subdomains and virtual_alias_domains not?
Neither includes sub-domains, however the default value of
relay_domains include $mydestination. I always set relay_domains
explicitly (either empty or to the desired domains).
--
Viktor.
Dirk Stöcker
2016-02-13 21:33:16 UTC
Permalink
Post by Viktor Dukhovni
Post by Dirk Stöcker
Now I checked the postfix virtual domain documentation and parameter
descriptions and I don't understand it much better. Is that intended
behaviour, that mydestination includes subdomains and
virtual_alias_domains not?
Neither includes sub-domains, however the default value of
relay_domains include $mydestination. I always set relay_domains
explicitly (either empty or to the desired domains).
Ah, so because of that default they get accepted and because they are
delivered to a local user the relay has no effect?

Am I right that "domains (and subdomains thereof)" is
only true for relay_domains and that for virtual_alias_domains I always
need to specify all the subdomains individually?

But after reading docs a bit more I think I can drop the
virtual_alias_domains completely and let the PCRE based virtual_alias_maps
do all the work?

Ciao
--
http://www.dstoecker.eu/ (PGP key available)
Viktor Dukhovni
2016-02-13 21:46:48 UTC
Permalink
Am I right that "domains (and subdomains thereof)" is only true for relay_domains and that for virtual_alias_domains I always need to specify all the subdomains individually?
Yes, but see:

http://www.postfix.org/postconf.5.html#parent_domain_matches_subdomains
http://www.postfix.org/postconf.5.html#relay_domains
http://www.postfix.org/postconf.5.html#virtual_alias_domains
But after reading docs a bit more I think I can drop the virtual_alias_domains completely and let the PCRE based virtual_alias_maps do all the work?
Well, whether or not you define virtual_domains is completely indepdent
of how rewriting is done. And you can use regexp or similar tables for
virtual alias domains as well as virtual_alias_maps.

If a domain is a virtual alias domain (i.e. no valid mailboxes, just
rewrites to other domains) then say so. If not, then don't. If you
want virtual alias sub-domains you can do that, but it is a sign that
you're doing something very unusual and potentially wrong.

virtual_domains = pcre:${config_directory}/virtual-domains.pcre

virtual-domains.pcre
/(^|\.)example\.com$/ virtual
--
Viktor.
Loading...