[exim] Root user and aliases

Top Page
Delete this message
Reply to this message
Author: Space Ship Traveller
Date:  
To: exim users
Subject: [exim] Root user and aliases
Hi,

Sorry for another basic question.

I have exim4 setup using a database to provide local_parts, domains
and passwords, etc.

I have disabled /etc/aliases search, but have postmaster account for
all appropriate domains in the database.

I have some mail being generated locally by cron.

Can someone please assist me with my understanding.

Cron is generating email to the address I assume is "root@localhost".
Is this correct?

Checking this, everything seems fine:

exim4 -bt root@localhost
R: userforward for root@localhost
R: procmail for root@localhost
R: maildrop for root@localhost
R: lowuid_aliases for root@localhost (UID 0)
R: virtual_forward_director for root@localhost to
R: mail4root for root@localhost
R: userforward for samuel@???
R: procmail for samuel@???
R: maildrop for samuel@???
R: lowuid_aliases for samuel@??? (UID 1000) XXX.org
R: virtual_forward_director for samuel@??? to
R: virtual_local_mailbox for samuel@??? in domains XXX.org ;;  
SELECT d.domain FROM mail_accounts AS ma, domains AS d, hosts AS h  
WHERE ma.domain_id = d.id AND d.host_id = h.id AND  
ma.local_part='samuel' AND d.domain='xxx.org' AND h.name='XXX' AND  
ma.is_enabled = 1 AND ma.forward IS NULL
samuel@???
     <-- root@localhost
   router = virtual_local_mailbox, transport = virtual_local_md_delivery


Now if I do a test for just root:

exim4 -bt root
failed to expand debug_output "R: smarthost for $local_part@$domain $
{@:localhost:localhost:mysql:mysql_q_ldomain}": letter or digit
expected after ${
root@???.
router = smarthost, transport = remote_smtp_smarthost
host smtp.xxx.co.nz [xxx.xxx.xxx.xxx]

Because there is no domain supplied, the mysql query fails and exim
decided to try and route the address to the smarthost.. This doesn't
really seem correct - if the address is provided without a domain,
should it default to localhost? yes? no?

Is mail ever sent to an address like this from tools such as cron
(typically/by default)?

Is it worthwhile adding some logic to fail if an address has no domain
part? Is this typical/normal? What would the smarthost conceivably do
with the mail if it received it addressed to simply "root"?

Thanks in advance for clarifying my understanding.

Kind regards,
Samuel