To reduce the amount of spam reaching user's inboxes, I made some modifications to the
/etc/mail/sendmail.mc
file on a Linux server running
sendmail.
The sendmail.mc
already had the line
FEATURE(`blacklist_recipients')dnl
. The
blacklist_recipients
feature turns on the ability to block
incoming mail for certain recipient usernames, hostnames, or addresses. For
example, you can block incoming mail to user nobody, host foo.mydomain.com, or
guest@bar.mydomain.com. These specifications are put in the
/etc/mail/access
file.
Immediately below that line, I added the following lines to use the McFadden Associates E-Mail Blacklist, the Spamhaus Block List, and the Passive Spam Block List.
FEATURE(`dnsbl', `bl.csma.biz', `550 Spam Block: mail from $&{client_addr} refused - See http://bl.csma.biz/')dnl
FEATURE(`dnsbl', `sbl.spamhaus.org', `550 Spam Block: mail from $&{client_addr} refused - See http://www.spamhaus.org/sbl/')dnl
FEATURE(`dnsbl', `psbl.surriel.com', `550 Spam Block: mail from $&{client_addr} refused - see http://psbl.surriel.com/')dnl
I removed the "dnl" from the beginning of the following line, which
"uncomments" the directive, to allow
the system to accept email from users who have authenticated by a trusted
mechanism defined by TRUST_AUTH_MECH
(see
Sendmail Authorization for Outgoing Email).
dnl FEATURE(delay_checks)dnl
I didn't want a user's email to be rejected because the user's system
received a dynamically assigned IP
address previously assigned to a system sending out spam, which I've seen
happen previously. By using the delay_checks
feature, you can
have sendmail skip the check_mail and check_relay
rulesets, if the sender has been authenticated by a "trusted" mechanism,
such as by sending the user's userid and password to the server when sending
email.
I then regenerated the sendmail.cf file from the sendmail.mc file and restarted sendmail with the commands below.
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
/etc/init.d/sendmail restart
References:
-
Sendmail cf/README -
Features
sendmail.org - Sendmail cf/README - Anti-Spam Configuration Control sendmail.org
-
Passive Spam Block List (PSBL) Added
MoonPoint Support -
Sendmail Authorization for Outgoing Email
MoonPoint Support - McFadden Associates E-Mail Blacklist
- Spamhaus Block List
- Passive Spam Block List