Building, Installing, and Configuring sendmail 8.8.x Mini HOWTO by John E. Gotts v1.0, November 22, 1997 Attached is a patch for Makefile.Linux that turns on TCP wrappers and makes a few other other harmless modifications. (With TCP wrappers enabled you can restrict remote access to your sendmail daemon according to the hosts_access(5) man page). (1) Assuming that you've saved it as sendmail.diff, apply it from the directory below sendmail-8.8.x with: patch -p0 < sendmail.diff Change into the src directory and execute ./makesendmail sendmail should build without any problems. Henceforth I'm going to assume that you just use TCP/IP electronic mail. UUCP support is beyond the scope of this document. Change into the cf/cf directory and create a new file, generic-linux2.mc: divert(-1) divert(0)dnl VERSIONID(`@(#)generic-linux2.mc 8.8 (Local) 11/22/97') OSTYPE(linux)dnl FEATURE(nouucp)dnl MAILER(local)dnl MAILER(smtp)dnl If you want to use masquerading, add the following two lines: MASQUERADE_AS()dnl EXPOSED_USER(root)dnl This means that all the e-mail that gets sent from your machine (except e-mail from root) will appear to have originated from the hostname that you specify. (This option is useful for people with intermittent network connections, i.e. users of SLIP and PPP, and for machines that have dynamically assigned IP addresses via BOOTP or DHCP). For sendmail versions 8.8.8 and newer, omit EXPOSED_USER(root) as it has become the default behavior. If you want to use procmail as your local mailer (standard practice with Red Hat Linux), add: FEATURE(local_procmail)dnl Transform "generic-linux2.mc" into a sendmail.cf file: m4 ../m4/cf.m4 generic-linux2.mc > obj/sendmail.cf You might need to comment out Cwlocalhost in obj/sendmail.cf with a # sign as it appears to disrupt incoming e-mail on newer Linux distributions. Back up your old /etc/sendmail.cf file and install obj/sendmail.cf: install -m 644 obj/sendmail.cf /etc/sendmail.cf After you've installed your new sendmail.cf, kill the sendmail daemon, change back into the src directory, and execute: cd obj.Linux.*.* ; make install This will install the sendmail binary and symbolic links. You'll need to install the manual pages by hand. If you haven't opted to use procmail, change into the main sendmail directory and type: uudecode contrib/mail.local.linux mv mail.local mail.local.old tar zxvf mail.local.linux.tar.Z cd mail.local gcc -O3 -o mail.local mail.local.c strip mail.local install -m 2711 -g mail mail.local /bin install -m 644 mail.local.8 /usr/man/man8 Your /var/spool/mail directory needs to be mode 775, owned by user root and group mail. Your mail clients need to be SGID mail (mode 2711 and owned by user root and group mail). Now you should be ready to restart your sendmail daemon. Mine is started like this: /usr/sbin/sendmail -bd -q1h NOTE: Red Hat 3.0.3 (and quite possibly 4.x) starts sendmail without its full path name. This can lead to problems such as preventing you from being able to HUP sendmail to cause it to reread its configuration file. To fix this, make sure /etc/rc.d/init.d/sendmail.init starts sendmail as /usr/sbin/sendmail (with the same arguments). If you have an intermittent connection, you might want to start sendmail in deferred mode: /usr/sbin/sendmail -bd -o DeliveryMode=d on boot and invoke sendmail as: /usr/sbin/sendmail -q to deliver all deferred e-mail when you first connect to the network and periodically while you are connected (perhaps as a cron job). At this point, you should test your new sendmail installation. Here's one way to do this: % telnet localhost smtp Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. 220 ESMTP Sendmail 8.8.8/8.8.8; Fri, 22 Nov 1997 03:21:18 -0500 helo localhost 250 Hello jgotts@localhost [127.0.0.1], pleased to meet you mail from: jgotts 250 jgotts... Sender ok rcpt to: jgotts 250 jgotts... Recipient ok data 354 Enter mail, end with "." on a line by itself This is a test. . 250 DAA23297 Message accepted for delivery Also, be sure to test that your e-mail clients still work and try sending a test message to your machine from an outside source to verify that incoming e-mail still works. Footnotes: (1) TCP wrapper support is broken in 8.8.8. For a patch see http://linuxsavvy.com/resources/linux/sendmail-8.8.8-tcp-wrappers-patch While you're at it, you might as well also apply: http://linuxsavvy.com/resources/linux/sendmail-8.8.8-core-dump-patch --- sendmail-8.8.8/src/Makefiles/Makefile.Linux.orig Sun Jul 6 14:22:57 1997 +++ sendmail-8.8.8/src/Makefiles/Makefile.Linux Sat Aug 9 03:46:24 1997 @@ -24,7 +24,7 @@ # # use O=-O (usual) or O=-g (debugging) -O= -O +O= -O3 # define the database mechanisms available for map & alias lookups: # -DNDBM -- use new DBM @@ -36,20 +36,20 @@ DBMDEF= -DNEWDB # environment definitions (e.g., -D_AIX3) -ENVDEF= +ENVDEF= -DTCPWRAPPERS # see also conf.h for additional compilation flags # include directories -INCDIRS=-I/usr/local/include +INCDIRS= # library directories -LIBDIRS=-L/usr/local/lib +LIBDIRS= # libraries required on your system # you may need to add -lresolv if you've installed BIND on # your system (see the BIND section for linux in src/READ_ME) -LIBS= -ldb +LIBS= -ldb -lwrap # location of sendmail binary (usually /usr/sbin or /usr/lib) BINDIR= ${DESTDIR}/usr/sbin @@ -80,8 +80,8 @@ ${DESTDIR}/usr/bin/hoststat ${DESTDIR}/usr/bin/purgestat INSTALL=install BINOWN= root -BINGRP= kmem -BINMODE=4555 +BINGRP= 0 +BINMODE=4711 ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0