Installing and Running sendmail


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, sendmail-cf, and sendmail-doc packages are on the Fedora Core 6 DVD that comes with this book. From the Fedora RPMS directory on the DVD, the following command installs the packages:

 #  rpm -Uhv sendmail*  

Because sendmail is a common target of intruders, it's a good idea to get immediately any updates that are available for sendmail before proceeding. You can do that using the yum command or the Package Updater window. To update sendmail using yum , type:

 #  yum update sendmail  

Starting 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 similar to that of any other server process.

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 the first time e-mail is sent to the user (or if it's otherwise missing). 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.

Table 19-1: File Prefixes in /var/spool/mqueue
Open table as spreadsheet

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.

Other Programs

Several other executable programs are included in the distribution. These are described in Table 19-2.

Table 19-2: Other Related Sendmail Programs
Open table as spreadsheet

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 Fedora and RHEL 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.

Logging Performed by 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 



Fedora 6 and Red Hat Enterprise Linux Bible
Fedora 6 and Red Hat Enterprise Linux Bible
ISBN: 047008278X
EAN: 2147483647
Year: 2007
Pages: 279

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net