the djb way

qmail


sendmail configuration

What's this? Why are we talking about sendmail configuration on a qmail server?

The fact is, sendmail has a long-lived historical presence on Unix and Unix-like systems. Most freely available Unix-like systems today --meaning many Linux distributions and the BSDs-- still ship with sendmail installed as the default mail transport agent.

Installing qmail on such a system won't be completely right until we take care of a few details:

These tasks are platform-specific. For example, the BSDs have a mail-wrapper utility that makes it easy to configure qmail as a sendmail replacement. On the other hand, Slackware Linux requires a bit more manual intervention, and each Linux distro may go about it in yet another way.

We will describe sendmail configuration/replacement for these platforms:

If these don't match your system exactly, you should be able to generalize from the following to figure out what to do for your own platform.

FreeBSD

First, to disable sendmail on boot, edit the run-control configuration file, /etc/rc.conf. Make an entry that reads:

sendmail_enable="NONE"

The keyword here is NONE. Make sure there are no other sendmail_enable entries in the file, then save the changes. When you reboot the system, sendmail will not be started.

The next step is to configure mailwrapper(8). Edit the file /etc/mail/mailer.conf to look like this:


# /etc/mail/mailer.conf
# freebsd mailwrapper configuration, for qmail
# ===
sendmail    /var/qmail/bin/sendmail
send-mail   /var/qmail/bin/sendmail
mailq       /var/qmail/bin/qmail-qread
newaliases  /var/qmail/bin/newaliases

### that's all, folks!

This maps the appropriate qmail executables to their sendmail aliases. That's it for FreeBSD.

NetBSD

First, disable sendmail on boot. Edit the run-control configuration file, /etc/rc.conf, and make an entry that reads:

sendmail=NO

Save the changes. Now when you reboot the system, sendmail will not be started.

The next step is to configure mailwrapper(8). Edit the file /etc/mailer.conf to look like this:


# /etc/mail/mailer.conf
# netbsd mailwrapper configuration, for qmail
# ===
sendmail    /var/qmail/bin/sendmail
send-mail   /var/qmail/bin/sendmail
mailq       /var/qmail/bin/qmail-qread
newaliases  /var/qmail/bin/newaliases

### that's all, folks!

This maps the appropriate qmail executables to their sendmail aliases. That's it for NetBSD.

OpenBSD

First, edit the master run-control configuration file /etc/rc.conf. Find the line that looks something like this:

sendmail_flags="-L sm-mta -C/etc/mail/localhost.cf -bd -q30m"

Comment out that line, and add the following:

## running qmail at this site:
##sendmail_flags="-L sm-mta -C/etc/mail/localhost.cf -bd -q30m"
sendmail_flags=NO

The keyword here is NO. Now when you reboot your system, sendmail will not be started.

The next step is to configure mailwrapper(8). Its configuration file is located in /etc/mailer.conf, and should be edited to look like this:


# /etc/mailer.conf
# openbsd mailwrapper configuration, for qmail
# ===
sendmail    /var/qmail/bin/sendmail
send-mail   /var/qmail/bin/sendmail
mailq       /var/qmail/bin/qmail-qread
newaliases  /var/qmail/bin/newaliases

### that's all, folks!

Now mailwrapper will map qmail executables to their sendmail aliases.

The last step on OpenBSD is to edit the crontab file for user "root". Use crontab -e, and comment out the "sendmail clientmqueue runner" entry:


#	$OpenBSD: crontab,v 1.12 2003/03/10 01:05:28 deraadt Exp $
#
# /var/cron/tabs/root - root's crontab
#
SHELL=/bin/sh
PATH=/bin:/sbin:/usr/bin:/usr/sbin
HOME=/var/log
#
#minute	hour	mday	month	wday	command
#
# sendmail clientmqueue runner
### omit: qmail used at this site
###*/30	*	*	*	*	/usr/sbin/sendmail -L sm-msp-queue -Ac -q
#
...

That's it, OpenBSD is now configured for qmail.

Linux (Slackware)

Slackware may be an atypical example for Linux, since it boots with BSD-style init scripts, rather than System V. (That's one reason why we have always liked Slackware...)

The distribution doesn't include any mailwrapper utility, though, as found in the BSDs. So, configuring sendmail compatibility is more of a manual mv, chmod, and ln sort of affair.

First, to disable sendmail on system boot, clear the execute bits on the rc.sendmail run-control script:

# chmod -x /etc/rc.d/rc.sendmail

Now when you reboot your system, sendmail will not be started.

Next, hunt down the sendmail executable and all symlinks, and mv them out of the way (on Slack, the "real" sendmail binary is in /usr/sbin/sendmail):

# mv /usr/sbin/sendmail /usr/sbin/sendmail.orig
# chmod -x /usr/sbin/sendmail.orig
# mv /usr/lib/sendmail /usr/lib/sendmail.orig
# mv /usr/bin/sendmail /usr/bin/sendmail.orig
# mv /usr/bin/mailq /usr/bin/mailq.orig
# mv /usr/bin/newaliases /usr/bin/newaliases.orig

The symlinks we mv in /usr/bin are saved only as a reminder of the original installation; otherwise, just go ahead and rm them instead. Then, make the new symlinks for qmail:

# ln -fs /var/qmail/bin/sendmail /usr/sbin/sendmail
# ln -fs /var/qmail/bin/sendmail /usr/bin/sendmail
# ln -fs /var/qmail/bin/qmail-qread /usr/bin/mailq

After installing fastforward, add a symlink for it also:

# ln -fs /var/qmail/bin/newaliases /usr/bin/newaliases

That's it, Slack is now converted to qmail!


Copyright © 2004, Wayne Marshall.
All rights reserved.

Last edit 2005.02.22, wcm.