In Fedora, the sendmail distribution consists of three RPM packages: sendmail, sendmail-cf, and sendmail-doc. Only the first package is truly necessary to send and receive mail on your machine. The second package includes configuration macros and other files that can help you reconfigure your site’s sendmail installation if the defaults are insufficient. The third package contains documentation files that help to explain some of the details of the current version.
The sendmail binary packages are included in the Fedora distribution. The sendmail, sendmailcf, and sendmail-doc packages are on the Fedora Core 3 DVD that comes with this book. From the Fedora RPMS directory on the DVD, the following command installs the packages:
# rpm -Uhv sendmail*
Once installed, the sendmail service is turned on by default. To start sendmail immediately, you can either reboot the machine or just run service sendmail start to start the server. The procedure for starting and stopping sendmail is no different from that of any other server process.
The open-source version of sendmail is not the only mail server available for Fedora and other Red Hat Linux systems, but it is definitely the most common. The following list describes other servers and provides URLs for further information:
Postfix — Like Sendmail, the Postfix MTA is also included with Fedora. Written by Wietse Venema (of tcp_wrappers fame), this free mail server was designed with security in mind and executes most functions as an unprivileged user in a restricted chroot environment. The server encompasses more than a dozen small programs (each performing a simple, distinct task) and several single-purpose queues. You can find more information and source code at www.postfix.org.
Exim — The Exim MTA is a free mail server (under GPL) that runs on Linux and other UNIX systems. Exim was added to Fedora in Fedora Core 2. This MTA includes flexible features for checking and routing mail. Find out more about Exim from the Exim Home Page (www.exim.org).
Qmail — Also conceived with security as a high priority, this mail server (written by Daniel J. Bernstein) offers secure and reliable message transfer, mailbox quotas, virtual domains, and antispam features. More information is available from www.qmail.org/top.html.
Sendmail (commercial version) — Sendmail, Inc. (www.sendmail.com) offers products based on the same source code as open-source sendmail, aimed at enterprise e-mail installations. Products include Mailstream Manager (which includes support for enterprise-wide, high-volume mail service with anti-spam and anti-virus features), Mailcenter (offering IMAP/POP, Webmail and intelligent inboxes) and Workforce Mail (scalable, policy-based email service for the enterprise).
Smail — Smail offers many of the same features as sendmail but is somewhat easier to configure and requires less memory. Smail is most appropriate for small to medium size mail servers. The Smail project page is available at www.weird.com/~woods/projects/smail.html. The source code can be downloaded from ftp://ftp.planix.com/pub/Smail/.
By default, incoming messages received by sendmail are processed and stored in the /var/spool/mail directory. Each file in this directory represents a valid user name on the local machine. The file is created automatically when you add a user. People with login accounts use this directory and their user account name as their incoming mailboxes (for example, /var/spool/mail/johnq).
Outgoing messages go in the /var/spool/mqueue directory while waiting to be sent. Filenames in this directory follow a consistent naming scheme. The first two characters indicate what type of data is stored in the file (see Table 19-1). Subsequent characters form a unique random identifier based on the PID of the sendmail process that is handling that message.
Filename Prefix | Type of Data Stored |
---|---|
df | The data that constitutes the body of an e-mail message. |
qf | The queue control file that contains the message headers and other administrative details. |
tf | A temporary copy of the qf file, created if delivery errors occur. |
xf | Any error messages generated while trying to send the message. |
Several other executable programs are included in the distribution. These are described in Table 19-2.
Program | Description |
---|---|
mailq | Displays a summary of the messages awaiting processing in the mail queue (the command is equivalent to sendmail -bp). |
mailstats | Displays message quantity and byte count statistics. |
makemap | Translates text files (/etc/mail/virtusertable) to hashed Berkeley databases (/etc/mail/virtusertable.db). This command runs each time the sendmail script starts. |
newaliases | Translates the plain-text /etc/aliases file into the hashed Berkeley database file /etc/aliases.db (the command is equivalent to sendmail -bi). |
praliases | Prints out all aliases defined in /etc/aliases. |
procmail | Not included with the sendmail package, but is used as an MDA for sendmail. (It is included in Red Hat Linux in the procmail package.) |
purgestat | Clears the directory where host status information is stored. The command is equal to sendmail -bH, which is disabled by default |
rmail | Handles incoming mail via UUCP. |
smrsh | Implements a restricted shell for running programs from sendmail. |
The amount of logging performed by sendmail is configurable in the sendmail.mc file, but the default level provides good coverage of informational notices and error messages. By default, the syslog facility configuration file (/etc/syslog.conf) tells syslog to store logging information from sendmail in the /var/log/maillog file. A few examples from this file are shown in this section.
An informational message similar to the following is written in the /var/log/maillog file each time the daemon starts (which also causes the hashed alias database to be regenerated):
May 16 12:52:40 toys sendmail[1758]: alias database /etc/aliases rebuilt by root May 16 12:52:40 toys sendmail[1758]: /etc/aliases: 63 aliases, longest 10 bytes, 625 bytes total May 16 12:52:40 toys sendmail[1787]: starting daemon (8.12.8): SMTP+queueing@01:00:00
Each time a message is sent or received, a log file entry is created:
May 16 12:54:34 toys sendmail[1120]: OAA01120: from=root, size=161, class=0, pri=3 0161, nrcpts=1, msgid=<199907191254.OAA01120@toys.linuxtoys.net>, relay=root@localhost May 16 12:54:35 toys sendmail[1127]: OAA01120: to=jkpat, ctladdr=root (0/0), delay=00:00:01, xdelay=00:00:00, mailer=local, stat=Sent
Besides showing normal mail server activities, the logs also show when people attempt to break into your mail server. The wiz and debug commands were implemented in earlier versions of sendmail and were found to be a huge security problem. You may see log file entries, such as those shown in the following code examples, as people with malicious intent check to make sure that you’re not running a vulnerable sendmail daemon. Also, the expn and vrfy commands (which can be disabled via a configuration option) could give out more information than you’d care to distribute.
May 16 13:03:27 toys sendmail[699]: NOQUEUE: "wiz" command from localhost [127.0.0 .1] (127.0.0.1) May 16 13:03:29 toys sendmail[699]: NOQUEUE: "debug" command from localhost [127.0 .0.1] (127.0.0.1) May 16 13:03:37 toys sendmail[701]: NOQUEUE: localhost [127.0.0.1]: expn oracle May 16 13:03:43 toys sendmail[702]: NOQUEUE: localhost [127.0.0.1]: vrfy oracle