37.11. Adding Sendmail Features with M4

The primary Sendmail configuration file sendmail.cf is extremely complex, and almost impossible to edit manually. Fortunately, it is usually built from a series of M4 macro files that are much simpler and can be modified using this module or by manual editing. M4, for those who have not heard of it before, is a program that parses text files and expands macros in them. These macros can include other text files, define variables and functions, or exclude text based on certain conditions. M4 is very similar to the preprocessor used by the C programming language which handles #include and #define statements. Fortunately, this module hides most of the complex details from you.

Often, the default Sendmail configuration that comes with your operating system will not have some features enabled, such as address mapping or domain routing. Webmin can detect this, and will display an error message if you try to use a module page for a Sendmail feature that is not enabled in the primary configuration file. To turn on a missing feature, an entry must be added to the primary M4 configuration file, from which sendmail.cf is rebuilt. Sendmail will then be able to use it and this module will be able to configure it.

Before you can manage your Sendmail M4 configuration, this module must know where to find the M4 files. To check if it has the correct paths and to set them if not, follow these steps:

1.
On the module's main page, click on the Sendmail M4 Configuration icon.

2.
If an error message like The Sendmail M4 configuration file /etc/sendmail.mc was not found or The locations of the Sendmail M4 base directory and M4 config files have not been set is displayed, then the module cannot find the M4 files. If a table of entries from the file is displayed instead, then everything is configured OK and you can skip the rest of these steps.

3.
If you are running Linux, check your distribution CD or website to make sure that all the packages whose names start with sendmail are installed. Sometimes the M4 files are in a separate package named something like sendmail-cf. If you do find and install such a package, go back to Step 1 and check again to see if the module has found the configuration files.

4.
If you have compiled and installed Sendmail from the source package, the M4 files will be in the cf subdirectory of the source code. Click on the Module Config link on the module's main page, and set the Sendmail M4 base directory field to /path/to/source/cf, and the Full path to M4 config file to the appropriate generic- in the /path/to/source/cf/cf directory. For the latter field, the file you choose depends on your operating system—for example, on Linux you would enter generic-linux.mc, while on Solaris you should enter generic-solaris2.mc. The .cf files in that directory should not be selected, as they are fully built Sendmail primary configurations, not M4 macro files. See Section 37.15 “Configuring the Sendmail Configuration Module” for more information on these fields.

5.
If you are using the Sendmail package that came with your version of UNIX and cannot find any M4 files on your system, then this feature of the module cannot be used. This is unfortunately the case on some operating systems.

Once the Sendmail M4 Configuration page displays the contents of your primary M4 file, you can use it to add new features such as address mapping or domain routing. The page can in fact be used to modify any of the M4 macros in the file, but unless you are any experienced Sendmail administrator it is best to stick to these instructions for adding features:

1.
From the menu next to the Add new entry of type button at the bottom of the page, select Feature and then hit the button to go to the feature creation form.

2.
Select the one that you want to add from the Feature menu. The most commonly used features have names next to them in brackets that correspond to their icons on the module's main page.

3.
In the Parameters field, enter hash –o followed by the path that should be used for the feature's text and DBM files. For example, if adding a virtusertable feature you should enter hash –o /etc/mail/virtusertable (assuming your system has an /etc/mail directory).

4.
Log in to your system as root via SSH, telnet, or at the console and create the empty text file with a command like touch /etc/mail/virtusertable. Naturally, this is not necessary if it already exists.

5.
Click the Create button to update the M4 file and return to the previous page.

6.
At the very bottom of the M4 file contents list, click the Rebuild Sendmail Configuration button. A confirmation page showing the exact changes that will be made to your sendmail.cf file will be displayed. Typically they will be limited to directives for the new feature. If the confirmation form indicates that a huge number of lines are going to be changed, it is likely that the M4 file being edited was not originally used to build your current sendmail.cf file, and so should not be used in future.

7.
To go ahead and use the newly rebuilt Sendmail configuration, click the Yes, replace it now button. Your sendmail.cf file will be updated and the server process restarted to immediately activate it.

8.
Go back to the module's main page, and click on the icon for the feature that you have just enabled. You will not be able to add and edit address mappings or whatever it was for which you added support.

As you can see from looking at the existing M4 file entries, editing or adding to it can still be quite complex. For this reason, the book does not cover all of the possible features or other macro types that you can add. For most people, however, the defaults will work just fine. At most, all you should need to do is add a feature or two as explained above. If you want to learn more about editing the M4 configuration, you should buy a book dedicated to Sendmail administration.

One problem with using the M4 page to rebuild your Sendmail configuration is that any changes that have been made directly to sendmail.cf will be overwritten. The module's Sendmail Options page unfortunately does precisely this, so if you follow the instructions above to add a new feature, any changes made on that page will be lost! The only real solution is to edit the entries in the M4 file that correspond to those on the Sendmail Options page. For example, the Send outgoing mail via host field is set by the SMART_HOST define.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.166.90