postfix-users May 2014 archive
Main Archive Page > Month Archives  > postfix-users archives
postfix-users: Re: If you specify $myorigin, isn't that supposed

Re: If you specify $myorigin, isn't that supposed to be appended to unqualified recipients?

From: /dev/rob0 <rob0_at_nospam>
Date: Tue May 13 2014 - 19:46:52 GMT
To: postfix-users@postfix.org

On Tue, May 13, 2014 at 02:15:48PM -0500, deoren wrote:
> If I send an email to 'root' and $myorgin is set to $mydomain
> (which is also set properly), shouldn't 'root' be qualified as
> root@$mydomain (i.e., root@example.com)?

Correct, see:
        http://www.postfix.org/postconf.5.html#append_at_myorigin

> Here's my Postfix conf:
>
> root@sparky:~# postconf -n

> mydomain = example.com

> myorigin = $mydomain

> recipient_canonical_classes = envelope_recipient
> recipient_canonical_maps = hash:/etc/postfix/pfix-no-srs.cf,
> tcp:127.0.0.1:10004,

> sender_canonical_classes = envelope_sender
> sender_canonical_maps = hash:/etc/postfix/pfix-no-srs.cf,
> tcp:127.0.0.1:10003,

But here you seem to be using canonical(5) rewriting.

> virtual_alias_domains = example.com
> virtual_alias_maps = hash:/etc/postfix/virtual.common.conf,
> hash:/etc/postfix/virtual.example.com.conf,
>
> and both local and virtual aliases:
>
> grep -i 'root' /etc/aliases /etc/postfix/*.conf | grep -v '#'
>
> postmaster: root

example.com is a virtual alias domain. You're aliasing everything
here to a virtual alias, root@example.com ...

> adm: root
> bin: root
> daemon: root
> exim: root
> lp: root
> mail: root
> named: root
> nobody: root
> postfix: root
> operator: root
> ftp: root
> hostmaster: root
> noc: root
> security: root
> usenet: root
> uucp: root
> webmaster: root
>
>
> /etc/postfix/sender_access.conf:root@example.com OK
> /etc/postfix/sender_access.conf:root@example.net OK

[ These all look pointless, why do you need them? ]

> /etc/postfix/virtual.common.conf:MAILER-DAEMON root
> /etc/postfix/virtual.common.conf:postmaster root
> /etc/postfix/virtual.common.conf:adm root
> /etc/postfix/virtual.common.conf:bin root
> /etc/postfix/virtual.common.conf:daemon root
> /etc/postfix/virtual.common.conf:exim root
> /etc/postfix/virtual.common.conf:lp root
> /etc/postfix/virtual.common.conf:mail root
> /etc/postfix/virtual.common.conf:named root
> /etc/postfix/virtual.common.conf:nobody root
> /etc/postfix/virtual.common.conf:postfix root
> /etc/postfix/virtual.common.conf:operator root
> /etc/postfix/virtual.common.conf:abuse root
> /etc/postfix/virtual.common.conf:ftp root
> /etc/postfix/virtual.common.conf:hostmaster root
> /etc/postfix/virtual.common.conf:news root
> /etc/postfix/virtual.common.conf:noc root
> /etc/postfix/virtual.common.conf:security root
> /etc/postfix/virtual.common.conf:usenet root
> /etc/postfix/virtual.common.conf:uucp root
> /etc/postfix/virtual.common.conf:webmaster root
> /etc/postfix/virtual.common.conf:www root
> /etc/postfix/virtual.common.conf:scripts root
>
> /etc/postfix/virtual.example.com.conf:root@example.com me@example.net

... And indeed your virtual alias address exists.

> Here are two examples of sending mail to an unqualified 'root'
--------------------------^ faulty testing of
> address. One if via the mail command and the other is through
> cron handling uncaught output from a job. I would expect that
> both would yield the same results, but that's not the case.
>
> * I send an email using the 'mail' command (local user, doesn't
> seem to matter which user it is):
>
> echo "Testing" | mail -s "Test email to unqualified root address" root
>
> and it gets delivered to the local 'root' system account
>
> May 13 12:54:01 sparky postfix/pickup[24601]: 98354214B7: uid=0 from=<root>
> May 13 12:54:01 sparky postfix/cleanup[24668]: 98354214B7:
> message-id=<20140513175401.98354214B7@sparky.example.com>
> May 13 12:54:01 sparky postfix/qmgr[24600]: 98354214B7:
> from=<root@example.com>, size=388, nrcpt=1 (queue active)
> May 13 12:54:01 sparky postfix/local[24673]: 98354214B7:
> to=<root@sparky.example.com>, relay=local, delay=0.1, delays=0.09/0.01/0/0,
> dsn=2.0.0, status=sent (delivered to mailbox)

There is no "orig-to=" here. No rewriting took place. Your MUA
apparently converted the "root" recipient into
"root@sparky.example.com" before Postfix saw it.

> May 13 12:54:01 sparky postfix/qmgr[24600]: 98354214B7: removed
>
> I remember reading that if you don't have $myorigin specified then
> $myhostname will be used as the default value to qualify addresses.
> That appears to be what's happening here?

Nope, check your mail(1) manual.

> * A cron job has output which isn't piped to a file or redirected
> somewhere and /etc/crontab has 'MAILTO=root' defined.
>
> The mail from cron appears to be subject to virtual aliasing (at
> least the destination address listed in
> /etc/postfix/virtual.example.com.conf is used):
>
> May 13 12:54:01 sparky postfix/pickup[24601]: 7218221551: uid=0 from=<root>
> May 13 12:54:01 sparky postfix/cleanup[24668]: 7218221551:
> message-id=<20140513175401.7218221551@sparky.example.com>
> May 13 12:54:01 sparky postfix/qmgr[24600]: 7218221551:
> from=<root@example.com>, size=782, nrcpt=1 (queue active)
> May 13 12:54:02 sparky postfix/smtp[24672]: 7218221551: to=<me@example.net>,
> orig_to=<root>, relay=rusty.example.net[192.168.3.5]:25, delay=0.92,
  ^^^^^^^^^^^^^^ Yes, Postfix rewrote this in virtual_alias_maps.
> delays=0.18/0.01/0.61/0.12, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as
> 43ACE810A)

> http://www.fredshack.com/docs/postfix.html

Who's this? Just stick with the documentation you got with your own
Postfix, or use www.postfix.org.
-- http://rob0.nodns4.us/ Offlist GMX mail is seen only if "/dev/rob0" is in the Subject: