You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Ron Johnson <ro...@cox.net> on 2010/03/04 21:36:54 UTC

user_prefs not recognized?

Hi,

I want my users (it's a small at-home setup of fetchmail, postfix, 
SA and courier-imap) to be able to whitelist certain users.

This is what my various config files look like:

     $ tail -n1 /etc/spamassassin/local.cf
     allow_user_rules        1

     $ cat ~/.spamassassin/user_prefs
     header    L_TO_ME   ToCc =~ /ron\.l\.johnson\@cox\.net/
     describe  L_TO_ME   Email addressed to me
     score     L_TO_ME   0.010
     whitelist_from  nytdirect@nytimes.com


After adding allow_user_rules to local.cf, I bounced SA by doing:
     # /etc/init.d/spamassassin restart

The L_TO_ME stuff I got from the wiki page:
     http://wiki.apache.org/spamassassin/UserPrefRuleTest

If relevant, this is Debian Sid, running v3.3.0-1

Thanks

-- 
Ron Johnson, Jr.
Jefferson LA  USA

"If God had wanted man to play soccer, he wouldn't have given
us arms."  Mike Ditka

Re: user_prefs not recognized?

Posted by Karsten Bräckelmann <gu...@rudersport.de>.
On Fri, 2010-03-05 at 11:41 -0600, Ron Johnson wrote:
> On 2010-03-04 15:41, Ron Johnson wrote:

> > spamfilter unix - n n - - pipe flags=Rq user=spamfilter \
> >                   argv=/usr/local/bin/spamfilter.sh \
> >                   -f ${sender} -- ${recipient}

> Definitely looks like SA isn't being run from the individual users's 
> accounts.

While I agree, given the above postfix conf, this is a wrong conclusion
based on the commands below.


> me@haggis:~$ spamassassin -D --lint 2> SA-debug.output.txt

You are running SA as the user 'me'. Postfix does not.

> me@haggis:~$ grep user_prefs SA-debug.output.txt
> Mar  5 11:32:48.538 [11220] dbg: config: using \
>          "/home/me/.spamassassin/user_prefs" for user prefs file

You are seeing pure DEBUG messages there. This will not be output
without the -D switch.

> root@haggis:~# spamassassin -D --lint 2> SA-debug.output.txt
> root@haggis:~# grep user_prefs SA-debug.output.txt

No ~/.spamassassin/ dir? Not created either, or maybe created for the
first time? Anyway, postfix doesn't call SA as root.


-- 
char *t="\10pse\0r\0dtu\0.@ghno\x4e\xc8\x79\xf4\xab\x51\x8a\x10\xf4\xf4\xc4";
main(){ char h,m=h=*t++,*x=t+2*h,c,i,l=*x,s=0; for (i=0;i<l;i++){ i%8? c<<=1:
(c=*++x); c&128 && (s+=h); if (!(h>>=1)||!t[s+h]){ putchar(t[s]);h=m;s=0; }}}


Re: user_prefs not recognized?

Posted by Ron Johnson <ro...@cox.net>.
On 2010-03-04 15:41, Ron Johnson wrote:
> On 2010-03-04 15:13, Karsten Bräckelmann wrote:
[snip]
> 
>> How is SA called?
> 
> (Lines manually "continued" for easy reading.)
> 
> # grep spam /etc/postfix/master.cf
> smtp      inet  n   -   n   -   -   \
>                   smtpd -o content_filter=spamfilter:
> spamfilter unix - n n - - pipe flags=Rq user=spamfilter \
>                   argv=/usr/local/bin/spamfilter.sh \
>                   -f ${sender} -- ${recipient}
> 
>>                    Are you using per-user configuration?
> 
> I think so.  But that "user=spamfilter" makes me now think otherwise.  I 
> set this up years ago, and only now care about whitelisting.

Definitely looks like SA isn't being run from the individual users's 
accounts.

me@haggis:~$ spamassassin -D --lint 2> SA-debug.output.txt
me@haggis:~$ grep user_prefs SA-debug.output.txt
Mar  5 11:32:48.538 [11220] dbg: config: using \
         "/home/me/.spamassassin/user_prefs" for user prefs file
Mar  5 11:32:48.538 [11220] dbg: config: read \
         file /home/me/.spamassassin/user_prefs

root@haggis:~# spamassassin -D --lint 2> SA-debug.output.txt
root@haggis:~# grep user_prefs SA-debug.output.txt
root@haggis:~#

-- 
Ron Johnson, Jr.
Jefferson LA  USA

"If God had wanted man to play soccer, he wouldn't have given
us arms."  Mike Ditka

Re: user_prefs not recognized?

Posted by Bowie Bailey <Bo...@BUC.com>.
Ron Johnson wrote:
>
> My wife and I don't need to white-list the same people.

But if it simplifies the configuration, is there any harm in having
everything on a global whitelist?  How often are you likely to receive
spam from someone your wife wanted whitelisted?

-- 
Bowie

Re: user_prefs not recognized?

Posted by Karsten Bräckelmann <gu...@rudersport.de>.
On Fri, 2010-03-05 at 11:19 -0600, Ron Johnson wrote:
> On 2010-03-05 10:14, Karsten Bräckelmann wrote:

> > I'd suggest to do it right from the beginning. That is, exclusively use
> > the constraint rcvd or auth whitelisting variants. Also, is there any
> > valid reason you need this to be per-user? As opposed to maintain a
> > clean whitelisting site-wide anyway.
> 
> My wife and I don't need to white-list the same people.

So what? Would you consider the same mail spam, that your wife wants to
whitelist? Splitting this across users appears to be nothing but a
maintenance overhead in such a case.

> > Also, as I previously hinted -- a *need* for whitelisting often is
> > caused by some mis-configuration or training. Whitelisting is very
> > rarely necessary. Do you really need it?
> 
> I have noticed lately (maybe after the 3.3.0 upgrade) that the 
> bayesian filter quite often thinks that ham is really 50% 
> probability spam, sometimes even 100% spam.  SA then adds a big 
> section to the email saying why it thinks the message is spam.

So your problem is a badly trained Bayes. Whitelisting is not going to
fix your real issue.


> Does sa-learn know to skip over such stuff?

sa-learn exclusively is run manually, and will learn according to what
you explicitly requested. Two things to keep in mind:

(a) Given your site-wide setup, do not run sa-learn as the recipient
user. But run it as your spamfilter user.

(b) Be careful to either train on dedicated learning mail folders only,
or after you expunged the folder. Without that expunge (compact in TB
lingo) [1], "deleted" messages in fact are not physically removed. This
results in training on messages that are believed by the user to be
removed, but in fact are not. A dirty corpus.


[1] Compact is an operation on the source folder. Emptying the Trash in
    TB will not do it. The Trash holds a *copy*.

-- 
char *t="\10pse\0r\0dtu\0.@ghno\x4e\xc8\x79\xf4\xab\x51\x8a\x10\xf4\xf4\xc4";
main(){ char h,m=h=*t++,*x=t+2*h,c,i,l=*x,s=0; for (i=0;i<l;i++){ i%8? c<<=1:
(c=*++x); c&128 && (s+=h); if (!(h>>=1)||!t[s+h]){ putchar(t[s]);h=m;s=0; }}}


Re: user_prefs not recognized?

Posted by Ron Johnson <ro...@cox.net>.
On 2010-03-05 10:14, Karsten Bräckelmann wrote:
> On Thu, 2010-03-04 at 15:41 -0600, Ron Johnson wrote:
>> On 2010-03-04 15:13, Karsten Bräckelmann wrote:
> 
[snip]
> 
>>> How is SA called?
>> (Lines manually "continued" for easy reading.)
>>
>> # grep spam /etc/postfix/master.cf
>> smtp      inet  n   -   n   -   -   \
>>                    smtpd -o content_filter=spamfilter:
>> spamfilter unix - n n - - pipe flags=Rq user=spamfilter \
>>                    argv=/usr/local/bin/spamfilter.sh \
>>                    -f ${sender} -- ${recipient}
>>
>>>                    Are you using per-user configuration?
>> I think so.  But that "user=spamfilter" makes me now think 
>> otherwise.
> 
> Hardly a postfix expert here, but I believe you are doing your spam
> filtering as the user spamfilter. Site-wide configuration, not per-user.
> The $HOME used is the one of spamfilter.

Hmmm.

> Someone correct me, if I'm wrong. :)
 >
>> I set this up years ago, and only now care about whitelisting.
> 
> I'd suggest to do it right from the beginning. That is, exclusively use
> the constraint rcvd or auth whitelisting variants. Also, is there any
> valid reason you need this to be per-user? As opposed to maintain a
> clean whitelisting site-wide anyway.

My wife and I don't need to white-list the same people.

> Also, as I previously hinted -- a *need* for whitelisting often is
> caused by some mis-configuration or training. Whitelisting is very
> rarely necessary. Do you really need it?
> 

I have noticed lately (maybe after the 3.3.0 upgrade) that the 
bayesian filter quite often thinks that ham is really 50% 
probability spam, sometimes even 100% spam.  SA then adds a big 
section to the email saying why it thinks the message is spam.

Does sa-learn know to skip over such stuff?

-- 
Ron Johnson, Jr.
Jefferson LA  USA

"If God had wanted man to play soccer, he wouldn't have given
us arms."  Mike Ditka

Re: user_prefs not recognized?

Posted by Karsten Bräckelmann <gu...@rudersport.de>.
On Thu, 2010-03-04 at 15:41 -0600, Ron Johnson wrote:
> On 2010-03-04 15:13, Karsten Bräckelmann wrote:

> > On a related note, the plain whitelist_from without a rcvd or auth
> > constraint is dangerous to use. If possible, always use the constraint
> > ones, and the plain one strictly as a fall-back if there is no other
> > possibility -- and you really need the whitelist. In almost all cases,
> > you don't, and the real problem (if any) goes by unnoticed.
> 
> Right.  I wanted to get the "simple stuff" working first; then the 
> more complicated configurations.

> > How is SA called?
> 
> (Lines manually "continued" for easy reading.)
> 
> # grep spam /etc/postfix/master.cf
> smtp      inet  n   -   n   -   -   \
>                    smtpd -o content_filter=spamfilter:
> spamfilter unix - n n - - pipe flags=Rq user=spamfilter \
>                    argv=/usr/local/bin/spamfilter.sh \
>                    -f ${sender} -- ${recipient}
> 
> >                    Are you using per-user configuration?
> 
> I think so.  But that "user=spamfilter" makes me now think 
> otherwise.

Hardly a postfix expert here, but I believe you are doing your spam
filtering as the user spamfilter. Site-wide configuration, not per-user.
The $HOME used is the one of spamfilter.

Someone correct me, if I'm wrong. :)

> I set this up years ago, and only now care about whitelisting.

I'd suggest to do it right from the beginning. That is, exclusively use
the constraint rcvd or auth whitelisting variants. Also, is there any
valid reason you need this to be per-user? As opposed to maintain a
clean whitelisting site-wide anyway.

Also, as I previously hinted -- a *need* for whitelisting often is
caused by some mis-configuration or training. Whitelisting is very
rarely necessary. Do you really need it?

  guenther


-- 
char *t="\10pse\0r\0dtu\0.@ghno\x4e\xc8\x79\xf4\xab\x51\x8a\x10\xf4\xf4\xc4";
main(){ char h,m=h=*t++,*x=t+2*h,c,i,l=*x,s=0; for (i=0;i<l;i++){ i%8? c<<=1:
(c=*++x); c&128 && (s+=h); if (!(h>>=1)||!t[s+h]){ putchar(t[s]);h=m;s=0; }}}


Re: user_prefs not recognized?

Posted by Ron Johnson <ro...@cox.net>.
On 2010-03-04 15:13, Karsten Bräckelmann wrote:
> On Thu, 2010-03-04 at 14:36 -0600, Ron Johnson wrote:
>> I want my users (it's a small at-home setup of fetchmail, postfix, 
>> SA and courier-imap) to be able to whitelist certain users.
> 
> You do *not* need allow_user_rules, to enable per-user whitelist_* or
> blacklist_* settings.
> 
> See the docs [1], and pay special attention to the first sentence in the
> User Preferences section. Also note that Whitelist and Blacklist Options
> is a sub-section of this. :)
> 

Already read this:
     full/3.3.x/doc/Mail_SpamAssassin_Conf.html#user_preferences

> On a related note, the plain whitelist_from without a rcvd or auth
> constraint is dangerous to use. If possible, always use the constraint
> ones, and the plain one strictly as a fall-back if there is no other
> possibility -- and you really need the whitelist. In almost all cases,
> you don't, and the real problem (if any) goes by unnoticed.

Right.  I wanted to get the "simple stuff" working first; then the 
more complicated configurations.

> 
>> This is what my various config files look like:
>>
>>      $ tail -n1 /etc/spamassassin/local.cf
>>      allow_user_rules        1
>>
>>      $ cat ~/.spamassassin/user_prefs
>>      header    L_TO_ME   ToCc =~ /ron\.l\.johnson\@cox\.net/
>>      describe  L_TO_ME   Email addressed to me
>>      score     L_TO_ME   0.010
> 
> For this, you need allow_user_rules 1.
> 
>>      whitelist_from  nytdirect@nytimes.com
> 
> For this, you don't.

OK.

> However, you did *not* show any evidence, headers, or whatever, that the
> L_TO_ME user rule does not work...

In Thunderbird View->"Message Source", I searched for L_TO_ME.

Am I fundamentally *wrong* about something here?

> How is SA called?

(Lines manually "continued" for easy reading.)

# grep spam /etc/postfix/master.cf
smtp      inet  n   -   n   -   -   \
                   smtpd -o content_filter=spamfilter:
spamfilter unix - n n - - pipe flags=Rq user=spamfilter \
                   argv=/usr/local/bin/spamfilter.sh \
                   -f ${sender} -- ${recipient}

>                    Are you using per-user configuration?

I think so.  But that "user=spamfilter" makes me now think 
otherwise.  I set this up years ago, and only now care about 
whitelisting.

> [1] http://spamassassin.apache.org/full/3.2.x/doc/Mail_SpamAssassin_Conf.html
> 


-- 
Ron Johnson, Jr.
Jefferson LA  USA

"If God had wanted man to play soccer, he wouldn't have given
us arms."  Mike Ditka

Re: user_prefs not recognized?

Posted by Karsten Bräckelmann <gu...@rudersport.de>.
On Thu, 2010-03-04 at 14:36 -0600, Ron Johnson wrote:
> I want my users (it's a small at-home setup of fetchmail, postfix, 
> SA and courier-imap) to be able to whitelist certain users.

You do *not* need allow_user_rules, to enable per-user whitelist_* or
blacklist_* settings.

See the docs [1], and pay special attention to the first sentence in the
User Preferences section. Also note that Whitelist and Blacklist Options
is a sub-section of this. :)


On a related note, the plain whitelist_from without a rcvd or auth
constraint is dangerous to use. If possible, always use the constraint
ones, and the plain one strictly as a fall-back if there is no other
possibility -- and you really need the whitelist. In almost all cases,
you don't, and the real problem (if any) goes by unnoticed.


> This is what my various config files look like:
> 
>      $ tail -n1 /etc/spamassassin/local.cf
>      allow_user_rules        1
> 
>      $ cat ~/.spamassassin/user_prefs
>      header    L_TO_ME   ToCc =~ /ron\.l\.johnson\@cox\.net/
>      describe  L_TO_ME   Email addressed to me
>      score     L_TO_ME   0.010

For this, you need allow_user_rules 1.

>      whitelist_from  nytdirect@nytimes.com

For this, you don't.

However, you did *not* show any evidence, headers, or whatever, that the
L_TO_ME user rule does not work...

How is SA called? Are you using per-user configuration?


[1] http://spamassassin.apache.org/full/3.2.x/doc/Mail_SpamAssassin_Conf.html

-- 
char *t="\10pse\0r\0dtu\0.@ghno\x4e\xc8\x79\xf4\xab\x51\x8a\x10\xf4\xf4\xc4";
main(){ char h,m=h=*t++,*x=t+2*h,c,i,l=*x,s=0; for (i=0;i<l;i++){ i%8? c<<=1:
(c=*++x); c&128 && (s+=h); if (!(h>>=1)||!t[s+h]){ putchar(t[s]);h=m;s=0; }}}