Local Code

There are several m4 macros that allow you to directly modify the sendmail.cf file with unadulterated sendmail.cf configuration commands. These macros are placed at the beginning of a block of sendmail.cf code, and they tell m4 where to put that code in the output file. These macros are as follows:

LOCAL_RULE LOCAL_RULE_n heads a section of code to be added to ruleset n, where n is 0, 1, 2, or 3. The code that follows the LOCAL_RULE command is sendmail.cf rewrite rules.

LOCAL_CONFIG LOCAL_CONFIG heads a section of code to be added to the sendmail.cf file after the local information section and before the rewrite rules. The section of code contains standard sendmail.cf configuration commands.

LOCAL_RULESETS This macro heads a section of code that contains a complete ruleset that is to be added to the sendmail.cf file. Generally, these are named as opposed to numbered rulesets.

LOCAL_NET_CONFIG This macro heads a section of sendmail.cf rewrite rules that defines how mail addressed to systems on the local network is handled.

MAILER_DEFINITIONS This macro is placed before a sendmail.cf M command, which is a mailer definition.


The DAEMON_OPTIONS macro defines parameters for the sendmail daemon. When sendmail accepts mail from a local e-mail program, it is acting as a Mail Submission Agent (MSA). When it transfers that mail to a remote server, it is acting as a Mail Transfer Agent (MTA). The DAEMON_OPTIONS macro sets options for both of sendmail's "personalities."

Two DAEMON_OPTIONS commands are needed to set the parameters for both the MTA and the MSA. The sendmail configuration defaults to the following values:

DAEMON_OPTIONS(~Port=25, Name=MTA') DAEMON_OPTIONS(~Port=587, Name=MSA, M=E')

These two lines assign the standard ports to the MTA and the MSA, and a modifier to the MSA. Use the no_default_msa feature to clear the MSA defaults before you set new MSA values with the DAEMON_OPTIONS macro. And then use two DAEMON_OPTIONS commands: the first one for the MTA and the second one for the MSA.

DAEMON_OPTIONS parameters are assigned using keyword=value pairs. The possible keywords and values are:

Port The Port keyword assigns a network port number to the daemon. The standard port for an MTA is 25, and the standard port for an MSA is 587. Changing these standard ports means that clients will have difficulty locating the service. The port numbers are therefore rarely changed.

Name The Name keyword identifies the aspect of the sendmail daemon for which the parameters are being set. There are four documented values:

MTA This identifies the traditional Mail Transport Agent interface of sendmail that is used to deliver mail.

MSA This identifies the Mail Submission Agent interface of sendmail that can be used by external MUAs to submit mail. In practice, this function is identical to the MTA function, except for port number, because both aspects of sendmail ensure that all mail, no matter how it arrives, is processed through all necessary rulesets, filters, and databases.

MTA-v4 This is the same as the MTA interface, and is designed to handle e-mail delivery to hosts with standard 32-bit IPv4 addresses.

MTA-v6 MTA-v6 is an interface designed to handle delivery to hosts that use the 128-bit IPv6 addresses.

Family The Family keyword defines the address family. By default, this is inet, which means that standard IPv4 addresses should be used. An alternate value is inet6, which requests IPv6 addressing.

M The M keyword is a modifier that requests optional processing. M=E turns off the ESMTP ETRN command. This setting is the default for the MSA because it is required by the MSA standard. The M=a setting requires authentication by a trusted authentication method before the MSA will accept the mail message.

LDAP Mail Routing

In addition to the various databases built into sendmail, a Lightweight Directory Access Protocol (LDAP) server can be used with sendmail. If your site uses LDAP for other purposes, you may find some benefit in using it with sendmail. LDAP support is added to sendmail using the following defines, features, and macros:

define(confLDAP_DEFAULT_SPEC', ldap-arguments') Sets arguments that are required for the LDAP map definition. At a minimum, the name of the LDAP server (-h server) and the base distinctive name (-b o=org,c=country) must be provided. For example:

define(~confLDAP_DEFAULT_SPEC', egret.foobirds.org -b o=foobirds.org,c=us')

FEATURE(ldap_routing') Adds the necessary support for LDAP routing to the configuration.

LDAPROUTE_DOMAIN(domainname) Adds a domain to the class {LDAPRoute}. Mail routing information for domains in that class is looked up via the LDAP server.

LDAPROUTE_DOMAIN_FILE(//7ename) Identifies the file from which the {LDAPRoute} class is loaded. The file contains a list of the domains for which mail routing information should be obtained from the LDAP server.

This concludes the discussion of m4 macros. The output of all of the files and commands that go into the m4 processor is a sendmail.cf file. The bulk of information about sendmail configuration is found in Chapter 5.

Was this article helpful?

0 0

Post a comment