I have a server which is configured as a postfix MTA and on which runs also a munin node. In /etc/aliases I have add:
root: [email protected]
in the main.cf of postfix is configured:
mydomain = my.domain
myorigin = $mydomain
alias_database = hash:/etc/aliases
relay_domains = my.domain
append_at_myorigin = no
...
After each change of aliases or postfix configuration files I have called newaliases
or postmap <cfgfile>
and restart postfix.
Each time if munin will send a (error) email I get this in the maillog file:
Dec 22 16:45:19 myserver postfix/pickup[21509]: 5CFBA2011E0: uid=995 rom=<munin>
Dec 22 16:45:19 myserver postfix/cleanup[22094]: 5CFBA2011E0:
message-id=<[email protected]>
Dec 22 16:45:19 myserver postfix/qmgr[21510]: 5CFBA2011E0: from=<munin>, size=999, nrcpt=1
(queue active)
Dec 22 16:45:20 myserver postfix/smtp[22099]: 5CFBA2011E0: to=<[email protected]>,
orig_to=<root>, relay=internal.my.domain[XXX.182.189.136]:25, delay=4.2,
delays=3/0.01/1.1/0.09, dsn=5.1.1, status=bounced (host
internal.my.domain[XXX.182.189.136] said: 550 5.1.1 <[email protected]>: Recipient address
rejected: User unknown in virtual mailbox table (in reply to RCPT TO command))
Dec 22 16:45:20 myserver postfix/cleanup[22094]: A98B72012D2:
message-id=<[email protected]>
Dec 22 16:45:20 myserver postfix/bounce[22100]: 5CFBA2011E0: sender non-delivery
notification: A98B72012D2
Don't understand why "root" (orig_to) was not replaced with "[email protected]" like it was specified in the aliases file. Seems postfix append the myorigin
value to "root". Not sure why because I have also specified append_at_myorigin = no
.
Whats going on here? I want to replace the "root" address with "[email protected]". How can I do that?
In my case I want to use
/etc/aliases
(because some packages uses it so you have to verify changes and replicate to/etc/postfix/virtual
The problem why it doesn't work is in
myorigin
. If you setmyorigin
, all mails sent to root, nobody and other locals are changed automagicaly intoroot@myorigin
in my case: /etc/aliases:
/etc/mailname:
/etc/postfix/main.cf:
In this case all mails sent to nobody are changed into
[email protected]
(because ofmyorigin
) and then sent out somewhere.I have to change
mydestination
:and now mail sent to
nobody
is redirected toroot
, which changes into[email protected]
, but because it is inmydestination
it looks into aliases and changed into[email protected]
, but because it is inmydestination
it looks into aliases, and redirected into[email protected]
, which isn't in mydestination and it is sent where it should be sent ;DNot sure about what "my.domain" is exactly, but aliases are only used for local deliveries.
Instead, you probably want to use the virtual maps.
As root (or sudo)
In /etc/postfix/virtual (or where virtual is)
In main.cf
or (modern versions of postfix)
after the virtual map has been modified
Beware that all mail for "root" will be redirected to "[email protected]".