You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Peter Teunissen <li...@onemanifest.net> on 2006/09/26 21:13:56 UTC

can't get Bayesian to work when invoked from postfix

Hi All,


After having trained SA with sufficient amounts of ham & spam, I have  
bayesian testing working. When I test it with spamassassin -D <  
testmessage as root it works flawlessly. But, when postfix invokes  
spamc with user filter, bayes always fails.

I tested this by running spamassassing -D < tesmessage as user filter  
and saw some permission errors as shown in the debug output at the  
end of this mail.

I see two things going wrong:
1. it tries to create userprefs for filter, not lethal I guess. How  
can I keep SA from doing this when invoked from postfix? I use it  
system wide, so no user prefs are needed. There's no option for spamc  
mentioned in the manpage to make it run system wide only. At the  
moment is is invoked as

spamassassin
           unix  -       n       n       -       -       pipe
   user=filter argv=/usr/bin/spamc -f -e /usr/sbin/sendmail -oi -f $ 
{sender} ${recipient}

2. More seriously, it cannot access /var/spool/spamassassin, so it  
can't use the  bayes DB or the whitelist. But this directory is world  
readable and writable:

mrblue:/home/oneman# ls -lh /var/spool/spamassassin/
total 4.6M
-rw-rw-rw-  1 root root  12K 2006-09-26 20:07 auto-whitelist
-rw-rw-rw-  1 root root 5.1K 2006-09-26 20:07 bayes_journal
-rw-rw-rw-  1 root root 632K 2006-09-26 20:07 bayes_seen
-rw-rw-rw-  1 root root 5.2M 2006-09-26 20:07 bayes_toks

I'm probably missing the obvious, but can someone point out to me  
what to change so filter can access /var/spool/spamassassin ?


TIA

Peter

============ Output of spamassassin debug =============

mrblue:#su filter
filter@mrblue:$spamassassin -D < testmsg

<snip>

debug: using "/dev/null/.spamassassin" for user state dir
debug: mkdir /dev/null/.spamassassin failed: mkdir /dev/null: File  
exists at /usr/share/perl5/Mail/SpamAssassin.pm line 1453
File exists

<snip>

Cannot write to /dev/null/.spamassassin/user_prefs: Not a directory
Failed to create default user preference file /dev/null/.spamassassin/ 
user_prefs
debug: using "/dev/null/.spamassassin/user_prefs" for user prefs file
<snip>
debug: bayes: no dbs present, cannot tie DB R/O: /var/spool/ 
spamassassin/bayes_toks
debug: Score set 1 chosen.
debug: bayes: no dbs present, cannot tie DB R/O: /var/spool/ 
spamassassin/bayes_toks
<snip>
debug: open of AWL file failed: lock: 27966 cannot create tmp  
lockfile /var/spool/spamassassin/auto-whitelist.lock.mrblue.27966  
for /var/spool/spamassassin/auto-whitelist.lock: Permission denied
<snip>
debug: auto-learning failed: lock: 27966 cannot create tmp lockfile / 
var/spool/spamassassin/bayes.lock.mrblue.27966 for /var/spool/ 
spamassassin/bayes.lock: Permission denied

<snip>



Re: can't get Bayesian to work when invoked from postfix - SOLVED

Posted by Peter Teunissen <li...@onemanifest.net>.
Hi All,

With the great help of Michel Valliancourt I managed to solve my  
bayesian problem. Solution, for the archives, is below

On 26-sep-2006, at 21:13, Peter Teunissen wrote:

>
> After having trained SA with sufficient amounts of ham & spam, I  
> have bayesian testing working. When I test it with spamassassin -D  
> < testmessage as root it works flawlessly. But, when postfix  
> invokes spamc with user filter, bayes always fails.
>
> I tested this by running spamassassing -D < tesmessage as user  
> filter and saw some permission errors as shown in the debug output  
> at the end of this mail.
>
> I see two things going wrong:
> 1. it tries to create userprefs for filter, not lethal I guess. How  
> can I keep SA from doing this when invoked from postfix? I use it  
> system wide, so no user prefs are needed. There's no option for  
> spamc mentioned in the manpage to make it run system wide only.

Turned out that since I created the user filter spamd runs as with / 
dev/null for a home folder. Changed that to the directory where my  
bayes db resides. Problem 1 solved.

> 2. More seriously, it cannot access /var/spool/spamassassin, so it  
> can't use the  bayes DB or the whitelist. But this directory is  
> world readable and writable:
>
I had, due to a lack of knowledge on unix file permissions, not made  
the directory accesible to the user SA runs at; it could read and  
write the dir, but not execute. I changed the directory so it is  
owned by user filter and chmoded it to 0755. The contents are also  
owned by filter and chmoded to 0660.

Eh voila, bayesian works.

Thanks Michel!



Peter