/etc/aliases for root seems to be ignored when sending mail to root

Hi,
on my UCS Backup (ox is installed as well) i noticed that i am not receiving mails via cron, so i did some research.

There is a mail-domain (best4automic.de) which is different to the mailaddress i was setting for root)

the ucr variable is set with the correct address

mail/alias/root: bpa-admins@best-blu.de

The entry is also in /etc/alias

webmaster: root
postmaster: root
root: bpa-admins@best-blu.de

When sending a mail directly to that address, everything is working fine

echo "foo" | mailx -s "bar" bpa-admins@best-blu.de

which results into

Jan 15 11:38:16 backup postfix/smtp[115849]: 8985F2032FB: to=<bpa-admins@best-blu.de>, relay=127.0.0.1[127.0.0.1]:10024, delay=0.33, delays=0.06/0.01/0/0.26, 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 D11C6201ED7)

When i am sending Mails directly to “root” (like cron for example)

root@backup:/etc/postfix# echo "foo" | mailx -s "bar" root

it will use the mail domain of the OX System (FGDN) instead of the entry from /etc/aliases

Jan 15 11:39:25 backup postfix/smtp[116014]: 1971C201ED7: to=<root@mail.best4automic.de>, relay=smtp.rzone.de[81.169.145.98]:25, delay=0.13, delays=0.02/0.01/0.09/0.01, dsn=5.2.0, status=bounced (host smtp.rzone.de[81.169.145.98] said: 550 5.2.0 No such mailbox (in reply to RCPT TO command))

What is causing that /etc/aliases is ignored? Is it useful to change this? i did an ldapsearch for uid=root but i was not able to find that user, so i am not sure why the different mailaddress is used.

the issue was that the entry needs to be in /etc/postfix/virtual and not /etc/aliases in this case

After putting the entry there by hand (did not found an ucr template) and executing postalias its working

Yeah, this is due to how Postfix works internally. /etc/aliases is only evaluated by the local transport, meaning the transport that delivers mail to the local files in /var/spool/mail for users that actually exist in the system’s passwd database (see getent passwd).

However, most integrated solutions do not require the final recipient to exist in passwd. Postfix only requires the knowledge that the account exists in the target system (LDAP queries are used for that on Univention with OX, Kopano, … instead of lookups in passwd), and then it’ll use the virtual transport/virtual mailbox transport (e.g. handing the mail over to another running program such as the Kopano delivery agent via LMTP). In that case /etc/aliases isn’t considered at all.

The virtual_alias_maps are always evaluated, though, even if the final destination is the local transport. Yeah, that’s confusingly named.

Mastodon