Working well (SA customization tips)

Quentin Campbell Q.G.Campbell at NEWCASTLE.AC.UK
Fri Nov 22 08:29:12 GMT 2002


> -----Original Message-----
> From: Matt Kettler [mailto:mkettler at evi-inc.com] 
> Sent: 18 November 2002 17:02
> To: MAILSCANNER at JISCMAIL.AC.UK
> Subject: Re: Working well (SA customization tips)
> 
> 
[snip]
> Since you're running MailScanner the best place to put your 
> rules is in MailScanner's spam.assassin.prefs.conf, but I'd 
> recommend writing and testing them using the command-line 
> tools while editing /root/.spamassassin/user_prefs.
> 

Matt

I would have thought doing your command line testing of new rules as
"root" is not a good idea since at most sites the production
SpamAssassin is normally running as root and so will look for a
~root/.spamassassin/user_prefs file. It will thus *always* find and use
the rules you are developing/testing which is not a good idea! 

For this reason I always do my testing as an ordinary user. If the
ordinary login ID I am using is "mylogin" then the rules I am testing
will be in the file ~mylogon/.spamassassin/user_prefs.

When I run "spamassassin -tD <test.msg" as user "mylogon" then it will
add my new rules/scores to a copy of the production rules/scores [1]. My
new rules/scores ones will overide any production ones of the same name.
This is exacly the behaviour you want when testing. The -D option will
show you the rulesets that were added and in which order.

When I am happy that my new rules are OK I merge them into the
production "local" rules/scores in /etc/mail/spamassassin/local.cf. I do
not use spam.assassin.prefs.conf or /root/.spamassassin/user_prefs.
These should *only* contain comment lines.

Notes

[1] SpamAssassin assumes a hierarchy of rulesets. It loads each ruleset
in turn before it runs. If a rulelset contains a rule/score with the
same name as a rule/score loaded by an earlier ruleset then the later
version overides the earlier one.

At this site the production "spamassassin"  (running as root) loads in
turn the rulesets:

   /usr/share/spamassassin/*.cf      [I *never* change these]
   /etc/mail/spamassassin/local.cf   [local additions/changes to the
above]
   ~root/.spamassassin/user_prefs    [is always empty] 

If you run "spamassassin" as "mylogon" for testing new rules/scores then
it will load ~mylogon/.spamassassin/user_prefs rather than
~root/.spamassasin/user_prefs.

In order that "spamassassin -t" works correctly when run as ~mylogon,
make sure that your production "local" ruleset
(/etc/mail/spamassassin/local.cf in our case) is readable to the world.
Otherwise the rules/scores it contains will be ignored during command
line testing of spamassassin! 

Quentin
---
PHONE: +44 191 222 8209    Computing Service, University of Newcastle
FAX:   +44 191 222 8765    Newcastle upon Tyne, United Kingdom, NE1 7RU.
------------------------------------------------------------------------
"Any opinion expressed above is mine. The University can get its own." 




More information about the MailScanner mailing list