Configuring Sendmail

About this task

To configure a sendmail installation built from source (as opposed to installing the sendmail distributed with PureMessage), you must first build and install sendmail with milter support, and then connect sendmail with PureMessage.

To configure Sendmail:

Follow these steps

  1. Build milter support using the method appropriate for your version of sendmail. Sendmail must be built and installed with milter support. For further information on sendmail's milter functionality, see libmilter/README in the sendmail source distribution.
    • Sendmail versions earlier than 8.12.0

      In sendmail versions prior to v8.12.0, milter support was not enabled by default in the sendmail sources. It must be explicitly enabled by adding the following lines to devtools/Site/site.config.m4 in the sendmail distribution, prior to building sendmail:

      dnl Milter
      APPENDDEF(`conf_sendmail_ENVDEF', `-D_FFR_MILTER=1')
      APPENDDEF(`conf_libmilter_ENVDEF', `-D_FFR_MILTER=1')

      If this file does not exist, create it and then add the lines above.

      For sendmail versions prior to v8.12.0, you must add the following line near the beginning of the m4 configuration file (typically sendmail.mc) used to generate your sendmail.cf. Locate the VERSIONID line in sendmail.mc, and add the following line right below it:

      define(`_FFR_MILTER',`1')dnl

      Note the use of the backtick and apostrophe characters as opening and closing quotes. Ensure that the added text exactly matches the example above.

    • Sendmail versions 8.12.0 or later

      In sendmail versions v8.12.0 and later, you must enable milter support by adding the following lines to the devtools/Site/site.config.m4 file in the sendmail distribution, prior to building sendmail:

      dnl Milter
      APPENDDEF(`conf_sendmail_ENVDEF', `-DMILTER=1')

      Note the use of the backtick and apostrophe characters as opening and closing quotes. Ensure that the added text exactly matches the example above.

  2. To compile the sendmail sources, you typically run the following command at the top level of the sendmail source distribution:
    % sh Build -c
  3. Copy the sendmail binary to its usual location on your platform, typically /usr/sbin/sendmail and/or /usr/lib/sendmail, and then generate the sendmail configuration files as described in sendmail/INSTALL.
  4. Connect sendmail and PureMessage:
    1. Modify sendmail.mc

      PureMessage milters are defined in the file pmx.conf, in the etc directory below the PureMessage installation location. For each PureMessage milter you want to set up for processing mail, sendmail must be told how to contact it.

      In the directory sendmail/cf/cf/, select a configuration file that matches your system configuration. Add a line like the following to sendmail.mc before generating sendmail.cf:

      INPUT_MAIL_FILTER(`Policy', `S=inet:3366@localhost,F=T,T=C:5m;E:8m;R:4m;S:2m')

      The above assumes PureMessage is listening on port 3366 on the same host where sendmail is running. If PureMessage is running on a different host and port, substitute the hostname for localhost (for example S=inet:9999@pmxhostname.foo.com).

      The name assigned to the INPUT_MAIL_FILTER (`Policy' in the example above) is used by sendmail for tagging messages in the syslog. It can be any descriptive text, such as the same name assigned to the PureMessage milter. Milter parameter configuration is further described in the topic "Configuring milter parameters for sendmail" in the Sophos Knowledgebase.

      Sendmail calls your milters in the same order specified with INPUT_MAIL_FILTER lines.

      Sendmail will then contact the filter at the specified port and host every time it handles an SMTP connection.

    2. Regenerate sendmail.cf

      Regenerate your sendmail.cf file from the sendmail.mc file. To regenerate your sendmail.cf file, run the following commands (replacing the paths to the files appropriately):

      cd /etc/mail
      m4 sendmail_source_dir/cf/m4/cf.m4 /path/to/sendmail.mc > sendmail.cf