You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Jerry Malcolm <te...@malcolms.com> on 2021/10/20 16:47:44 UTC

which local.cf/user_prefs.cf?

I have read that I should add customization to local.cf.  But on AWS 
Linux I have a local.cf in /usr/share/spamassassin.  It says this is the 
place to make changes.  But there's another local.cf in 
/etc/mail/spamassassin that looks like it has some customization in it 
as well.  It says the values are overwritten by editing 
~/.spamassassin/user_prefs.cf.   I added some score changes to the 
/usr/share version, but the scores don't appear to be affected.  That 
may be a different problem. But I'd prefer not just blasting every 
possible config file with the same data hoping I hit the right one.  So 
could someone clarify the different uses of each of the files (including 
user_prefs.cf) and let me know the guidelines for when to use which one?

Thx


Re: which local.cf/user_prefs.cf?

Posted by Bill Cole <sa...@billmail.scconsult.com>.
On 2021-10-20 at 12:47:44 UTC-0400 (Wed, 20 Oct 2021 11:47:44 -0500)
Jerry Malcolm <te...@malcolms.com>
is rumored to have said:

> I have read that I should add customization to local.cf.  But on AWS Linux I have a local.cf in /usr/share/spamassassin.  It says this is the place to make changes. 

"It" is wrong, whatever "It" is. /usr/share/spamassassin contains the full ruleset from the initial installation of SA and isn't really useful for anything.

> But there's another local.cf in /etc/mail/spamassassin that looks like it has some customization in it as well. 

That's where you should make local system-wide modifications.

> It says the values are overwritten by editing ~/.spamassassin/user_prefs.cf.  

Semi-true.

IF you have configured SpamAssassin to support per-user settings instead of just one overarching systemwide configuration, then each user can have their own ~/.spamassassin/user_prefs file that overrides the distribution defaults (/usr/share/spamassassin) the currently active rules downloaded from rules channels (/var/db/spamassassin/$version/) and the local system-wide configuration (/etc/mail/spamassassin/.)

> I added some score changes to the /usr/share version, but the scores don't appear to be affected.  That may be a different problem.

General rule: never add, delete, or edit anything under /usr/ except (on some systems) stuff in /usr/local/. In particular, anything in /usr/share/ should be seen as static, should be installed by your package manager (apt, yum, dnf, pkg, etc.,) and files there should be architecture-independent and fully portable.

Local system-wide configuration of SpamAssassin should be done via *.pre and *.cf files in /etc/mail/spamassassin/:

1. /etc/mail/spamassassin/*.pre files are loaded before anything else in SA and typically include only 'loadplugin' directives.

2. The /etc/mail/spamassassin/local.cf file is where you should put score adjustments and other system-wide configuration directives. These override the default scores and settings.

3. Other /etc/mail/spamassassin/*.cf files will be loaded as SA starts for all users. Files are loaded in alphanumeric order and the last instance of a directive or score wins (i.e. if you set something in local.cf and zzzlocal.cf, the latter one governs)

See 'perldoc Mail::SpamAssassin::Conf' for details of the available config directives.

> But I'd prefer not just blasting every possible config file with the same data hoping I hit the right one.  So could someone clarify the different uses of each of the files (including user_prefs.cf) and let me know the guidelines for when to use which one?

If you are not supporting user-specific SA scores and settings, you probably only ever need to touch  /etc/mail/spamassassin/local.cf. If you run sa-update daily (as you should) it will keep the stuff in /var/db/spamassassin/ updated for you. If you haven't given substantial thought to how you are going to support per-user settings, you won't have that set up to work at all and you can skip thinking about user_prefs at all.



-- 
Bill Cole
bill@scconsult.com or billcole@apache.org
(AKA @grumpybozo and many *@billmail.scconsult.com addresses)
Not Currently Available For Hire