Introduction

To follow a recipe successfully, you must clearly understand the instructions it contains. You must understand the difference between folding and stirring and be able to find the spices when the recipe calls for a pinch of cumin. Just as you must be able to find your way around the kitchen to become a cook, you must know your way around the sendmail distribution in order to build or customize a sendmail configuration.

The directory structure ”created by the sendmail source code distribution tarball ” contains the tools and ingredients used to build and configure sendmail. The top-level directory created by the tarball is assigned a name that identifies the sendmail version number. At the time of this writing, the current version is sendmail 8.12.9; therefore, the top-level directory is named sendmail-8.12.9 . By the time you read this, there will be a newer version of sendmail, and the directory name will reflect that new version number. An ls of the top-level directory shows the following: [1]

[1] Most of the ls command output in this book is generated on a Red Hat Linux system. Other versions of Unix and Linux may sort ls output in a different way. The listing order may be different, but the files and directories will be the same.

 $ ls sendmail-8.12.9 Build     doc      INSTALL    libsmdb     mailstats  praliases      sendmail cf        editmap  KNOWNBUGS  libsmutil   Makefile   README         smrsh contrib   FAQ      libmilter  LICENSE     makemap    RELEASE_NOTES  test devtools  include  libsm      mail.local  PGPKEYS    rmail          vacation 

Most of these files and directories are used to compile sendmail. The Build script uses the Makefile to compile sendmail and its utilities. The devtools directory is used to set compiler options, as discussed in Recipe 1.2 to Recipe 1.7. The source code is located in aptly named subdirectories. For example, the sendmail source code is in the sendmail directory, the libraries are in directories such as libsm and libsmutil , and the source code of utilities such as makemap and smrsh is located in easily identified directories.

There are also several important sources of information in the distribution:

  • The INSTALL and README files provide the latest information on compiling and installing sendmail.

  • The RELEASE_NOTES file lists the important features of the new release.

  • The KNOWNBUGS and FAQ files explain solutions to chronic and common problems.

  • The doc subdirectory contains the Sendmail Installation and Operations Guide , which is an excellent source of information for the sendmail administrator.

Of all of these important directories and files, the most important (from the perspective of this book) is the cf directory, because the cf directory contains the configuration files (and this is a book about sendmail configuration).

The cf directory structure

The m4 source files and libraries used to build the sendmail configuration are located in the cf directory, which contains the following items:

 $ ls sendmail-8.12.9/cf cf      feature  m4      ostype  sendmail.schema  siteconfig domain  hack     mailer  README  sh 

The cf directory contains two files, README and sendmail.schema , and nine subdirectories. The sendmail.schema file is an experimental LDAP schema that predefines attribute types and object classes that can be used with LDAP. The sendmail schema is used in most LDAP examples in this book. The README file is a comprehensive reference to the syntax and usage of all of the m4 macros and variables used to configure sendmail. The README file is an invaluable reference, particularly when used with this book.

The directories hack , sh , and siteconfig have very little use for most configurations.


hack directory

The hack directory is intended to hold m4 source files built by the local system administrator to solve temporary sendmail configuration problems. There is only one file in the hack directory, built years ago, which serves as an example of a sendmail hack. The hack directory and the HACK macro are still there, but, with all of the power and flexibility available to configure sendmail, there is simply no good reason to use them.


siteconfig directory

The siteconfig directory is intended to hold files that use sendmail m4 SITE macros to list the locally connected UUCP sites. The siteconfig directory, the SITECONFIG macro, and the SITE macro are maintained for backward compatibility. However, the directory and the macros are obsolete and should no longer be used to define the UUCP connectivity for a UUCP mail server.


sh directory

The sh directory contains only the makeinfo.sh file. Most of the files in the cf subdirectories are m4 macro source files that end with the .m4 extension. This file, however, ends with the .sh extension, indicating that it is a shell script. The script produces three lines of comments for the sendmail.cf file that identify who built the configuration, when they built it, and in what directory.

The remaining six directories are the real heart of sendmail configuration. Four of these directories, domain , feature , ostype , and mailer , have the same names as sendmail m4 macros, and provide the source code used by those macros. The purposes of these four directories are:


domain directory

The domain directory holds m4 source files that define configuration values that are specific to your domain or network. If you need to define such values, create your own file; the six files contained in the domain directory are just examples. The configuration file you create for your environment is then used in the master configuration file via the DOMAIN macro.


ostype directory

The files in the ostype directory define operating system-specific characteristics for the sendmail configuration. Every master configuration file must contain an OSTYPE macro to process the correct macro source file for the sendmail server's operating system. [2] The sendmail-8.12.9/ostype directory contains configuration files for more than 40 different operating systems, each one easily identified by name. Select the file that matches your server's operating system.

[2] Recipe 10.10 shows a trick that is used to create a configuration without using an OSTYPE macro, but the trick is not recommended for general use.


mailer directory

In addition to an OSTYPE macro, most master configuration files have at least one MAILER macro. MAILER macros process source files from the mailer directory. Each file in the mailer directory contains the definition of a set of mailers. The current mailer directory contains 12 different files. Many configurations use only the two most basic sets of mailers: local.m4 for local mail delivery and smtp.m4 for SMTP mail delivery.


feature directory

The feature directory contains the m4 source code files that implement various sendmail features. There are more than 40 feature files available in the directory. Features are used to address specific configuration problems.

The other two remaining directories, cf and m4 , contain the master configuration files and macro source libraries used by m4 . The four directories described above contain files that are invoked inside the sendmail configuration by m4 macros. The cf/cf directory and the cf/m4 directory contain m4 source files that are normally invoked on the m4 command line.

The cf/m4 directory

The cf/m4 directory contains the m4 macro definitions and the sendmail.cf skeleton code needed to build a sendmail.cf configuration file. Remember that m4 is a general purpose macro language; it is not a language specifically designed to build sendmail configurations. sendmail configurations are built using macros defined by the sendmail developers. The cf/m4 directory contains the four files that define those macro commands.


version.m4

The version.m4 file defines the sendmail.cf Z variable, which is assigned the sendmail version number. Because this value changes with each sendmail release, it is defined in a separate file for easy maintenance. [3]

[3] The sendmail version number is not the same as the sendmail.cf version level. In our examples, the sendmail version number is 8.12.9, but the sendmail.cf version level is 10. Furthermore, neither one of these has anything to do with the m4 VERSIONID macro, which is used to place version control information in the master configuration file.


cf.m4

The cf.m4 file is specified on the m4 command line to incorporate the library of sendmail m4 macro commands into the m4 process. The cf.m4 file includes, by reference, the cfhead.m4 file that contains the macro definitions.


cfhead.m4

The cfhead.m4 file defines the m4 macros used to configure sendmail. This file includes lots of stuff, most importantly the definition of many of the commands used to build a configuration.


proto.m4

The proto.m4 file is the source of most of the content found in the sendmail.cf file.

The cf subdirectory

The cf/cf directory is the working directory of sendmail configuration. It contains all of the master configuration files, and it is where you will put your own master configuration file when you build a custom configuration. The directory contains more than 40 files.

 $ ls sendmail-8.12.9/cf/cf Build             generic-hpux10.cf      generic-solaris.cf  python.cs.mc chez.cs.mc        generic-hpux10.mc      generic-solaris.mc  README clientproto.mc    generic-hpux9.cf       generic-sunos4.1.cf s2k-osf1.mc cs-hpux10.mc      generic-hpux9.mc       generic-sunos4.1.mc s2k-ultrix4.mc cs-hpux9.mc       generic-linux.cf       generic-ultrix4.cf  submit.cf cs-osf1.mc        generic-linux.mc       generic-ultrix4.mc  submit.mc cs-solaris2.mc    generic-mpeix.cf       huginn.cs.mc        tcpproto.mc cs-sunos4.1.mc    generic-mpeix.mc       knecht.mc           ucbarpa.mc cs-ultrix4.mc     generic-nextstep3.3.cf mail.cs.mc          ucbvax.mc cyrusproto.mc     generic-nextstep3.3.mc mail.eecs.mc        uucpproto.mc generic-bsd4.4.cf generic-osf1.cf        mailspool.cs.mc     vangogh.cs.mc generic-bsd4.4.mc generic-osf1.mc        Makefile 

Most of these files ”more than 30 of them ”are sample master configuration files. You can identify a master configuration file by the .mc extension. Some are examples meant as educational tools, but most are prototypes or generic files meant to be used as the basis of your own configuration. The generic files designed for specific operating systems are particularly interesting, such as Solaris, HPUX, BSD, Linux, and several others. We use the generic-linux.mc file in Recipe 1.8.

Several of the files are identified by the .cf extension. These files are the result of processing master configuration files through m4 ; they are already in the proper format to be used as the sendmail.cf file. It is unlikely , however, that you will use one of these files directly. Unless the generic master configuration file is exactly to your liking, the sendmail configuration file produced from that .mc file will not be what you want. We start with a generic configuration in Recipe 1.8, but the subsequent recipes in this book modify that generic configuration to create the custom configurations we need.



Sendmail Cookbook
sendmail Cookbook
ISBN: 0596004710
EAN: 2147483647
Year: 2005
Pages: 178
Authors: Craig Hunt

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net