[milters] Archive

Lists Index Date Thread Search

Article: 1191
From: Taylor, Grant
Date: 2006-10-17 14:11:39 -0400
Subject: Custom SpamAssassin (individual) test scores...

Removal...........: milters-request@milter.info?subject=remove
More information..: http://www.milter.info/#Support

I'm not sure if any one else will be interested or not, but here is
something (I consider to be) neat that I did with SpamAssassin that has
considerably helped (reduce) my rate of spam that comes in to my account.

Note:  I have a Sendmail Milter in place that will reject any message during
the SMTP transaction if the message in question has a spam score that is 10
points (system wide tunable parameter) higher than each recipients
individual spam score.

I had my personal spam score set to 2 points, which means any message up to
12 points would be let through in to my account.  I was very happy with the
rate of spam to ham detection that SA was doing with my personal score.
What I was not happy with was the fact that a message with a score of 11.9
would be allowed through in to my mail box.  Note:  11.9 is almost 6 times
my spam score.  My goal was to reduce the multiplication factor.  Seeing as
how I could (should) not adjust the system wide 10 point overage value I
needed to find another way to alter the ratios.  So I ended up setting
custom score values for all the filters that SpamAssassin knows about.

Seeing as how there are 750+ tests with individual scores, I was not really
keen on the idea of altering the scores by hand.  So I wrote a quick little
Awk script (below) to take care of it for me.  The script will look for any
lines that start with score and then decide how to modify the values.  Some
lines have 4 weights on them and some have 1 so I had to test to keep from
adding 3 "0"s to the lines thus turning a 1 weight score in to a 4 weight
score.  In my script I just multiplied the default weights by 3, you should
be able to alter them however you want.

The net effect was that I multiplied the weights of each test as well as my
spam score by 3.  (I did later decide to drop my spam score slightly down to
5.)  So now my messages will be tagged as spam at 5 points and allow
messages that are up to 3 times my spam score to come through.  Thus far,
I've seen a tremendous drop in the number of messages that were tagged as
spam get through.  I'm very pleased with the initial results of the test,
though I think I'll change the numbers to make the ratio be 2 times my spam
score.  I.e. 10 points is considered spam and 20 points will be rejected.

Any and all thoughts / comments / suggestions / complaints welcomed a

Grant. . . .

     FS = "[ \t]+"
     ML = 3
     if ($0 ~ /^score /) {
         if (length($4) > 0) {
             print "#"$1 " " $2 " " $3 " " $4
" " $5 " " $6
             print $1 " " $2 " " $3*ML " " $4*ML "
" $5*ML " " $6*ML
         } else {
             print "#"$1 " " $2 " " $3
             print $1 " " $2 " " $3*ML
     } else {
         print $0

P.S.  A simple "cat ... | awk ... >> user_prefs" will be all you need to
make the same updates.

Lists Index Date Thread Search