Sendmail includes a facility for plugging in custom mail filters, called milters. It's documented here. Blackmilter implements a blacklist of IP addresses which are not permitted to send mail to this host. Any mail attempts from blacklisted addresses are rejected immediately upon connection, before the mail gets transmitted.
This could also be accomplished by turning the blacklists into a set of firewall rules for port 25. However, current firewall implementations process their rules sequentially, one by one. If you have a lot of hosts you want blocked, this is too costly. Blackmilter stores the IP addresses in a data structure that is both fast and reasonably compact. If you wanted to, you could block millions of addresses quite efficiently.
A more reasonable alternative is the access database built into sendmail. However, benchmarking shows that blackmilter is much faster at this task - from thirty to sixty times faster. Same for using a DNS-based RBL - blackmilter is vastly faster. If you are getting a lot of mail and blocking a lot of IP addresses, this can make a difference. Also blackmilter has some advantages in flexibility, such as the autoupdate and socket update features.
Blackmilter does not specify any particular blacklisting policy. It is merely a clean and simple tool to let you efficiently implement whatever policy you choose.
Version 2.001, 25feb2015:
Version 2.0, 10feb2015:
Version 0.81, 14aug2014:
Version 0.80, 16jul2014:
Version 0.75, 03aug2005:
Version 0.74, 20jun2005:
Version 0.73, 08jun2005:
Version 0.72, 06jun2005:
Version 0.71, 31may2005:
Version 0.70, 09dec2004:
Version 0.60, 14sep2004:
Version 0.50, 26may2004:
This is very abbreviated, intended mainly as a reminder for those who have worked with milters before. If it's your first milter, you should look on the web for more thorough documentation. Also, these instructions are pretty specific to FreeBSD, and will have to be adapted for other OSs.
If you don't see MILTER in the compilation options, you will have to re-build sendmail.sendmail -d0.1 -bt < /dev/null | grep MILTER
Rebuild and install sendmail.cf.INPUT_MAIL_FILTER(`blackmilter',`S=unix:/var/run/blackmilter.sock')
# blackmilter -b /etc/smtp_blacklist unix:/var/run/blackmilter.sock
blackmilter_enable="YES" blackmilter_flags="-a -b /etc/smtp_blacklist" blackmilter_socket="unix:/var/run/blackmilter.sock"
See also:
spfmilter,
sfcmilter,
graymilter,
sample_milter.
ACME Labs / Software / blackmilter