Solved smtpd.conf vs hostname.mc for milters

I am trying to understand how to register milters with Sendmail.

I have found this tutorial suggesting that milters must be referenced in hostname.mc and that the specific values to insert will always be mentioned in the man pages of the specific milters. However, the only milter's man page I have found providing .mc instructions is the one used by the author of the tutorial: milter-regex.

The rest I've seen, for example opendkim(8), filter-clamav(8), filter-dkim-signer(8) do not provide any instruction with regards to the .mc file. At the same time, I have seen that smtpd.conf(5) provides a syntax to register filter calls and hook them at the right place (however apparently nothing to indicate the location of the binary of the filter). So here are my questions:

  1. Would it be correct to assume that if a filter does not provide .mc instructions, then the filter must be registered in smtpd.conf?
  2. Why would some filters need to be registered in hostname.mc and why would other be able to be used without being registed in hostname.mc ?
  3. Where can I find documentation for the syntax used in hostname.mc?
Regarding the third question, I am curious about the parameters on the following line:

Code:
 INPUT_MAIL_FILTER(`milter-regex', `S=unix:/var/spool/milter-regex, T=S:30s;R:2m')

Such a T=S, R:2m etc.... I am also wondering which other macros are available apart from INPUT_MAIL_FILTER. I tried to search sendmail documentation but couldn't find anything regarding this file.

Thank you
 
I am trying to understand how to register milters with Sendmail.

I have found this tutorial suggesting that milters must be referenced in hostname.mc and that the specific values to insert will always be mentioned in the man pages of the specific milters. However, the only milter's man page I have found providing .mc instructions is the one used by the author of the tutorial: milter-regex.

This is correct.

At the same time, I have seen that smtpd.conf(5) provides a syntax to register filter calls and hook them at the right place (however apparently nothing to indicate the location of the binary of the filter). So here are my questions:

smtpd.conf(5) applies to postfix(), not to sendmail(8)

  1. Would it be correct to assume that if a filter does not provide .mc instructions, then the filter must be registered in smtpd.conf?

No.

  1. Why would some filters need to be registered in hostname.mc and why would other be able to be used without being registed in hostname.mc ?

Different mail transport agents have their own configuration specifications.

  1. Where can I find documentation for the syntax used in hostname.mc?

I have a book titled "sendmail Miltrers - A Guide for Fighting Spam" by Bryan Costales and Marcia Flint (copyright 2005 - I bought it as a remainder some years ago) which I used in combination with the sendmail documentation to write my own anti-spam milter which checks the relay hostname during incoming mail transactions against the regular expression patterns stored in the configuration file to determine whether to accept, reject temporarily or reject permanantly the connection.

Regarding the third question, I am curious about the parameters on the following line:

Code:
 INPUT_MAIL_FILTER(`milter-regex', `S=unix:/var/spool/milter-regex, T=S:30s;R:2m')

Such a T=S, R:2m etc....

INPUT_MAIL_FILTER has two arguments: (1) the name of your milter and - as above- (2) a UNIX domain socket through which your milter will communicate with sendmail (see the definition of smfi_setconn() for other options). S is the timeout for sending information from the MTA to a filter; R is the timeout for reading reply from the filter. Another flag F=[R|T] determines whether to Reject connections if milter ia unavailable or Temporarily fail connections if the milter is unavailable.

I am also wondering which other macros are available apart from INPUT_MAIL_FILTER. I tried to search sendmail documentation but couldn't find anything regarding this file.

See http://www.sendmail.org/~gshapiro/8.10.Training/milterconfig.html
 
Hum... then how I am supposed to know how to configure specific milters with sendmail when their documentation is silent on this, like for example opendkim. Is there a convention or something? While I am definitely interested in a solution for this specific milter, I would like to be able to rely on some reference / man page so that I do not need to hunt on Google for every milter I want to add (which should be possible since I understand that milters APIs are standardized).
 
Hum... then how I am supposed to know how to configure specific milters with sendmail when their documentation is silent on this[...]

You're not configuring the milter, you're configuring sendmail via its .mc file, so you check the sendmail documentation.

In some cases, you may need to understand the sendmail macros which will be used in which case the milter man page should mention it and, in the worst case scenario, the sendmail log file will probably contain complaints about macros being unset which you can then set. See, for example, greylist.conf() under the heading Sendmail Macros.
 
Back
Top