Subject: Re: replacing sendmail with postfix (summary)
To: William Allen Simpson <wsimpson@greendragon.com>
From: Greg A. Woods <woods@weird.com>
List: current-users
Date: 07/04/2003 19:42:38
[ On Friday, July 4, 2003 at 17:23:28 (-0400), William Allen Simpson wrote: ]
> Subject: Re: replacing sendmail with postfix (summary)
>
> > I believe you'll also need to add the following line to
> > /etc/postfix/main.cf (without leading whitespace of course):
> > 
> >         mydestination = $myhostname, localhost.$mydomain, localhost
> > 
> That is apparently the default, or something like it.

No, it's not -- which is why I mentioned it.  The default is only:

	mydestination = $myhostname, localhost.$mydomain

It may be equivalent given that if $mydomain is empty (e.g. not set in
/etc/postfix/main.cf and not set with domainname(1) -- yes, Postfix does
optionally use getdomainname(3) to get the default mail domain :-) and
$myhostname is not a fully qualified name then $mydomain becomes the
same as $myhostname:

	$ /usr/sbin/postconf myhostname               
	myhostname = sometimes
	$ /usr/sbin/postconf mydomain   
	mydomain = sometimes

This causes strange looking things in headers, but local delivery still
seems to work.


> > and most imporantly of all you also need to make sure that cron and
> > /etc/daily et al send their mail to "<root@localhost>", not just "root".
>
> Nope.  They all worked to root as-is just fine last night.

RWIS:  

    These final two changes will make local mail delivery from the cron
    scripts resilient to mis-configurations of the local hostname and/or
    domain name.

i.e. screw up your local hostname (e.g. make it a duplicate of some
other host with DNS that points at some other host) and then test again.
Consider all the weird possibilities that might occur when someone
ignorant of all these naming issues installs a system.  We really do
want all mail from the cron scripts (and anything similar) to always be
delivered locally regardless of how screwed up the hostname and/or
default domain name are.  The only way mail to "root" should be sent
off-system is if the admin explicilty aliases "root" to some off-system
address (which of course they really should do).

Since I sent my last reply though I've done further testing with Postfix
and in all the tests I've tried so far just plain "root" does still seem
to work fine with Postfix no matter how screwed up $myhostname and
$mydomain are, even with just the default $mydestination value (i.e. the
change to $mydestination I suggested above is not really necessary,
though it shouldn't do any harm).

I also know for certain that using just plain "root" will always work
fine with Smail's default out-of-the-box configuration.  :-)

However I won't make any bets a all about what sendmail will do, not
even if someone else covers my ante.  :-)

Ideally I agree it's best to avoid having to add "@localhost" to local
usernames just to send them local e-mail, but that is one possible way
to make sure a mailer that is overly paranoid about qualifying all
addresses and all domain names will know for certain that you mean the
"root" here on the local host and not some "<root@$mydomain>" when
$mydomain is screwed up and happens to point somewhere else.

-- 
								Greg A. Woods

+1 416 218-0098;            <g.a.woods@ieee.org>;           <woods@robohack.ca>
Planix, Inc. <woods@planix.com>; VE3TCP; Secrets of the Weird <woods@weird.com>