If you want to build or customize a sendmail configuration, you need to know your way around the sendmail distribution. This article will help you find your way around the cf directory, which contains the configuration files. It was excerpted from chapter one of The Sendmail Cookbook, written by Craig Hunt (O'Reilly Media, 2004; ISBN: 0596004710).
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.
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.*
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.
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.
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
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.