[Mimedefang] filters for subject content

Cormack, Ken kcormack at acs.roadway.com
Mon Feb 9 13:36:26 EST 2004


> I believe he asked for a NON-spamassassin way to do this unless I have
> gotten the threads confused.

> > They're SpamAssassin rules.  They go in your SpamAssassin configuration
> > file, not your MIMEDefang filter.

Here is what I use, to block subject lines via sendmail.  Add this to the
LOCAL_RULESET section of your sendmail.mc file.  You then create two files.
They are:

/etc/mail/subjects_full
and
/etc/mail/subjects_part

The subjects_full file should contain complete "exact match" subjects you
wish to block.  The subjects_part file (partial subjects) should contain
just keywords you wish to block, that could appear in any subject.  For
instance, if you want to block ANY message with a subject containing the
word "mortgage", you simply put that word in the subjects_part file.  If you
want to block only a specific subject heading with that word, you would put
the complete subject line in the subject_full file.

Note that the search against these files is NOT case-sensitive.  I generally
just populate these files with everything in lower-case.  The rule will
match regardless of UPPER/lower case.  Also, and this is IMPORTANT... in
these two files, you MUST REPLACE ANY SPACES WITH PERIODS.

Finally, below is the actual ruleset I use.  BE CERTAIN to replace any
occurrances of "[TAB]" with an actual tab character, before attempting to
use this.  Do NOT simply copy/paste into your sendmail.mc without taking
care of those [TAB] indicators.

Have fun!

KEN CORMACK, RHCE
Sr. UNIX Systems Analyst,
    Open Systems Group
Sr. Software Analyst,
    TSG Midrange Systems Group
AFFILIATED COMPUTER SERVICES, INC.
    557 E. Tallmadge Ave., Akron, OH  44310
    mailto:kcormack at acs.roadway.com
    mailto:ken.cormack at acs-inc.com
    Phone: (330) 643-6372
    Fax: (330) 643-6367
    Pager: (800) 946-4646 Pin 1412819

"If that that is 'is' is that that is not 'not is', is that that is 'not is'
that that is not 'is'?  It is!" - Ken Cormack

"Sendmail administration is not black magic.  There are legitimate technical
reasons why it requires the sacrificing of a live chicken." - Unknown


LOCAL_RULESETS
######################################################################
###
###  Email Virus and Anti-SPAM stuff...
###
###  Add exact-match subject lines to /etc/mail/subjects_full
###  Add substrings to match in subject lines to /etc/mail/subjects_part
###  In both files, all spaces MUST be replaced with periods (.)
###
###  Create two files called /etc/mail/subjects_full and
###  /etc/mail/subjects_part.  The former has complete
###  unwanted 'subject' lines, while the latter has only
###  substrings within 'subject' lines.
### 
###  As an example, suppose you want to filter out 'viagra'
###  spam.  The following entry in your subjects_part
###  file would do it:
###    viagra
### 
###  In the case of multi-word entries, all spaces MUST be
###  replaced with periods.  For example:
###    herbal.viagra
### 
###  These filters are not case-sensitive.
### 
######################################################################
F{FullSubjects} -o /etc/mail/subjects_full
F{PartSubjects} -o /etc/mail/subjects_part
HSubject:[TAB]$>CheckSubject

SCheckSubject
R$={FullSubjects}$*[TAB]$: REJECTSUBJECT
R$* $={PartSubjects} $*[TAB]$: REJECTSUBJECT
R$* REJECTSUBJECT $*[TAB]$#error $: "553 Access Denied - MSG may contain
SPAM/WORM/VIRUS/HOAX."

RADV : $*[TAB]$#error $: "553 Delivery blocked; HSubject: indicates
unsolicited commercial email."
R ADV : ADLT $*[TAB]$#error $: "553 Delivery blocked; HSubject: indicates
unsolicited adult-content email."
RADV $*[TAB]$#error $: "553 Delivery blocked; HSubject: indicates
unsolicited commercial email."



More information about the MIMEDefang mailing list