How to tell if Spam Assassin is using my custom rules?

Discuss your pilot or production implementation with other Zimbra admins or our engineers.
copowpow
Posts: 17
Joined: Mon Mar 26, 2018 3:34 pm

How to tell if Spam Assassin is using my custom rules?

Postby copowpow » Fri Jun 14, 2019 6:00 pm

Hey guys, I have made some custom rules for SA and i cant tell if they are actually being used.

version: Release 8.8.8.GA.2009.UBUNTU16.64 UBUNTU16_64 FOSS edition, Patch 8.8.8_P10.

I created sauser.cf under /opt/zimbra/data/spamassassin/localrules/ and added some rules to look at header subject lines as a test, like this:

Code: Select all

header LOCAL_SUB1 Subject =~ /test/i
describe LOCAL_SUB1 Subject line spam keyword detected
score LOCAL_SUB1   10


the file has correct permissions:

Code: Select all

-rw-r----- 1 zimbra zimbra  14K Jun 12 15:59 sauser.cf



To test i copied an email and ran

Code: Select all

spamassassin -D < /tmp/test.mail > /dev/null 2> /tmp/test.output


When I look at the test.output, I see:

Code: Select all

Jun 12 16:04:22.878 [10233] dbg: config: read file /opt/zimbra/data/spamassassin/localrules/sauser.cf



but when I scroll further down I dont see my rule running by name "LOCAL_SUB1"

I see lots of other rules firing like:

Code: Select all

Jun 12 16:04:24.260 [10233] dbg: rules: ran header rule __HAS_TO ======> got hit: "<YES>"


But I cannot tell if my custom rules are firing. Do custom rules show up by name in the "spamassassin -D" output? I cant tell if my rules are being used! Does my formatting look correct? Any help would be greatly appreciated!


copowpow
Posts: 17
Joined: Mon Mar 26, 2018 3:34 pm

Re: How to tell if Spam Assassin is using my custom rules?

Postby copowpow » Fri Jun 14, 2019 6:08 pm

let me also add the output of SA lint:

Code: Select all

z@test: /opt/zimbra/common/bin/spamassassin --lint
Jun 14 12:07:54.722 [22741] warn: netset: cannot include 127.0.0.0/8 as it has already been included
Jun 14 12:07:54.723 [22741] warn: netset: cannot include 0:0:0:0:0:0:0:1/128 as it has already been included


I dont think that those warnings have anything to do with the custom rules....
User avatar
JDunphy
Outstanding Member
Outstanding Member
Posts: 415
Joined: Fri Sep 12, 2014 11:18 pm
Location: Victoria, BC
ZCS/ZD Version: 8.7.11_P12 RHEL6 Network Edition
Contact:

Re: How to tell if Spam Assassin is using my custom rules?

Postby JDunphy » Fri Jun 14, 2019 8:07 pm

warnings is normal and custom rules do show up in debug mode...

At the bottom you can also see two lines... check: is spam? which lists the score ... and check: subtests= ... and that lists the test that fired.

Other things to check.

Verify you are running this from zimbra so you get the environment setup for debug mode and SA can find its config files. Example:

Code: Select all

# su - zimbra
% which spamassassin
~/common/bin/spamassassin

There is an order which it SA searches... You might have 3.004002 or 3.00400. I am running 8.7.11 and updated mine to version 3.4.2

Code: Select all

Default configuration data is loaded from the first existing directory in:
#
#    /opt/zimbra/data/spamassassin/state/3.004002
#    /opt/zimbra/data/spamassassin/rules
   ....
   ...

# Site-specific configuration data is used to override any values which
#    had already been set. This is loaded from the first existing directory in:
#
#    /opt/zimbra/data/spamassassin/localrules
#    /opt/zimbra/common/etc/mail/spamassassin
  ...
  ...

That is how it finds its files.

Return to “Administrators”

Who is online

Users browsing this forum: fct and 17 guests