Joergen Thomsen:
[ Charset ISO-8859-1 converted... ]
> Hi
> 
> I wonder if there is any obvious explanation of this problem (currently with 
> Postfix 3.5.1).
> 
> I have several virtual domains defined in /etc/postfix/virtual forwarding 
> emails to e.g. gmail
> accounts etc.
> E.g. (youmail.dk is the actual external domain)
> 
> mycustomer.dk      virtual
> postmas...@mycustomer.dk   myc...@youmail.dk
> u...@mycustomer.dk       myc...@youmail.dk
...
> It is usually working fine, but recently mail sometimes get delivered
> using the local daemon to the luser_relay user and not to the external user 
> using the smtp daemon
> 
> Incorrect:
> 
> 2020-04-25T08:21:56.742991+02:00 vennely postfix/smtpd[58433]: maps_find: 
> virtual_alias_maps:
> hash:/etc/postfix/virtual(0,lock|fold_fix|utf8_request): u...@mycustomer.dk = 
> myc...@youmail.dk
> 2020-04-25T08:21:56.743066+02:00 vennely postfix/smtpd[58433]: 
> mail_addr_find: u...@mycustomer.dk ->
> myc...@youmail.dk

The above was logged by the after-filter SMTP daemon. As expected,
during recipient address validation it finds that u...@mycustomer.dk
is aliased to myc...@youmail.dk.

> 2020-04-25T08:21:56.802082+02:00 vennely postfix/smtp[58431]: 0E68A201E8462: 
> to=<u...@mycustomer.dk>,
> relay=127.0.0.1[127.0.0.1]:10024, delay=2, delays=0.43/0/0/1.6, dsn=2.0.0, 
> status=sent (250 2.0.0
> from MTA(smtp:[127.0.0.1]:10026): 250 2.0.0 Ok: queued as B1ADB201A1C35)
> 2020-04-25T08:21:56.802875+02:00 vennely postfix/qmgr[16285]: 0E68A201E8462: 
> removed

Above is logging from the before-filter path.

> 2020-04-25T08:21:57.845860+02:00 vennely postfix/local[58436]: B1ADB201A1C35: 
> to=<lu...@jth.net>,
> orig_to=<u...@mycustomer.dk>, relay=local, delay=1.1, delays=0.06/0.04/0/1, 
> dsn=2.0.0, status=sent
> (delivered to mailbox)
> 2020-04-25T08:21:57.846156+02:00 vennely postfix/qmgr[16285]: B1ADB201A1C35: 
> removed

Here, the cleanup daemon did not rewrite u...@mycustomer.dk to
myc...@youmail.dk.

In master.cf there is only one cleanup service:

cleanup    unix  n       -       n       -       0       cleanup

so no options that would mess with virtual alias expansion.

The only place that suppresses virtual alias expansion is on the
network-facing SMTP daemon before the content filter, which is OK.

smtpd      pass  -       -       n       -       -       smtpd
    -o content_filter=smtp-amavis:[127.0.0.1]:10024
    -o receive_override_options=no_address_mappings

In main.cf you have:

virtual_alias_maps = hash:/etc/postfix/virtual, pcre:/etc/postfix/virtual_regexp

That brings the question, how do you maintain these files? One way
to temporarily 'lose' aliases is if you manage the files with scp
which overwrites, instead of using rsync which creates a copy under
a temporary name, and renames the copy to the permanent name after
the file is complete.

If you execute 'postmap' commands there is also the possibility
that an alias will briefly not exist. 

To safely update hash: and btree: tables, see "Updating Berkeley
DB files safely" in http://www.postfix.org/DATABASE_README.html#safe_db
The commands are meant to be executed in /etc/postfix.

        Wietse

Reply via email to