You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Dave Williss <dw...@microimages.com> on 2007/01/10 23:19:00 UTC

Can't get user_prefs to do anything.

I've setup SpamAssassin (latest stable version as of last week) and got 
it running via spamd and postfix is scanning the email using spamc.  
This all works well now.

However, I can't get it to recognize settings in ~/.spamassassin/user_prefs.

I found a hint here....
    http://wiki.apache.org/spamassassin/UserPrefRuleTest
that "rules are not executed from user_prefs files unless a) the 
allow_user_rules setting allows this (rare), or b) you execute SA 
directly rather than through spamd/spamc"

So I set allow_user_rules to 1 in my local.cf and restarted spamd.  It 
still won't follow my user_prefs.

I'm trying to set the required_hits threshold higher and also setting 
the rewrite_header for my account.

Is there some other configuration that I'm not seeing that tells it to 
look for user_prefs files?
Is there some special way the permissions have to be set?  I made sure 
anybody could read it and the .spamassassin directory it's in just in case.

-- Dave Williss


Re: Can't get user_prefs to do anything.

Posted by Dave Williss <dw...@microimages.com>.
[SNIP]

>> Is there some special way the permissions have to be set?  I made sure 
>> anybody could read it and the .spamassassin directory it's in just in case.
>>     
>
> It sounds like you want to remove calling SA from the MTA, and instead call it
> from the MDA (such as procmail) which allows per-user configs and databases.
I looked into procmail. Setting mailbox_command in postfix's main.cf 
makes it work fine for local deliveries.  However, most of my users on 
one box are aliases that forward to another address, and those don't get 
filtered through procmail.

You may ask: if they're just aliases, do they even have a home directory 
to put the user_prefs in?  Well, one does for testing.  Once I get that 
part working, I'm going to move on to putting the preferences in  MySQL.

Anyway, I found a solution that worked just fine -- skip procmail and 
have master.cf invoke spamc with "-u ${user}".  The documentation for 
spamc says the -u option is obsolete, but it does what I need.


Re: Can't get user_prefs to do anything.

Posted by Theo Van Dinter <fe...@apache.org>.
On Wed, Jan 10, 2007 at 04:19:00PM -0600, Dave Williss wrote:
> I've setup SpamAssassin (latest stable version as of last week) and got 
> it running via spamd and postfix is scanning the email using spamc.  
> This all works well now.

Ok, so you're running it from the MTA, also known as site-wide mode.

> However, I can't get it to recognize settings in ~/.spamassassin/user_prefs.

Of course, in site-wide mode there are no per-user configs or databases.

> So I set allow_user_rules to 1 in my local.cf and restarted spamd.  It 
> still won't follow my user_prefs.

You shouldn't enable that unless you're sure that you need to.

> Is there some special way the permissions have to be set?  I made sure 
> anybody could read it and the .spamassassin directory it's in just in case.

It sounds like you want to remove calling SA from the MTA, and instead call it
from the MDA (such as procmail) which allows per-user configs and databases.

-- 
Randomly Selected Tagline:
 "I don't care how many eyes a man has... as long as it's less than five."
 -Leela 

Re: Can't get user_prefs to do anything.

Posted by Matt Kettler <mk...@verizon.net>.
Dave Williss wrote:
> I've setup SpamAssassin (latest stable version as of last week) and
> got it running via spamd and postfix is scanning the email using
> spamc.  This all works well now.
>
> However, I can't get it to recognize settings in
> ~/.spamassassin/user_prefs.
>
> I found a hint here....
>    http://wiki.apache.org/spamassassin/UserPrefRuleTest
> that "rules are not executed from user_prefs files unless a) the
> allow_user_rules setting allows this (rare), or b) you execute SA
> directly rather than through spamd/spamc"
>
> So I set allow_user_rules to 1 in my local.cf and restarted spamd.  It
> still won't follow my user_prefs.
>
> I'm trying to set the required_hits threshold higher and also setting
> the rewrite_header for my account.
You don't need allow_user_rules to change the required_hits in
user_prefs.. you need allow_user_rules to use things that execute
regular expressions like: body, header, and rawbody. These options can
be dangerous to allow untrusted users to add, hence the default of not
allowing them. You can find a list of config options that need this to
execute in user_prefs by looking at the "Privleged settings" section of
the conf manpage:

http://spamassassin.apache.org/full/3.1.x/doc/Mail_SpamAssassin_Conf.html#rule_definitions_and_privileged_settings

You can also find ones that cannot be done in user prefs at all in the
"Administrator settings" section:
http://spamassassin.apache.org/full/3.1.x/doc/Mail_SpamAssassin_Conf.html#administrator_settings


That said, are you sure you edited the correct user_prefs file in the
right home directory?

Spamd doesn't parse the To: header of email. Left to its own devices,
spamd bases the desired user_prefs by setuiding itself to the same
userid that invokes spamc.

Odds are if you're calling spamc from postfix, and haven't done anything
special, spamd is scanning mail using "postfix" as the user, so you'd
have to edit the user_prefs in whatever home directory the postfix user
has. This userid would effectively be used for all your mail, regardless
of recipient.

I can't really help you with postfix myself, as I know nothing about
postfix other than it's yet another MTA, but I can tell you that if you
want different user_prefs to be used, you either need to call spamc from
a process executing as that user, or you need to pass this information
after the -u parameter to spamc.