Configuring Sendmail for milter-greylist
Add the following to the bottom of your sendmail.mc script:
INPUT_MAIL_FILTER(`greylist',`S=local:/var/milter-greylist/milter-greylist.sock')dnl
define(`confMILTER_MACROS_CONNECT', `j, {if_addr}')dnl
define(`confMILTER_MACROS_HELO', `{verify}, {cert_subject}')dnl
define(`confMILTER_MACROS_ENVFROM', `i, {auth_authen}')dnl
define(`confMILTER_MACROS_ENVRCPT', `{greylist}')dnl
You can also specify timeouts if you like, the following example has a one minute timeout when sending information to the milter and the same waiting for a reply, the defaults are just 10 seconds each and may not be enough when using DNSRBL and/or SPF. Read more at Sendmail milter installation (3rd party instructions) Note: Sendmail is now owned by Proofprint but some of the original site is here. Sendmail docs (version 8.12) can be found here.
INPUT_MAIL_FILTER(`greylist',`S=local:/var/milter-greylist/milter-greylist.sock, F=, T=S:1m;R:1m')dnl
Make the sendmail.cf file from the m4-file. Many systems have a Makefile that will do this automagically.
/usr/bin/m4 /usr/share/sendmail/cf/m4/cf.m4 sendmail.mc > sendmail
Restart sendmail.
Comments
- If you have the spamd and/or clamd INPUT_MAIL_FILTER installed, be sure to have the greylist INPUT_MAIL_FILTER last, otherwise things will not necessarily work.
- In Fedora RPMs or yum installations, notice that the socket location is "/var/run/milter-greylist/milter-greylist.sock". The correct line for sendmail.mc is therefore INPUT_MAIL_FILTER(‘greylist’,‘S=local:/var/run/milter-greylist/milter-greylist.sock’)dnl
Sendmail timeouts
Sendmail lets you specify timeouts for various phases of the mail transaction. Some of the default values are ridiculously high due to what's recommended in the RFC:s. For instance, up to an hour waiting for the next command to be issued. This can result in lots of Sendmail processes just using up system resources better needed by milter-greylist. Here's an example with shorter times:
define(`confTO_ICONNECT', `15s')dnl
define(`confTO_CONNECT', `3m')dnl
define(`confTO_HELO', `2m')dnl
define(`confTO_MAIL', `1m')dnl
define(`confTO_RCPT', `1m')dnl
define(`confTO_DATAINIT', `1m')dnl
define(`confTO_DATABLOCK', `1m')dnl
define(`confTO_DATAFINAL', `1m')dnl
define(`confTO_RSET', `1m')dnl
define(`confTO_QUIT', `1m')dnl
define(`confTO_MISC', `1m')dnl
define(`confTO_COMMAND', `1m')dnl
define(`confTO_STARTTLS', `2m')dnl
The default values can be found here: Sendmail Tweaking.





