----- Message from Simon Wilson <si...@simonandkate.net> ---------
Date: Wed, 24 Mar 2021 09:57:37 +1000
From: Simon Wilson <si...@simonandkate.net>
Reply-To: si...@simonandkate.net
Subject: Re: Setting up virtual alias domains and maps - failing to deliver
To: postfix-users@postfix.org
----- Message from Noel Jones <njo...@megan.vbhcs.org> ---------
Date: Tue, 23 Mar 2021 12:46:29 -0500
From: Noel Jones <njo...@megan.vbhcs.org>
Reply-To: njo...@megan.vbhcs.org
Subject: Re: Setting up virtual alias domains and maps - failing to deliver
To: postfix-users@postfix.org
On 3/23/2021 6:31 AM, Simon Wilson wrote:
Changes:
mydestination - removed, left as default
Don't do that. Set it to something specific maybe "localhost.local"
virtual_alias_domains = simonandkate.lan, simonandkate.net, etc...
virtual_alias_maps = hash:/etc/postfix/virtual (and postmapped)
Removed all virtual alias domain entries from aliases and run newaliases
The domain alias appears valid:
[root@emp87 postfix]# postmap -q ka...@simonandkate.net
hash:/etc/postfix/virtual
katie
virtual aliases should always use a fully qualified email address,
such as katie@localhost.local
-- Noel Jones
Combining postconf -d/-n, naming is:
mydestination = $myhostname, localhost.$mydomain, localhost (i.e. default)
myhostname = mail.simonandkate.net
(specified in main.cf)
mydomain = simonandkate.lan (i.e. default)
myorigin = $myhostname (i.e default)
...that pans out to:
mydestination = mail.simonandkate.net, localhost.simonandkate.lan,
localhost
myhostname = mail.simonandkate.net
mydomain = simonandkate.lan
myorigin = mail.simonandkate.net
On your second point, 'virtual' is written like this:
# simonandkate.net
si...@simonandkate.net simon
...which I will correct, note questions later.
I think the combination of naming and 'not-FQ aliases' is
contributing to the following in pflogsumm reporting (extract for
clarity):
Recipients by message count
---------------------------
519 si...@simonandkate.net
40 si...@mail.simonandkate.net
98 howie...@howiesue.net
2 howie...@mail.simonandkate.net
Mail is getting delivered but with address variation to the final
destination. Note also the example at the bottom of this email,
where d...@domwilson.net is getting changed to
d...@mail.simonandkate.net
Questions:
1. in virtual, do alias addresses always map out to
$mydestination-resolvable addresses? I.e. does it need to be
si...@simonandkate.net --> simon@something-in-$mydestination?
2. Is there a way to keep the address as the original recipient (as
it was when the domains were under mydestination) for things like
pflogsumm reporting?
3. Are there better options for my mydestination, myhostname,
mydomain, myorigin which will assist?
Thanks so much for the help Noel, Viktor, Matus.
Simon
Example:
Mar 24 09:29:49 emp87 postfix/lmtp[413570]: BDED91819ED:
to=<d...@mail.simonandkate.net>, orig_to=<d...@domwilson.net>,
relay=127.0.0.1[127.0.0.1]:10024, delay=5.4, delays=1.2/0.01/0/4.2,
dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[127.0.0.1]:10025):
250 2.0.0 Ok: queued as BF46F1819EE)
Mar 24 09:29:50 emp87 postfix/lmtp[413577]: BF46F1819EE:
to=<d...@mail.simonandkate.net>,
relay=mail.simonandkate.net[/run/cyrus/socket/lmtp], delay=0.28,
delays=0.01/0/0.01/0.26, dsn=2.1.5, status=sent (250 2.1.5 Ok
SESSIONID=<cyrus-413438-1616542189-2-830271575779132882>)
----- End message from Simon Wilson <si...@simonandkate.net> -----
It all makes sense now after (re-)reading all about address rewriting,
aliases, myorigin, etc. Thanks Noel, Viktor and Matus for your
patience. I now understand the reason having myorigin set to a virtual
alias listed domain like simonandkate.net broke delivery. It did so
*because my aliases were not FQ*. I.e. for the alias
"si...@simonandkate.net simon", Postfix appended myorigin
(append_at_myorigin (default: yes)), so it became
si...@simonandkate.net and went nowhere.
I now have it fully functioning, with virtual alias domains, etc., and
I understand WHY it works...
mydestination is now set to the default ($myhostname,
localhost.$mydomain, localhost) PLUS a new one, mail.local:
mydestination = $myhostname, localhost.$mydomain, localhost, mail.local
virtual_alias_domains contains all the domain names to check for aliases
virtual_alias_domains = simonandkate.lan,
simonandkate.net,
etc
virtual_alias_maps is defined for containing all of the aliases:
virtual_alias_maps = hash:/etc/postfix/virtual
Aliases in /etc/postfix/virtual are now all in the form:
si...@simonandkate.net simon@mail.local
myhostname is per my externally visible resolvable MX and expected HELO:
myhostname = mail.simonandkate.net
mydomain is the default myhostname minus first component, so is effectively:
mydomain = simonandkate.net
myorigin is left at default ($myhostname) which resolves to be:
myorigin = mail.simonandkate.net
...which means any non-domain-addressed mail FROM local sources become
(e.g.) root.emp87 --> root.em...@mail.simonandkate.net, which I
masquerade to root.em...@simonandkate.net, so that is all good too.
I'm now assuming that end of day reporting will show number of
deliveries to @mail.local end points, which makes sense from a
delivery point of view. Would be interesting to see if I can get
information on addressed recipients, i.e. pre-aliasing?
Last thing to do is look at what is in /etc/aliases for local
aliasing, and per previous advice look at bringing it all together.
Simon.
--
Simon Wilson
M: 0400 12 11 16