|
|
There are two basic steps to installing sendmail. First, you have to compile and install the binary. If sendmail has already been ported to your operating system that should be simple. Second, you must build a run-time configuration file. This is a file that sendmail reads when it starts up that describes the mailers it knows about, how to parse addresses, how to rewrite the message header, and the settings of various options. Although the configuration file can be quite complex, a configuration can usually be built using an M4-based configuration language. Assuming you have the standard sendmail distribution, see cf/README for further information.
The remainder of this section will describe the installation of sendmail assuming you can use one of the existing configurations and that the standard installation parameters are acceptable. All pathnames and examples are given from the root of the sendmail subtree, normally /usr/src/usr.sbin/sendmail on 4.4BSD-based systems.
Continue with the next section if you need/want to compile sendmail yourself. If you have a running binary already on your system, you should probably skip to section 1.2.
All sendmail source is in the sendmail subdirectory. To compile sendmail, cd into the sendmail directory and type
You can give parameters on the Build command. In most cases these are only used when the obj.* directory is first created. To restart from scratch, use -c. These commands include:
Most other parameters are passed to the make program; for details see $BUILDTOOLS/README.
(This section is not yet complete. For now, see the file devtools/README for details.) See sendmail/README for various compilation flags that can be set.
Not all configuration setting are critical to getting sendmail to run correctly. Note that "correctly" does not directly imply highest performance immediately.
Sendmail uses the functions strlcat(3) and strlcpy(3) which, at the time of writing, are not widely available. Further, for those systems where these functions are available they are new enough that performance tuning has not yet occurred. Sendmail includes in its sm library (aka libsm) these functions with an sm_ prefix. By default sendmail uses the libsm versions of these functions as performance tuning has occurred. A performance testing program libsm/b-strl.c can be used to evaluate which versions of the functions are faster: libsm or the system's libc. If you decide to use the libc versions then add
Sendmail supports two different formats for the local (on disk) version of databases, notably the aliases database. At least one of these should be defined if at all possible.
If neither of these are defined, sendmail reads the alias file into memory on every invocation. This can be slow and should be avoided. There are also several methods for remote database access:
Other compilation flags are set in conf.h and should be predefined for you unless you are porting to a new environment. For more options see sendmail/README.
After making the local system configuration described above, You should be able to compile and install the system. The script Build is the best approach on most systems:
If you are installing in the standard places, you should be able to install using
Sendmail cannot operate without a configuration file. The configuration defines the mail delivery mechanisms understood at this site, how to access them, how to forward email to remote mail systems, and a number of tuning parameters. This configuration file is detailed in the later portion of this document.
The sendmail configuration can be daunting at first. The world is complex, and the mail configuration reflects that. The distribution includes an m4-based configuration package that hides a lot of the complexity. See cf/README for details.
Our configuration files are processed by m4 to facilitate local customization; the directory cf of the sendmail distribution directory contains the source files. This directory contains several subdirectories:
If you are in a new domain (e.g., a company), you will probably want to create a cf/domain file for your domain. This consists primarily of relay definitions and features you want enabled site-wide: for example, Berkeley's domain definition defines relays for BitNET and UUCP. These are specific to Berkeley, and should be fully-qualified internet-style domain names. Please check to make certain they are reasonable for your domain.
Subdomains at Berkeley are also represented in the cf/domain directory. For example, the domain CS.Berkeley.EDU is the Computer Science subdomain, EECS.Berkeley.EDU is the Electrical Engineering and Computer Sciences subdomain, and S2K.Berkeley.EDU is the Sequoia 2000 subdomain. You will probably have to add an entry to this directory to be appropriate for your domain.
You will have to use or create .mc files in the cf/cf subdirectory for your hosts. This is detailed in the cf/README file.
This subsection describes the files that comprise the sendmail installation.
The binary for sendmail is located in /usr/sbin[3]. It should be set-group-ID smmsp as described in sendmail/SECURITY. For security reasons, /, /usr, and /usr/sbin should be owned by root, mode 755[4].
This is the main configuration file for sendmail [5]. This is one of the two non-library file names compiled into sendmail [6], the other is /etc/mail/submit.cf.
The configuration file is normally created using the distribution files described above. If you have a particularly unusual system configuration you may need to create a special version. The format of this file is detailed in later sections of this document.
This is the configuration file for sendmail when it is used for initial mail submission, in which case it is also called ``Mail Submission Program'' (MSP) in contrast to ``Mail Transfer Agent'' (MTA). Starting with version 8.12, sendmail uses one of two different configuration files based on its operation mode (or the new -A option). For initial mail submission, i.e., if one of the options -bm (default), -bs, or -t is specified, submit.cf is used (if available), for other operations sendmail.cf is used. Details can be found in sendmail/SECURITY. submit.cf is shipped with sendmail (in cf/cf/) and is installed by default. If changes to the configuration need to be made, start with cf/cf/submit.mc and follow the instruction in cf/README.
The newaliases command should just be a link to sendmail:
The hoststat command should just be a link to sendmail, in a fashion similar to newaliases. This command lists the status of the last mail transaction with all remote hosts. The -v flag will prevent the status display from being truncated. It functions only when the HostStatusDirectory option is set.
This command is also a link to sendmail. It flushes expired (Timeout.hoststatus) information that is stored in the HostStatusDirectory tree.
The directory /var/spool/mqueue should be created to hold the mail queue. This directory should be mode 700 and owned by root.
The actual path of this directory is defined by the QueueDirectory option of the sendmail.cf file. To use multiple queues, supply a value ending with an asterisk. For example, /var/spool/mqueue/qd* will use all of the directories or symbolic links to directories beginning with `qd' in /var/spool/mqueue as queue directories. Do not change the queue directory structure while sendmail is running.
If these directories have subdirectories or symbolic links to directories named `qf', `df', and `xf', then these will be used for the different queue file types. That is, the data files are stored in the `df' subdirectory, the transcript files are stored in the `xf' subdirectory, and all others are stored in the `qf' subdirectory.
If shared memory support is compiled in, sendmail stores the available diskspace in a shared memory segment to make the values readily available to all children without incurring system overhead. In this case, only the daemon updates the data; i.e., the sendmail daemon creates the shared memory segment and deletes it if it is terminated. To use this, sendmail must have been compiled with support for shared memory (-DSM_CONF_SHM) and the option SharedMemoryKey must be set. Notice: do not use the same key for sendmail invocations with different queue directories or different queue group declarations.
The directory /var/spool/clientmqueue should be created to hold the mail queue. This directory should be mode 770 and owned by user smmsp, group smmsp.
The actual path of this directory is defined by the QueueDirectory option of the submit.cf file.
This is a typical value for the HostStatusDirectory option, containing one file per host that this sendmail has chatted with recently. It is normally a subdirectory of mqueue.
The system aliases are held in /etc/mail/aliases. A sample is given in sendmail/aliases which includes some aliases which must be defined:
Normally sendmail looks at a database version of the files, stored either in /etc/mail/aliases.dir and /etc/mail/aliases.pag or /etc/mail/aliases.db depending on which database package you are using. The actual path of this file is defined in the AliasFile option of the sendmail.cf file.
It will be necessary to start up the sendmail daemon when your system reboots. This daemon performs two functions: it listens on the SMTP socket for connections (to receive mail from a remote system) and it processes the queue periodically to insure that mail gets delivered when hosts come up.
If necessary, add the following lines to /etc/rc (or /etc/rc.local as appropriate) in the area where it is starting up the daemons on a BSD-base system, or on a System-V-based system in one of the startup files, typically /etc/init.d/sendmail:
Some people use a more complex startup script, removing zero length qf files and df files for which there is no qf file. For example, see Figure 1 for an example of a complex script which does this clean up.
This is the help file used by the SMTP HELP command. It should be copied from sendmail/helpfile:
If you wish to collect statistics about your mail traffic, you should create the file /etc/mail/statistics:
If sendmail is invoked as mailq, it will simulate the -bp flag (i.e., sendmail will print the contents of the mail queue; see below). This should be a link to /usr/sbin/sendmail.