home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


sendmail

sendmailSearch this book
Previous: 19.2 Build with m4 Chapter 19
V8 m4 Configuration
Next: 19.4 m4 Macros by Function
 

19.3 The Minimal mc File

Every mc file requires minimal information. Table 19.2 shows which m4 items are required and also lists two that are recommended.

Table 19.2: Required and Recommended m4 Items
Item Description
OSTYPE() Section 19.3.1 Required Support for your operating system
MAILER() Section 19.3.2 Required Necessary delivery agents
DOMAIN() Section 19.3.3, "DOMAIN()" Recommended Common domain wide information
FEATURE() Section 19.3.4, "FEATURE()" Recommended Solutions to special needs

Note that what is minimally required for a workstation differs from what is minimally required for a central mail server. We recommend that you use these recommendations as a jumping-off point and investigate all the m4 techniques that are available.

19.3.1 OSTYPE()

Support for various operating systems is supplied with the OSTYPE m4 command. Every mc file must declare the operating system with this command. The available support is supplied by files in the _CF_DIR_/ostype directory. A listing of those files looks something like this:

aix2.m4         bsdi1.0.m4      irix4.m4        ptx2.m4         ultrix4.m4
aix3.m4         bsdi2.0.m4      irix5.m4        riscos4.5.m4    unknown.m4
altos.m4        dgux.m4         isc4.1.m4       sco3.2.m4       uxpds.m4
amdahl-uts.m4   domainos.m4     linux.m4        solaris2.m4
aux.m4          dynix3.2.m4     maxion.m4       sunos3.5.m4
bsd4.3.m4       hpux10.m4       nextstep.m4     sunos4.1.m4
bsd4.4.m4       hpux9.m4        osf1.m4         svr4.m4

To include support, select the file that best describes your operating system, delete the .m4 suffix from its name, and include the resulting name in an OSTYPE declaration:

OSTYPE(`ultrix4.1')

Here, support for the DEC Ultrix operating system is defined. Note that some of these are not entirely accurate. For example, ultrix4.1.m4 includes support for Ultrix versions 4.2 and 4.3, and sunos4.1.m4 includes support for SunOS versions 4.1.2, 4.1.3., and 4.1.4.

If you pick a name for which no file exists, or if you misspell the name of the file, an error similar to the following will print:

m4: Can't open ../ostype/ultrux4.1.m4: No such file or directory

If you omit the OSTYPE declaration entirely, you will get the following error:

*** ERROR: No system type defined (use OSTYPE macro)

19.3.2 MAILER()

Delivery agents are not automatically declared. Instead, you must specify which ones you want to support and which ones to ignore. Support is included by using the MAILER m4 macro:

MAILER(`local')

This causes support for both the local and prog delivery agents to be included. This is the minimal declaration (even if you don't intend to perform local or program delivery).

Other delivery agents that are recognized by the MAILER() technique are listed in Table 19.3 .

Table 19.3: MAILER Delivery Agents
MAILER() Delivery agents it declares
cyrus cyrus , cyrusbb
fax fax
local local , prog
mail11 mail11
phquery ph
pop pop
procmail procmail
smtp smtp , esmtp , smtp8 , relay
usenet usenet
uucp \*= uucp , uucp-old , uucp-new , uucp-dom , uucp-uudom

If you use both uucp and smtp , put smtp first.

New delivery agents can be created by devising a new m4 file in the _CF_DIR_/mailers directory. The MAILER() m4 technique performs its inclusion by reading a file with the delivery agent name suffixed with .m4 from that directory.

Some delivery agent equates, such as F= and M= , can be modified with the m4 configuration technique. Table 30.1 (see Section 30.4, "The Equates" ) lists all the equates and shows where to find further information about each of them. By investigating those sections, you can discover how to tune particular equates with the m4 technique. For example, the following mc lines define the program used for local delivery to be mail.local :

define(`LOCAL_MAILER_PATH', `/usr/local/bin/mail.local')
MAILER(local)

Note that all modifications to equates must precede the corresponding MAILER() definition. See Section 30.3, "m4 Configuration Syntax" for a complete description of MAILER() and all the ins and outs of using it.

Also note that beginning with V8.8, the MAILER_DEFINITIONS m4 command (see Section 19.6.40 ) can be used to force your delivery agent definitions to be grouped with the others.

19.3.3 DOMAIN()

For large sites it can be advantageous to gather all configuration decisions that are common to the entire domain into a single file. The directory to hold domain information files is called _CF_DIR_/domain . The configuration information in those files is accessed by using the DOMAIN() m4 technique, for example,

DOMAIN(`uofa.edu')

This line in any of your mc files causes the file _CF_DIR_/domain/uofa.edu.m4 to be included at that point. Examples that come with the distribution illustrate subdomains under Berkeley.EDU . One boilerplate file, named generic.m4 , can be used as a starting point for your own domainwide file. For example, if all hosts at your site masquerade behind one email name, you might want to put MASQUERADE_AS (see Section 19.6.42, MASQUERADE-AS ) in your domain file. Domain files also form a natural location for the definition of site-specific relays (see Section 19.4.5, "Relays" ).

If the domain that is specified does not exist or is misspelled, an error similar to the following will be printed:

m4: Can't open ../domain/generik.m4: No such file or directory

The use of DOMAIN() is not mandatory but is recommended.

19.3.4 FEATURE()

V8 sendmail offers a number of features that you may find very useful. To include a feature, include an m4 command like one of the following in your mc file:

FEATURE(

keyword

)
FEATURE(

keyword

, 

argument

)

These declarations causes a file of the name _CF_DIR_/feature/ keyword .m4 to be read at that place in your .mc file. The available keyword files are summarized in Table 19.4 and each is explained in the section at the end of this chapter. Note that some keywords require an additional argument.

Table 19.4: FEATURE Keywords
Keyword Version Description
allmasquerade Section 19.6.6, FEATURE(allmasquerade) V8.2 and above Masquerade the sender too
always_add_domain Section 19.6.7, FEATURE(always-add-domain) V8.1 and above Add the local domain even on local mail
bestmx_is_local Section 19.6.8, FEATURE(bestmx-is-local) V8.6 and above Accept best MX record as local if in $=w
bitdomain Section 19.6.9, FEATURE(bitdomain) V8.1 and above Convert BITNET addresses into Internet addresses
domaintable Section 19.6.10, FEATURE(domaintable) V8.2 and above Accept old as equivalent to new domain
genericstable Section 19.6.11, FEATURE(genericstable) V8.8 and above Transform sender addresses
limited_masquerade Section 19.6.12, FEATURE(limited-masquerade) V8.8 and above Only masquerade $=M hosts
local_procmail Section 19.6.13, FEATURE(local-procmail) V8.7 and above Use procmail(1) as local delivery agent
mailertable Section 19.6.14, FEATURE(mailertable) V8.1 and above Database selects new delivery agents
masquerade_entire_domain Section 19.6.15, FEATURE(masquerade-entire-domain) V8.8 and above Masquerade all hosts under a domain
masquerade_envelope Section 19.6.16, FEATURE(masquerade-envelope) V8.7 and above Masquerade the envelope too
nocanonify Section 19.6.17, FEATURE(nocanonify) V8.1 and above Don't canonify with $[ and $]
nodns Section 19.6.18, FEATURE(nodns) V8.6 Omit DNS support from configuration file
nouucp Section 19.6.19, FEATURE(nouucp) V8.1 and above Eliminate all UUCP support
nullclient Section 19.6.20, FEATURE(nullclient) V8.6 and above Relay all mail through a mail host
redirect Section 19.6.21, FEATURE(redirect) V8.1 and above Add support for address.REDIRECT
smrsh Section 19.6.22, FEATURE(smrsh) V8.7 and above Use smrsh (sendmail restricted shell)
notsticky Section 19.6.23, FEATURE(notsticky) V8.1 thru V8.6 Don't differ user from user@local.host
stickyhost Section 19.6.24, FEATURE(stickyhost) V8.7 and above Differ user from user@local.host
use_ct_file Section 19.6.25, FEATURE(use-ct-file) V8.7 and above Use /etc/sendmail.ct for a list of trusted users
use_cw_file Section 19.6.26, FEATURE(use-cw-file) V8.1 and above Use /etc/sendmail.cw for local hostnames
uucpdomain Section 19.6.27, FEATURE(uucpdomain) V8.1 and above Convert UUCP hosts via a database
virtusertable Section 19.6.28, FEATURE(virtusertable) V8.8 and above Support for virtual domains

All the features available are described in detail at the end of this chapter (see Section 19.6, "Alphabetized m4 Macros" ).