maradnus,
You need the compat_check feature as well as the access_db feature. You have to put "FEATURE(`compat_check')" BELOW the access_db FEATURE line in sendmail.mc, or the Build script will not create the sendmail.cf correctly. Here is how that portion of your sendmail.mc should look:
Code:
FEATURE(`access_db')
FEATURE(`mailertable',`hash -T<TMPF> /etc/mail/mailertable.db')dnl
FEATURE(`virtusertable',`hash -T<TMPF> /etc/mail/virtusertable.db')dnl
FEATURE(`access_db',`hash -T<TMPF> /etc/mail/access')dnl
FEATURE(`compat_check')
Don't forget to install the new cf file with "./Build install-cf". Re-start sendmail with "/etc/init.d/sendmail restart". You should see no error messages.
Put a line like this in your /etc/mail/access:
Code:
Compat:fred@domain.com<@>joe@domain.com DISCARD
Rebuild access.db:
Code:
$ sudo makemap hash /etc/mail/access.db < /etc/mail/access
Spoof an SMTP session like this:
Code:
$ telnet localhost 25
Trying 127.0.0.1...
Connected to mail.domain.org.
Escape character is '^]'.
220 mail.domain.org ESMTP Sendmail 8.14.4/8.14.4; Wed, 16 Mar 2011 07:19:24 -0500
ehlo x
250-mail.domain.org Hello mail.domain.org [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-AUTH DIGEST-MD5 CRAM-MD5 LOGIN PLAIN
250-DELIVERBY
250 HELP
mail from:<fred@domain.com>
250 2.1.0 <fred@domain.com>... Sender ok
rcpt to:<joe@domain.com>
250 2.1.5 <joe@domain.com>... Recipient ok
data
354 Enter mail, end with "." on a line by itself
Subject: boom!
here
.
250 2.0.0 p2GCJOZG005022 Message accepted for delivery
quit
Sendmail apparently accepted the message for delivery! But look at your mail log and you will see that the message was discarded. You can also REJECT messages this way.
Code:
Mar 16 07:20:25 mail sendmail[5022]: p2GCJOZG005022: from=<fred@domain.com>, size=21, class=0, nrcpts=1, msgid=<201103161220.p2GCJOZG005022@mail.domain.org>, proto=ESMTP, daemon=MTA, relay=mail.domain.org [127.0.0.1]
Mar 16 07:20:25 mail sendmail[5545]: p2GCJOZG005022: ruleset=check_compat, arg1=<fred@domain.com>, arg2=<joe@domain.com>, relay=mail.domain.org [127.0.0.1], discard