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


Previous Section Next Section

Milter

Tune interactions with the Milter program V8.12 and later

If you set up your mc configuration file to filter mail through external mail filter programs (Section 7.6.2), you might want to send more information to those programs than is provided by default. This Milter option allows you to do just that, and is declared like this:

O Milter.LogLevel=level                    configuration file (V8.12 and later) 
O Milter.macros.connect=list               configuration file (V8.12 and later) 
O Milter.macros.helo=list                  configuration file (V8.12 and later) 
O Milter.macros.envfrom=list               configuration file (V8.12 and later) 
O Milter.macros.envrcpt=list               configuration file (V8.12 and later) 
-OMilter.LogLevel=level                    command line (V8.12 and later) 
-OMilter.macros.connect=list               command line (V8.12 and later) 
-OMilter.macros.helo=list                  command line (V8.12 and later) 
-OMilter.macros.envfrom=list               command line (V8.12 and later) 
-OMilter.macros.envrcpt=list               command line (V8.12 and later) 
define(`confMILTER_LOG_LEVEL',`level')     mc configuration (V8.12 and later) 
define(`confMILTER_MACROS_CONNECT',`list') mc configuration (V8.12 and later) 
define(`confMILTER_MACROS_HELO',`list')    mc configuration (V8.12 and later) 
define(`confMILTER_MACROS_ENVFROM',`list') mc configuration (V8.12 and later) 
define(`confMILTER_MACROS_ENVRCPT',`list') mc configuration (V8.12 and later) 

If any of these commands are set without MILTER support (Section 7.6.1), the following error is printed and logged when sendmail starts, and the command is ignored:

Warning: Option: bad option requires Milter support (-DMILTER)

The bare Milter option is meaningless, and if set (say, to foo) in your sendmail.cf file like the following:

O Milter foo

the following error will be produced:

configfile: line number: readcf: unknown option name Milter foo 

Also, following a bare Milter option with an equal sign, as, for example:

O Milter=foo

will produce the following error:[41]

[41] Prior to V8.12.5, this command produced a core dump.

configfile: line number: milter_set_option: invalid Milter option, must specify suboption 

A bare Milter.macros is also meaningless. If set (say, to {foo}) in your sendmail.cf file like the following:

O Milter.macros={foo}

the following error will be produced:

configfile: line number: milter_set_option: invalid Milter option macros {foo} 

Because the nature of each suboption varies, we discuss their defaults in the sections to follow.

Milter.LogLevel

The Milter.LogLevel option is of type number. If it is set with a negative number (other than a -1), a nonnumeric expression, or the value zero, no Milter logging will be done. If the Milter.LogLevel option is entirely missing (or set to a -1), it defaults to the same value as that specified for the LogLevel option (LogLevel). Otherwise, this option sets the log level used by sendmail to report on external Milter programs:

define(`confMILTER_LOG_LEVEL',`9')

Here, the Milter log level is set to 9, which will report everything logged at level 9 and below. As of this writing, all Milter levels less than 10 are logged at LOG_ERR, and those greater than 10 are logged at LOG_INFO. Also as of this writing, only a few Milter log levels are available:

1

Bad reply codes from the external program, socket errors, timeouts waiting for the external program to reply, polling errors with select(3) while waiting for the external program to reply, bad read/write length from/to the external program, and general reply and state errors.

9

A header was added, added or deleted a RCPT TO: response, replaced message body, and no active filter.

10

Connect to filters, connect ending, and lies about adding or changing that were honored anyway.

11

Empty or missing socket information, unknown socket type, local socket name too long, local socket unsafe, bad address format, bad port number, unknown port name, invalid domain specification, unknown hostname, error creating socket, open failure, unknown protocol, status, and aborts.

14

Reply code, rejects, discards, and deferrals.

15

Milter senders, and milter recipients.

18

Headers sent, and body sent.

22

Time to complete a command.

Milter.macros.connect

The Milter.macros.connect option is of type string. If set, it lists the sendmail macros whose names and values should be passed to the external program after a connection has been accepted. Only the macro names should be listed here (omit the leading $ from each), separated by commas.[42] For example:

[42] When the argument to an m4 define command contains one or more commas, that argument should be enclosed in double half-quotes.

define(`confMILTER_MACROS_CONNECT',``j, {daemon_name}'')

At most, 40 macros can be listed. If you list too many, the following error will be printed and logged:

milter_set_option: too many macros in Milter.macros.connect num (max 40)

There is no built-in default. The default for the mc configuration technique includes the macros $j ($j), $_ ($_), ${daemon_name} (${daemon_name}), ${if_name} (${if_name}), and ${if_addr} (${if_addr}). If you replace the default list with no macros, none will be sent to the external program.

Milter.macros.helo

The Milter.macros.helo option is of type string. If set, it lists the sendmail macros whose names and values should be passed to the external program after the HELO or EHLO command has been received. Only the macro names should be listed here (omit the leading $ from each), separated by commas.[43] For example:

[43] When the argument to an m4 define command contains one or more commas, that argument should be enclosed in double half-quotes.

define(`confMILTER_MACROS_HELO',``{client_addr}, {client_name}'')

At most, 40 macros can be listed. If you list too many, the following error will be printed and logged:

milter_set_option: too many macros in Milter.macros.helo num (max 40)

There is no built-in default. The default for the mc configuration technique includes the macros ${tls_version} (${tls_version}), ${cipher} (${cipher}), ${cipher_bits} (${cipher_bits}), ${cert_subject} (${cert_subject}), and ${cert_issuer} (${cert_issuer}). If you replace the default list with no macros, none will be sent to the external program.

Milter.macros.envfrom

The Milter.macros.envfrom option is of type string. If set, it lists the sendmail macros whose names and values should be passed to the external program after the MAIL FROM: command has been received. Only the macro names should be listed here (omit the leading $ from each), separated by commas.[44] For example:

[44] When the argument to an m4 define command contains one or more commas, that argument should be enclosed in double half-quotes.

define(`confMILTER_MACROS_ENVFROM',``{mail_addr}, {mail_mailer}'')

At most, 40 macros can be listed. If you list too many, the following error will be printed and logged:

milter_set_option: too many macros in Milter.macros.envfrom num (max 40)

There is no built-in default. The default for the mc configuration technique includes the macros $i ($i), ${auth_type} (${auth_type}), ${auth_authen} (${auth_authen}), ${auth_ssf} (${auth_ssf}), ${auth_author} (${auth_author}), ${mail_mailer} (${mail_mailer}), ${mail_host} (${mail_host}), and ${mail_addr} (${mail_addr}). If you replace the default list with no macros, none will be sent to the external program.

Milter.macros.envrcpt

The Milter.macros.envrcpt option is of type string. If set, it lists the sendmail macros whose names and values should be passed to the external program after each RCPT TO: command has been received. Only the macro names should be listed here (omit the leading $ from each), separated by commas.[45] For example:

[45] When the argument to an m4 define command contains one or more commas, that argument should be enclosed in double half-quotes.

define(`confMILTER_MACROS_ENVRCPT',``{rcpt_addr}, {rcpt_mailer}'')

At most, 40 macros can be listed. If you list too many, the following error will be printed and logged:

milter_set_option: too many macros in Milter.macros.envrcpt num (max 40)

There is no built-in default. The default for the mc configuration technique includes the macros ${rcpt_mailer} (${rcpt_mailer}), ${rcpt_host} (${rcpt_host}), and ${rcpt_addr} (${rcpt_addr}). If you replace the default list with no macros, none will be sent to the external program.

None of these Milter options is safe. If specified from the command line, any can cause sendmail to relinquish its special privileges.

    Previous Section Next Section