Setting Up Sendmail


October 14, 2003
The dummy certificate that I generate to use with the imap server is only good for one year. After that, a new certificate must be generated. The certificate is /usr/share/ssl/certs/stunnel.pem. As root, delete this file and then run (in /usr/share/ssl/certs) make stunnel.pem. You should use the following information:

C = US
ST = Illinois
L = Chicago
O = The University of Chicago
OU = Electronics Design Group
CN = edg.uchicago.edu

Then, make sure that all the users delete the old certificate and accept the new one. In Mozilla, this is done by going to Edit-Preferences--Privacy and Security--Certificates--Manage Certificates--Authorities and highlighting edg.uchicago.edu under The University of Chicago and deleting it. Then, the next time the user tries to imap her mail, she should accept the new certificate permanently.


So what version of sendmail is running? To find out, telnet sendmail 25.


April 3, 2003
Directions below are ok. Remember that the sh Build -I ... line is for compilinig sendmail on the HP machines. To compile on Linux, just run sh Build.


Before getting to sendmail, the Berkeley DB needs to be setup. This is an embedded database system that supports keyed access to data. It can be compiled and linked into a single library for inclusion directly in their applications. I don't know what this means, but that's the description I got.

I downloaded db-4.00.tar.gz from www.sleepycat.com and unzipped and untarred it. Changing to the build_unix directory, run:
../dist/configure
make
(as root)
make install
The default installation directory is /usr/local/BerkeleyDB.4.0, which is fine.

chmod 555 /usr/local/BerkeleyDB.4.0/include/*
chmod 555 /usr/local/BerkeleyDB.4.0/lib/*


March 3, 2003

Remember to reset the PATH to avoid the Mentor tools because it uses a bad gcc, that won't work here

Installing version 8.12.8. Unzipped to ~/sendmail-8.12.8 and ran:

sh Build -I/users/maryh/sendmail-8.12.8/include -L/users/maryh/sendmail-8.12.8/libsm

Got an error message about missing db.h, so I created links from everything in /usr/local/ BerkeleyDB.4.0/include and lib to /usr/include and /usr/lib, respectively. Then, reran above command.

Followed directions below for copying files to the correct location. When I attempted to start sendmail, I got errors about libdb.a missing. Since these are in /usr/local/BerkeleyDB.4.0/lib on the HP machines, I made links from libdb.a and libdb.sl to /usr/lib. I also had to create the file /etc/mail/local-host-names. That's it.


October 7, 2002

Dowload the latest sendmail from www.sendmail.org
Unzip and untar it
I unpacked it to /system/src, so to build it, run (from the /system/src/sendmail-8.12.6 directory):

sh Build -I/system/src/sendmail-8.12.6/include -L/system/src/sendmail-8.12.6/libsm

This runs for a while.

When finished, edit /system/src/sendmail-8.12.6/cf/cf/generic-linux.mc to the following and save it as mentor.mc:

divert(0)dnl
VERSIONID(`$Id: mentor.mc,v 8.1 2002/10/07 22:48:05 mheintz Exp $')
OSTYPE(`linux')dnl
MASQUERADE_AS(`frodo.uchicago.edu')dnl
FEATURE(`access_db')dnl
FEATURE(`smrsh')dnl
FEATURE(`use_cw_file')dnl
define(`confMIN_FREE_BLOCKS',`10000')dnl
define(`confTO_QUEUERETURN', `2d')dnl
define(`confTO_QUEUEWARN', `1h')dnl
define(`confDEF_USER_ID', `sendmail:daemon')dnl
define(`confQUEUE_LA', `10')dnl
define(`confREFUSE_LA', `15')dnl
define(`confMAX_QUEUE_RUN_SIZE', `1000')dnl
define(`STATUS_FILE', `/etc/mail/statistics')dnl
MAILER(`local')dnl
MAILER(`smtp')dnl

From /system/src/sendmail-8.12.6/cf/cf, run:

m4 ../m4/cf.m4 mentor.mc > sendmail.cf_8.12.6
cp mentor.mc /etc/mail
cp sendmail.cf_8.12.6 /etc/mail

Go to the /system/src/sendmail-8.12.6/obj.Linux.2.4.7-10.i686 directory and run the following:
cp makemap/makemap /etc/mail
cp makemap/makemap /usr/sbin
cp mailstats/mailstats /etc/mail
cp smrsh/smrsh /etc/mail
cp vacation/vacation /etc/mail
cp sendmail/sendmail /usr/sbin/sendmail

In /etc/mail, copy any files named with a version number to the same name without the version number.

cp sendmail.cf_8.12.6 sendmail.cf

Run /etc/mail/access_update (copy it from another machine if it's not there) to set up the database.

Should have created user smmsp (uid 25) and group smmsp (gid 25). Make sure the following permissions are set:

-r-xr-sr-x root smmsp /usr/sbin/sendmail
drwxrwx--- smmsp smmsp /var/spool/clientmqueue
drwx------ root wheel /var/spool/mqueue
-r--r--r-- root wheel /etc/mail/sendmail.cf
-r--r--r-- root wheel /etc/mail/submit.cf

Note on .forward files. If you want to use .forward files, you need to make sure that it is in a location that is not group writeable. For example, if a user's home directory is /home/shop/foo, make sure that there are no group writeable permissions on /home, /home/shop or /home/shop/foo. If any of these are group writeable, forwarding won't work.


2000 Directions

Next, unzip and untar sendmail. Edit the devtools/OS/ file to take into account the BerkeleyDB that was just installed. On HP systems, the file is devtools/OS/HP-UX. The Linux file in devtools/OS/Linux. The line to change (for HP) is :

define(`confMAPDEF',`-DNDBM -DNIS -DMAP_REGEX') -- Original Line

define(`confMAPDEF',`-DNEWDB -DMAP_REGEX') -- Changed Line

For Linux, you don't need to add anything.

Change back to the main sendmail directory and run
sh Build -I/usr/local/BerkeleyDB.4.0/include -L/usr/local/BerkeleyDB.4.0/lib -c

This will run for awhile.

Now you need to set up any local configurations. In the cf/cf directory, copy the generic-.mc file to .mc. For example, cp generic-linux.mc shop3.mc. Edit this file according to our specifications. Our shop3.mc file ends up looking like this:

divert(0)dnl
VERSIONID(`$Id: generic-linux.mc,v 8.1 1999/09/24 22:48:05 gshapiro Exp $')
OSTYPE(linux)dnl
MASQUERADE_AS(frodo.uchicago.edu)dnl
FEATURE(access_db)dnl
FEATURE(smrsh)dnl
define(`confMIN_FREE_BLOCKS', `10000')dnl
define(`confTO_QUEUERETURN', `2d')dnl
define(`confTO_QUEUEWARN', `1h')dnl
define(`confDEF_USER_ID', `sendmail:daemon')dnl
define(`confQUEUE_LA', `10')dnl
define(`confREFUSE_LA', `15')dnl
MAILER(local)dnl
MAILER(smtp)dnl

These files are the same on all machines, except for frodo. On frodo, the line MAILER(pop)dnl is added at the end because frodo is our pop mailer.

Staying in the cf/cf directory, run m4 ../m4/cf.m4 shop3.mc > sendmail.cf_8.11.0 Then copy both shop3.mc and sendmail.cf_8.11.0 to /etc/mail. Next, from the main sendmail directory, copy obj.Linux.2.2.12-20.i586/makemap/makemap to /etc/mail and /usr/sbin. Copy sendmail/helpfile to /etc/mail/helpfile_8.11.0. Next, in the obj.Linux.2.2.12-20 directory, copy mailstats/mailstats, smrsh/smrsh and vacation/vacation to /etc/mail. Move to /etc/mail and create the files relay-domains, access and aliases. Also, copy access_README and access_update from frodo, so these files will be consistent across all machines. Copy sendmail.cf_8.11.0 to sendmail.cf and do the same with all other files that you copied and named _8.11.0. Finally, create a user sendmail, which will be the user that sendmail runs under.

Change the permissions on the following directories to 755 (go-w), that is take away write permissions for group and others on / /etc /etc/mail /usr /var /var/spool /var/spool/mqueue. Next, make sure that the owner of these same directories is root. If you get an error message after everything is set up, permissions on these directories is usually the problem.

You are now ready to change the actual sendmail program. Go to the main sendmail directory and change to obj.Linux.2.2.12-20.i586/sendmail. Copy the file sendmail to /usr/sbin/sendmail_VERSION. Then in /usr/sbin, copy the current sendmail to sendmail_VERSION. You don't want to delete this version until you are sure that the new one runs. Now stop the sendmail program from running. On HP, /sbin/init.d/sendmail stop. On Linux, /etc/rc.d/init.d/sendmail stop. Copy /usr/sbin/sendmail_NEWVERSION to /usr/sbin/sendmail. Restart sendmail by substituting start for stop in the earlier command.

List of files to copy (from the sendmail directory):
cp cf/cf/frodo.mc /etc/mail/frodo.mc_8.12.5
cp cf/cf/sendmail.cf_8.12.5 /etc/mail
cp obj.HP-UX.10.20.9000-780/makemap/makemap /etc/mail/makemap_8.12.5
cp obj.HP-UX.10.20.9000-780/makemap/makemap /usr/sbin/makemap_8.12.5
cp obj.HP-UX.10.20.9000-780/mailstats/mailstats /etc/mail/mailstats_8.12.5
cp obj.HP-UX.10.20.9000-780/smrsh/smrsh /etc/mail/smrsh_8.12.5
cp obj.HP-UX.10.20.9000-780/vacation/vacation /etc/mail/vacation_8.12.5
cp obj.HP-UX.10.20.9000-780/sendmail/sendmail /usr/sbin/sendmail_8.12.5

Stop sendmail with:
/sbin/init.d/sendmail stop

Rename all the files:
cp /etc/mail/sendmail.cf_8.12.5 /etc/mail/sendmail.cf
cp /etc/mail/makemap_8.12.5 /etc/mail/makemap
cp /etc/mail/mailstats_8.12.5 /etc/mail/mailstats
cp /etc/mail/smrsh_8.12.5 /etc/mail/smrsh
cp /etc/mail/vacation_8.12.5 /etc/mail/vacation
cp /usr/sbin/makemap_8.12.5 /usr/sbin/makemap
cp /usr/sbin/sendmail_8.12.5 /usr/sbin/sendmail

Update the access database with:
/usr/sbin/makemap hash /etc/mail/access < /etc/mail/access

Start new sendmail with:
/sbin/init.d/sendmail start