Subject: Re: replacing sendmail with postfix (summary)
To: NetBSD current list <current-users@netbsd.org>
From: Greg A. Woods <woods@weird.com>
List: current-users
Date: 07/04/2003 16:27:03
[ On Friday, July 4, 2003 at 14:40:27 (-0400), William Allen Simpson wrote: ]
> Subject: replacing sendmail with postfix (summary)
>
> (2) there is *no* consensus on the sendmail configuration for merely
>     sending daily/weekly root mail, without accepting incoming mail
>     (the default necessary to install).  

I wonder why this is so difficult to get right and get consensus on.

<user@localhost> (and <user@localhost.> if the recipient address is
entered on the command-line or in a header on stdin if '-t' is used)
should always be directed for immediate local delivery to /var/mail/user.

There's nothing magic here.  On all Internet capable (RFC 1123) systems
"localhost" is always another name for the local host and any mailer
worth its salt should trivially be able to accept mail to
<user@localhost> and deliver it locally without having to use SMTP or
DNS in any way shape or form whatsoever.

Smail, for example, only requires that the name "localhost" appear in
either $hostnames or $more_hostnames in order to function in this way.
The next release will actually provide this by default.  (It hasn't up
until now because most people don't send mail to <user@localhost> and
local user delivery to just "root" works automatically without first
having to qualify the domain -- the local domain is only appended to
addresses in headers afterwards in the final stages of local delivery.)

Smail, Exim, and Sendmail should all be able to do local delivery unless
something else is critically wrong in which case they each should still
accept a message on stdin from the command-line and store it in the
queue and hopefully write error messages to logs that the admin will
hopefully eventually see.

Postfix is a little more complex because IIRC it has to be running in
order to complete any local deliveries.


> (5) sendmail is better at managing large numbers of domains.

I think that claim is both completely bogus and _way_ off topic.

($mydestination can specify any number of flat files and "type:table"
maps as well as of course any number of plain domain names)


> (10) the change to use postfix without incoming mail is simple and 
>     straightforward (1 line).

Yes, postfix does similar things with $mydestination as Smail does,
though for the life of me I don't understand why the plain name
"localhost" doesn't appear in the examples or in the default setting in
/etc/postfix/main.cf.  "localhost" is after all a fully qualified domain
name (when the local DNS is set up correctly).

> Therefore, I conclude that postfix should be the DEFAULT mailer, but 
> not the only mailer.

I'm not sure that's ideal because of the problem postfix actually has to
be running to do local deliveries whereas the other more monolithic
mailers like sendmail, smail, and exim can do local delivery directly
with one process (that then starts mail.local, thus strictly it's two
concurrent processes I guess).

>  That requires only 3 file changes:
> 
>  * comment (add # next to) smtpd in /etc/postfix/master.cf
>  * swap the commented lines (sendmail to postfix) in /etc/mailer.conf
>  * have sysinst add "postfix=YES" to /etc/rc.conf

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

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".

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.

(and folks who want to send root's mail off-site or to some other local
mailbox, as they should still need only add the appropriate entry to
/etc/mail/aliases)

-- 
								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>