Installing and Running sendmail in Red Hat Linux

|

The full 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 Red Hat distribution. The sendmail package is on CD #1, while the sendmail-cf package is on CD #2, and the sendmail-doc package is on CD #3. From the Red Hat RPMS directory on each CD-ROM, the following command installs the packages:

# rpm -ivv 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 /etc/init.d/sendmail start to start the server. The procedure for starting and stopping sendmail is no different from that of other server processes.


Other Mail Servers Available for Red Hat Linux
The open-source version of sendmail is not the only mail server available for Red Hat Linux, but it is definitely the most common. Other servers are described in the following list, with URLs that provide further information.

Postfix — The Postfix MTA is the only mail-server software besides Sendmail that comes with Red Hat Linux. 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. Information and source code can be found at www.postfix.org.

Exim — The Exim MTA is a free mail server (under GNU) that runs on Linux and other UNIX systems. This MTA includes enhanced protection against unsolicited junk mail and mail bombs. 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) — Based on the same source code as open-source sendmail, this product is distributed as binary executables built specifically for Red Hat Linux (among other Linux and UNIX variants). Pricing for the Sendmail Advanced Message Server is based on the number of mailboxes you are serving. The product offers simple installation, Web-based management, and support. Details can be found at www.sendmail.com.


Smail — Smail offers many of the same features as sendmail but is somewhat easier to configure and requires less memory. The source code can be downloaded from ftp://ftp.planix.com/pub/Smail/.


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 /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. Subsequent characters form a unique random identifier based on the PID of the sendmail process that is handling that message.

File Prefixes in /var/spool/mqueue

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.

Other Related Sendmail Programs

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 at boot time.

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.



Logging performed by sendmail
The amount of logging performed by sendmail is configurable in the sendmail.cf file, but the default level provides good coverage of informational notices and error messages. By default, the syslog facility (/etc/syslog.conf file) stores logging information from sendmail in the /var/log/maillog file.

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):

Feb 16 12:52:40 toys sendmail[1758]: alias database /etc/aliases
rebuilt by root
Feb 16 12:52:40 toys sendmail[1758]: /etc/aliases: 63 aliases, longest
10 bytes, 625 bytes total
Feb 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:

Feb 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
Feb 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

The logs even show when people attempt things that perhaps they shouldn't try. The wiz and debug commands were implemented in earlier versions of sendmail and were found to be a huge security problem. You may log file entries, such as those shown in the code examples below, 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.

Feb 16 13:03:27 toys sendmail[699]: NOQUEUE: "wiz" command from localhost
[127.0.0 .1] (127.0.0.1)
Feb 16 13:03:29 toys sendmail[699]: NOQUEUE: "debug" command from
localhost [127.0 .0.1] (127.0.0.1)
Feb 16 13:03:37 toys sendmail[701]: NOQUEUE: localhost [127.0.0.1]:
expn oracle
Feb 16 13:03:43 toys sendmail[702]: NOQUEUE: localhost [127.0.0.1]:
vrfy oracle


>>> Read more about What is Red Hat Linux SMTP and sendmail <<<

Source of Information : Red Hat Linux Bible: Fedora and Enterprise Edition

0 comments:

Subscribe to Computing Tech

Enter your email address:

Delivered by FeedBurner

Add to Technorati Favorites Top Blogs