UCB Sendmail

$Id: ucb-sendmail.html,v 1.6 1998/02/03 20:48:44 cshenton Exp $

I am suspicious of vendor's sendmails, so I replace them with UCB Sendmail: it's been scrutinized and the source is free to examine. Building it isn't hard, and creating the configuration file is pretty easy now, too. The following are some tips that may speed up your compilation and installation.


Get the sources from ftp://ftp.cs.berkeley.edu/pub/sendmail/. The latest version at this writing is sendmail.8.7, but you should get the latest.

Previously, with versions 8.6.12 and earlier, you needed a couple a couple of tar files, for .base (source) and .cf (configuration); other tarballs were .xdoc and .misc, but they weren't needed for the build. As of 8.7, they've all been rolled into one larger file.

Be careful unpacking it! For some lame reason, version 8.6 base and cf files don't extract into their own sendmail sub-directories. Create one, like /usr/local/src/sendmail-8.6.11, move the tarballs there, then extract them. This appears to have been fixed in 8.7.

Building sendmail

Sendmail builds easily, assuming there's a Makefile for your machine, and chances are good since there are something like 50 different Makefiles. The README goes on about UCB's new make, and how the standard Makefile won't work with old versions of make (meaning yours) and so on. Just use something like the following:

For SGI on version 8.6.12:

cd /usr/local/src/sendmail-8.6.12/src/
make -k -f Makefile.IRIX

For sendmail-8.7, they've moved the Makefiles and added some new architecture-specific ones, so something like the following should be used:

cd /usr/local/src/sendmail-8.7/src/
make -k -f Makefiles/Makefile.IRIX.5.x

For SunOS and 8.6.12, I turn off NIS and UCB's NEWDBM with make flags:

cd /usr/local/src/sendmail-8.6.12/src/
make -k -f Makefile.SunOS DBMDEF='-DNDBM' LIBS='-ldbm -lresolv'

Again, for 8.7, you'll need to change the path of the Makefile. Note that Makefile.SunOS is for SunOS-4.1, and that there's also a Makefile.SunOS.4.0. It appears that the definitions needed before are not needed any longer with the new architecture-specific Makefiles. You should be able to get away with something like:

cd /usr/local/src/sendmail-8.7/src/
make -k -f Makefiles/Makefile.SunOS
There are of course Makefiles for Slowaris (aka: SunOS-5.*) and many other platforms including FreeBSD and Linux.

You can use the normal make install (again specifying the appropriate Makefile and flags), but take a look at the section below on Installation first.

Note that make install doesn't install the man pages; I do this by hand. :-( I think that you may need some hairly mandoc troff macro file from UCB, but I've mangled my system so much by now with GNU groff and such that I can't remember. Caveat Emptor.


Building and tuning a sendmail.cf used to be a nightmare. Now it's pretty easy, especially after you've done it a few times. They've used lots of macro processing and decent templates so all you have to do is specify the types of features you want.

The cf directory contains the macro subdirs, while the cf/cf directory will contain the file you need to configure. Create a file which will specify the configuration appropriate to your machine; it's an .mc file. I like to use something which specifies the OS and the site, perhaps irix-hq.nasa.gov.mc.

There's help in one of the upper directories, but to cut to the chase, here's mine:

# [comments elided; snarf them from another .mc file.]
The divert and include are necessary mechanics. The rest is pretty obvious. The FEATURE(use_cw_file) is something we need here to handle MX records. It allows us to have a sendmail.cw file with aliases for our MX destination machine naming all the MX clients. If you don't need this, leave it out.

Our site uses a central mailhost with with DNS MX records for all the clients pointing to it. The clients all forward their mail directly to the mailhost as "nullclient"s. The mailhost should be paranoid and not answer queries from nosy hacker d00dz. Here's a sample file:

VERSIONID(`@(#)generic-irix6.mc	8.3 (Berkeley) 3/23/96')
# Send all mail directly to our mailhost for processing.
# It must masquerade as "it.hq.nasa.gov".
FEATURE(nullclient, gratia.it.hq.nasa.gov)
# NullClients shouldn't be running daemons so this paranoia isn't really
# necessary, but just in case... Also, this *does* need to be enabled on
# the mailhost, gratia.
define(`confPRIVACY_FLAGS', ``goaway,novrfy,noexpn'')

I copy the Makefile.dist to Makefile then modify so that it only builds the one target in which I'm interested. Here's the one line I replace:

ALL=	irix-hq.nasa.gov.cf
Then do the make thing and it should build your .cf file. You'll have to install it yourself. See the next section for caveats on installation location.


Some systems want sendmail in /usr/lib, and some in /etc. Same for the sendmail.cf file, and it may not even be the same directory. My recommendation: check how your vendor does it and do it their way. I've found that lots of start-up scripts depend on files being in vendor-standard places and if you move them, you may not boot cleanly or your sendmail may not start.

The UCB binary and configuration files may want to install themselves some places other than where the vendor puts theirs; they certainly do for IRIX. If so, I override the built-in installation and install where the vendor put theirs, then create symlinks from where UCB expects sendmail.cf to the actual file. You could do the opposite I suppose.

Because I'm paranoid, before I install the binary and config files, I rename the old binary to something obvious like /usr/lib/sendmail.IRIX-5.3, and the same for the configuration file. This way I can always go back if there is a problem with UCB sendmail.

Chris Shenton