On Fri, 2022-04-22 at 09:20 -0400, Michael Grant wrote:
> Is there some way to run spamassassin with only a specific set of
> rules and scores?
> 
If I'm trying to target specific specific sorts of spam I write rules
that sort of follow these guidelines:

- their rule names all start with my initials followed by an underscore.
  followed by something specific, e.g XXX_FAKE_INVOICE. Any subrules
  append a number to this name: XXX_FAKE_INVOICE2

- if a subrule will always be part of a more complex rule, i.e. linked
  in with a meta-rule it will initially be named as described and only,
  when debugged and working will its name be changed to, say,
  __XXX_FAKE_INVOICE2 
  to stop subriule names from cluttering the header area of processed
  messages.

- these rules don't reference any standard rules 

The result of the above is that it doesn't matter whether other rules
also run because I can see exactly which part(s) of my rules are firing
and know they won't be affected by any other rules because there are no
references to any standard rules or (usually) to my other self-developed
rules: naming rules, if done carefully, is as good a way as any to
isolate your own rules from the standard rule set and/or any others
you've found or been given. 

I do all rule development on a separate machine, which also has SA
installed. This is configured so it only runs when triggered by a shell
script. This starts SA, pipes a set of test messages into it, and stops
SA when all test messages have been run. SA's output is sent to stdout
so it can be inspected using 'less', filtered with grep to only show
output from my rules or however else I want to handle it to make it more
readable.

When I'm happy with a new rules its gets put live by ftping the .cf file
containing it to the live machine's repository and restarting the live
SA daemon to pick up the new rule(s). Last, but not least, all my
private rules are put under version control in a git repository.

HTH
Martin

Reply via email to