Hi,

I can't help but feel the answer should be painfully obvious, but I'm just not "getting" it. Apologies for the length, but I wanted to try and include as much relevant information up front as I could. Please let me know if I've left anything out and I'll get it to you ASAP.

Thanks.

---

Question:

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., r...@example.com)?

---

Here's my Postfix conf:

root@sparky:~# postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
default_destination_concurrency_limit = 2
default_destination_rate_delay = 5s
default_extra_recipient_limit = 10
disable_vrfy_command = yes
header_checks = regexp:/etc/postfix/header_checks.conf
inet_interfaces = all
mailbox_size_limit = 0
milter_default_action = accept
mydestination = localhost.$mydomain, localhost, sparky.example.net, sparky.example.com,
mydomain = example.com
myhostname = sparky.example.com
mynetworks = 192.168.3.5 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = $mydomain
non_smtpd_milters = $smtpd_milters
permissive = permit
readme_directory = no
recipient_canonical_classes = envelope_recipient
recipient_canonical_maps = hash:/etc/postfix/pfix-no-srs.cf, tcp:127.0.0.1:10004,
recipient_delimiter = +
relayhost =
restrictive = reject
sender_canonical_classes = envelope_sender
sender_canonical_maps = hash:/etc/postfix/pfix-no-srs.cf, tcp:127.0.0.1:10003,
show_user_unknown_table_name = no
smtpd_banner = $myhostname ESMTP
smtpd_client_restrictions =
smtpd_data_restrictions =
smtpd_end_of_data_restrictions =
smtpd_helo_required = yes
smtpd_helo_restrictions =
smtpd_milters = inet:127.0.0.1:12345
smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_destination, check_recipient_access hash:/etc/postfix/recipient_access.conf, check_sender_access hash:/etc/postfix/sender_access.conf, check_client_access hash:/etc/postfix/client_access.conf, check_policy_service inet:127.0.0.1:10023, reject_invalid_helo_hostname, reject_non_fqdn_helo_hostname, reject_unknown_client_hostname, reject_unknown_sender_domain, reject_unknown_recipient_domain, reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unauth_pipelining, reject_rbl_client zen.spamhaus.org, reject_rbl_client b.barracudacentral.org,
smtpd_restriction_classes = restrictive, permissive
smtpd_sender_restrictions =
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
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:r...@example.com              OK
/etc/postfix/sender_access.conf:r...@example.net             OK

/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:r...@example.com    m...@example.net


Here are two examples of sending mail to an unqualified 'root' 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.9835421...@sparky.example.com> May 13 12:54:01 sparky postfix/qmgr[24600]: 98354214B7: from=<r...@example.com>, size=388, nrcpt=1 (queue active) May 13 12:54:01 sparky postfix/local[24673]: 98354214B7: to=<r...@sparky.example.com>, relay=local, delay=0.1, delays=0.09/0.01/0/0, dsn=2.0.0, status=sent (delivered to mailbox)
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?


* 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.7218221...@sparky.example.com> May 13 12:54:01 sparky postfix/qmgr[24600]: 7218221551: from=<r...@example.com>, size=782, nrcpt=1 (queue active) May 13 12:54:02 sparky postfix/smtp[24672]: 7218221551: to=<m...@example.net>, orig_to=<root>, relay=rusty.example.net[192.168.3.5]:25, delay=0.92, delays=0.18/0.01/0.61/0.12, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 43ACE810A)

From everything I've read my setup should allow for unqualified addresses (particularly 'root' as various scripts/logrotate conf files use it).

http://www.postfix.org/BASIC_CONFIGURATION_README.html

"For the sake of consistency between sender and recipient addresses, myorigin also specifies the domain name that is appended to an unqualified recipient address. "

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

"myorigin, if defined, will always rewrite the TO and FROM fields if they contain no domain; Those fields are left as is if they contain $myhostname. If myorigin is undefined, any domain-less field has myhostname appended to it (eg. TO = ffaure becomes ffa...@mylinux.acme.com)"

I've read the same on other pages said in roughly the same way: If $myorigin is specified, it is used appended to unqualified sender & recipient addresses.

I know that I can fill in a value for root in /etc/aliases, but I'm trying to understand why the unqualified address isn't being appended to with $myorigin. Can you help clear this up for me?

Thank you for your time.

Reply via email to