Setting Server wide Spam Assassin settings

martin MHC

Well-Known Member
Sep 14, 2016
216
35
78
UK
cPanel Access Level
Root Administrator
I apologise for ths question being seemingly easy to answer, but I can't find the info. I'm lookin for.

I have been reading about Spam Assassin on here and across the web for the last few days, and I'm sure I've already come across the info. I'm looking for (but I didn't want it before), and I now I do want it, I can't find it!!

Anyhow; I want to do three things:

1) I want to set Apache Spam Assassin (3.4.1) rules to effect all accounts on my server. Which file in the spamassassin folder (I believe /var/lib/spamassassin/ but not certain) do I edit for this, I think it's local.cf but am not sure and can't find any clarification. FIXED

2) Can someone please provide a quick syntax example of setting custom rules in the local.cf file (or whichever file is appropriate). The local.cf itself doesn't give examples given on the documentation ( Apache SpamAssassin - Documentation - cPanel Documentation ) only relates to the CPanel interface, as far as I can see. FIXED

3) Is there a way for the SpamAssassin to delete/remove/ingore previously set account-specific rules in one fell swoop? Such as deleting account specific files (even better, if you can direct me to these account specific files I can then use the syntax (if valid) to update the server-wide rule set.

Many thanks, and sorry for the probable obviousness of this question, I can't see the info and have been going round in circles looking!

Cheers
 
Last edited:

martin MHC

Well-Known Member
Sep 14, 2016
216
35
78
UK
cPanel Access Level
Root Administrator
UPDATE:

I have found This page ( SpamAssassin: Tests Performed: v3.3.x ) which lists Spam Assassin Rules as well as this Config file details about how to update ( Mail::SpamAssassin::Conf - SpamAssassin configuration file )

the conclusion I reach from these is:

- 1) Log in to your server and find /etc/mail/spamassassin/local.cf and download,
- 2) Edit the file to add/adjust the scores needed
- 3) Reupload the file
- 4) On the command line run: /scripts/restartsrv_spamd

This *should* update and restart Apache Spam Assassin on the server, and apply the scores/rules specified in the links above to all accounts on the server.

I have not yet found a neat way of clearing all account-specific rules.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,229
463
the conclusion I reach from these is:

- 1) Log in to your server and find /etc/mail/spamassassin/local.cf and download,
- 2) Edit the file to add/adjust the scores needed
- 3) Reupload the file
- 4) On the command line run: /scripts/restartsrv_spamd

This *should* update and restart Apache Spam Assassin on the server, and apply the scores/rules specified in the links above to all accounts on the server.
Hello,

This is the correct method of modifying the default SpamAssassin rules/configuration values. To clear the custom configuration values implemented in an individual account, you'd need to manually remove the following file:

Code:
/home/$username/.spamassassin/user_prefs
Thank you.
 

Monto

Member
Jul 5, 2017
16
2
3
Australia
cPanel Access Level
Root Administrator
Hello,

Changing the score required in local.cf doesn't change the value in existing accounts, not for me anyway. Does this mean that because of the user_prefs files that lock in the default, that essentially the score cannot be changed server-wide, but needs to be done per account?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,229
463
Hello,

Yes, the values in the user_prefs file for individual accounts takes precedence over the global values. You'd have to remove or modify the existing "/home/$username/.spamassassin/user_prefs" files for each account to ensure they are using the default global values.

Thank you.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,229
463
Hello @martin MHC,

I've re-opened this thread per your direct request. Feel free to post your question here.

Thank you.
 

martin MHC

Well-Known Member
Sep 14, 2016
216
35
78
UK
cPanel Access Level
Root Administrator
Many thanks @cPanelMichael

Re your response above; you state a very important qualifier - Please can you clarify what files/rules are actually used in a process: for example If I set a /account/.spamassassin/.user_prefs file to contain a set of SCORE adjustments; does the presence of this file also overwrite (ie clear) any BLACKLIST set addresses (or any other NON-SCORE default values) in the server-wide /etc/mail/spamassassin/local.cf file?

Cheers
 
Last edited:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,229
463