Sendmail Configuration Files

The main sendmail configuration file is called sendmail.cf, and it's typically located in /etc/mail (both Red Hat and Slackware place the file in that directory). Unfortunately, this file is both very long (well over 1,000 lines for both Red Hat and Slackware) and difficult to understand. You should not attempt to edit this file directly; instead, you should edit a configuration file that can be used to generate a sendmail.effile. This source configuration file is written using the m4 macro processing language, which is more intelligible than the raw sendmail configuration file format. To edit and compile an m4 configuration file for sendmail, you might need to install additional packages:

The m4 Macro Language You must install the m4 macro language itself. This software usually comes in a package called m4. Look for a program file called m4 (often stored in /usr/bin) to ascertain whether or not it's already installed on your system. If it isn't, look for and install the package that came with your Linux distribution.

Sendmail m4 Configuration Files You need a set of m4 configuration files for sendmail in order to modify your configuration. These files are installed from the sendmail-cf package in both Red Hat and Slackware.

Both distributions ship with default m4 configuration files that can be used to rebuild the standard sendmail.effile that ships with the distribution. (In both cases, if you rebuild the default file, a few comments differ, but the rebuilt file is functionally identical to the original.) For Red Hat, the default file is /etc/mail/sendmail.mc. (This file actually ships with the sendmail package rather than sendmail-cf.) Slackware's default file is /usr/share/sendmail/cf/cf/linux.smtp.mc. To make changes to your configuration, follow these steps as root:

1. Back up your default /etc/mail/sendmail.cf file.

2. In a bash or other command shell, change to the directory in which the original m4 configuration file resides.

3. Copy the original file to a new name; for instance, you might call it myconfig.mc.

Warning Slackware's linux.smtp.mcfile uses a relative file reference

(../m4/cf.m4) in an include statement in the first line of the file. If you copy the file to another directory, you must change that line to refer to the file in another way, such as the absolute filename /usr/share/sendmail/cf/m4/cf.m4.

4. Edit the configuration file as described in the next few sections or to achieve other ends.

5. Type the following command to create a new /etc/mail/sendmail.cf file: # m4 < myconfig.mc > /etc/mail/sendmail.cf

If all goes well, the m4 command won't display any messages in your command shell, but if you check, you should find that the/etc/mail/sendmail.cf file is new. You can then tell sendmail to read the new configuration file:

#killall -HUP sendmail

This command tells all running sendmail instances to reread their configuration files and implement any changes. You can then test those changes in whatever way is appropriate—by sending or receiving mail and checking whether the changes you set are implemented.

In addition to the main sendmail.cf file, several other files are important in sendmail's configuration. Most of these files reside in /etc/mail, but some may reside in /etc. Two of the most important of these files are:

access.db This file, which usually resides in /etc/mail, controls access to the sendmail server. By listing or not listing particular systems in this file in specific ways, you can adjust which systems can use sendmail to relay mail to other systems. This file is a binary database built from the plain-text access file using the makemap program.

aliases.db Like access.db, this file is a binary database file built from a plain-text file (aliases) using newaliases. In Red Hat, this file appears in /etc, but in Slackware, it's stored in /etc/mail. This file lists aliases for particular usernames or addresses. For instance, if you set up an alias linking the name postmaster to root, all mail addressed to postmaster is delivered to root.

0 0

Post a comment