«

»

Nov 18

Print this Post

Debian + Sendmail + SpamAssassin + MimeDefang config for inbound mail host

Honestly, this is more of an “I’m posting this here for my reference” post than anything else, but searching google and bing for something similar yesterday (which is prompting me to put this here) came up with old, outdated, and frankly useless, results (at least in my opinion).

I’m not going to go into how to install Debian or software (honestly, running “apt-get install sendmail spamassassin mimedefang” can’t be that hard), but I have this sendmail.mc on my current Debian Lenny installation, and it deals with spam and ham with very good results:

divert(-1)dnl
# /etc/mail/sendmail.mc
# Last modified by cluberti at 01:48 - November 18, 2010
divert(0)dnl

dnl ##########################################################################
dnl # Sendmail-specific information
dnl ##########################################################################

define(`_USE_ETC_MAIL_')dnl
include(`/usr/share/sendmail/cf/m4/cf.m4')dnl
VERSIONID(`$Id: sendmail.mc, $j Sendmail')
OSTYPE(`debian')dnl
DOMAIN(`debian-mta')dnl
dnl # Items controlled by /etc/mail/sendmail.conf - DO NOT TOUCH HERE
undefine(`confHOST_STATUS_DIRECTORY')dnl        #DAEMON_HOSTSTATS=

dnl ##########################################################################
dnl # Machine-specific section
dnl ##########################################################################

FEATURE(`no_default_msa')dnl
DAEMON_OPTIONS(`Family=inet,  Name=MTA-v4, Port=smtp, Addr=ip.ad.dr.ess')dnl
DAEMON_OPTIONS(`Family=inet,  Name=MSP-v4, Port=submission, Addr=ip.ad.dr.ess')dnl
DAEMON_OPTIONS(`Family=inet,  Name=MTA-v4, Port=smtp, Addr=127.0.0.1')dnl
DAEMON_OPTIONS(`Family=inet,  Name=MSP-v4, Port=submission, Addr=127.0.0.1')dnl

define(`confBIND_OPTS', `WorkAroundBrokenAAAA')dnl
define(`confCONNECTION_RATE_THROTTLE', `15')dnl
define(`confCONNECTION_RATE_WINDOW_SIZE',`10m')dnl
define(`confREJECT_MSG', `550 Access denied')dnl
define(`confBAD_RCPT_THROTTLE',`3')dnl

FEATURE(`access_db', , `skip')dnl
FEATURE(`greet_pause', `1000')dnl 1 seconds
FEATURE(`delay_checks', `friend', `n')dnl
FEATURE(`conncontrol', `nodelay', `terminate')dnl
FEATURE(`ratecontrol', `nodelay', `terminate')dnl
FEATURE(`nouucp', `reject')dnl

dnl ##########################################################################
dnl # User-configurable section
dnl ##########################################################################

FEATURE(`use_cw_file')dnl
FEATURE(`genericstable')dnl
GENERICS_DOMAIN_FILE(`/etc/mail/generics-domains')dnl
FEATURE(`virtusertable')dnl
FEATURE(`redirect')dnl
FEATURE(`smrsh')dnl
FEATURE(`mailertable')dnl
FEATURE(`blacklist_recipients')dnl
FEATURE(`lookupdotdomain')dnl
FEATURE(`compat_check')dnl
FEATURE(`authinfo')dnl
FEATURE(`no_default_msa')dnl

FEATURE(`always_add_domain')dnl
MASQUERADE_AS(`mail.domain.tld')dnl
FEATURE(`allmasquerade')dnl
FEATURE(`masquerade_envelope')dnl

FEATURE(`enhdnsbl', `cbl.abuseat.org', `"Spam blocked see: http://cbl.abuseat.org/lookup.cgi?ip="$&;{client_addr}', `t')dnl
FEATURE(`enhdnsbl', `bl.spamcop.net', `"Spam blocked see: http://spamcop.net/bl.shtml?"$&{client_addr}', `t')dnl
FEATURE(`enhdnsbl', `zen.spamhaus.org', `"Spam blocked see: http://www.spamhaus.org/query/bl?ip="$&{client_addr}', `t')dnl

define(`ALIAS_FILE',`/etc/mail/aliases')dnl
define(`_QUIET_FREEWARE_')dnl
define(`confREJECT_MSG',`552 Spammer $&(client_addr) $&f rejected by Postmaster@$j - check_mail or check_relay')dnl
define(`confSMTP_LOGIN_MSG', mail.cluberti.com - UCE not welcome!)dnl
define(`confPRIVACY_FLAGS', `authwarnings noexpn novrfy needmailhelo needexpnhelo needvrfyhelo noreceipts ')dnl
define(`confTO_CONNECT', `2m')dnl
define(`confTO_IDENT', `0')dnl
define(`confTO_QUEUEWARN_URGENT', `29m')dnl
define(`confTO_QUEUEWARN_NORMAL', `4h')dnl
define(`confTO_QUEUEWARN_NONURGENT', `8h')dnl
define(`confTo_QUEUERETURN_URGENT', `59m')dnl
define(`confTo_QUEUERETURN_NORMAL', `8h')dnl
define(`confTo_QUEUERETURN_NONURGENT', `16h')dnl

INPUT_MAIL_FILTER(`mimedefang', `S=unix:/var/spool/MIMEDefang/mimedefang.sock, T=S:1m;R:1m')

MAILER_DEFINITIONS
MAILER(`local')dnl
MAILER(`smtp')dnl

Permanent link to this article: http://www.cluberti.com/blog/2010/11/18/debian-sendmail-spamassassin-mimedefang-config-for-inbound-mail-host/

Bad Behavior has blocked 1656 access attempts in the last 7 days.