You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Hungry Snail <ce...@hotmail.com> on 2008/03/13 02:13:40 UTC

sa-learn question

Hi Guys,

I am using spam/notspam via Squirrelmail

If I mark an email as spam squirrelmail send this command.
COMMAND USED TO REPORT: /usr/bin/sa-learn --spam
--configpath=/etc/mail/spamassassin --showdots <
/var/spool/squirrelmail/attach//sb_tmp_174_1205370641

The result I get is..
[0] => Learned tokens from 0 message(s) (1 message(s) examined)

Does the result look correct? I was just wondering why is has 0 learned
tokens from 0 messages.

Regards
-- 
View this message in context: http://www.nabble.com/sa-learn-question-tp16019261p16019261.html
Sent from the SpamAssassin - Users mailing list archive at Nabble.com.


Re: sa-learn question

Posted by Matt Kettler <mk...@verizon.net>.
Hungry Snail wrote:
> Hi Guys,
>
> I am using spam/notspam via Squirrelmail
>
> If I mark an email as spam squirrelmail send this command.
> COMMAND USED TO REPORT: /usr/bin/sa-learn --spam
> --configpath=/etc/mail/spamassassin --showdots <
> /var/spool/squirrelmail/attach//sb_tmp_174_1205370641
>
> The result I get is..
> [0] => Learned tokens from 0 message(s) (1 message(s) examined)
>
> Does the result look correct? I was just wondering why is has 0 learned
> tokens from 0 messages.
>   
That generally suggests the message was already learned as spam, 
therefore no action was needed for the 1 message it examined, and no 
learning was performed.


Re: sa-learn question

Posted by Hungry Snail <ce...@hotmail.com>.


Matt Kettler-3 wrote:
> 
> previously it had several bits of bad advice:
> Don't /etc/mail/spamassassin to store your bayes DB
> Don't specify -C on  the sa-learn command-line. You REALLY don't want to 
> use that option on any SA tool unless you know exactly what you're 
> doing. (This option is really mostly for testers and developers.)
> Use init scripts to restart spamd
> 

Thanks for all your advice Matt, much appreciated.
-- 
View this message in context: http://www.nabble.com/sa-learn-question-tp16019261p16025291.html
Sent from the SpamAssassin - Users mailing list archive at Nabble.com.


Re: sa-learn question

Posted by Matt Kettler <mk...@verizon.net>.
Matt Kettler wrote:
> Hungry Snail wrote:
>> Site-wide is what i'm trying to setup, I guess i need to do some more
>> googling :)
>>   
Also, I've updated the wiki article on sitewide bayes. It is now at 
least technically correct.

http://wiki.apache.org/spamassassin/SiteWideBayesSetup

previously it had several bits of bad advice:
Don't /etc/mail/spamassassin to store your bayes DB
Don't specify -C on  the sa-learn command-line. You REALLY don't want to 
use that option on any SA tool unless you know exactly what you're 
doing. (This option is really mostly for testers and developers.)
Use init scripts to restart spamd





Re: sa-learn question

Posted by Matt Kettler <mk...@verizon.net>.
Hungry Snail wrote:
> Site-wide is what i'm trying to setup, I guess i need to do some more
> googling :)
>   

assuming you're using db_file not SQL:

First create a path where you want your bayes DB to live, make that 
directory world RWX. (ie: chmod 0777)

in your /etc/mail/spamassassin/local.cf:

bayes_path <your directory>/bayes
bayes_file_mode 0777

Gotchas people often run into:

1) DO NOT use that directory for anything else. If there are any other 
files starting with "bayes_" it will screw up the file locking.
2) bayes_path doesn't actually specify a path, it's a path plus partial 
filename. You NEED the extra /bayes on the end, this is part of the 
filenames being used by SA to create it's database files. SA will append 
_seen, _toks, etc as needed to create bayes_seen (seen message 
database), bayes_toks (token database).
3) Yes the mode needs to be 0777 not 0666, as it is sometimes used in 
creating directories. Really, bayes_mode is a mask, not an explicit 
mode. It will not create it's db files with the X bit, even if this is 
set to 0777.






Re: sa-learn question

Posted by Hungry Snail <ce...@hotmail.com>.
Site-wide is what i'm trying to setup, I guess i need to do some more
googling :)
-- 
View this message in context: http://www.nabble.com/sa-learn-question-tp16019261p16020836.html
Sent from the SpamAssassin - Users mailing list archive at Nabble.com.


Re: sa-learn question

Posted by Matt Kettler <mk...@verizon.net>.
Hungry Snail wrote:
>
> Matt Kettler-3 wrote:
>   
>> Did you run it as the same user as the sa-learn?  
>> You might want to try the sa-learn again with -D to see what the 
>> debugging has to say.
>>
>>     
>
> Bah, it works fine if I issue the command via the ssh.
>
> sa-learn --spam --configpath=/etc/mail/spamassassin --showdots
> </var/vmail/mydomain.tld/user/cur/1205274708.P15843Q0M957724.host:2,
> .
> Learned tokens from 1 message(s) (1 message(s) examined)
>
> My issues seem to be relating to squirrelmail issuing the command when I
> click the spam button, I wonder if it is trying to issue the command via the
> www-data user.
>   
Quite likely.

Regardless, unless you've got a site-wide single bayes db, it needs to 
run as whatever user gets used when email comes in, which may not be the 
same as the recipient..



Re: sa-learn question

Posted by Hungry Snail <ce...@hotmail.com>.


Matt Kettler-3 wrote:
> 
> Did you run it as the same user as the sa-learn?  
> You might want to try the sa-learn again with -D to see what the 
> debugging has to say.
> 

Bah, it works fine if I issue the command via the ssh.

sa-learn --spam --configpath=/etc/mail/spamassassin --showdots
</var/vmail/mydomain.tld/user/cur/1205274708.P15843Q0M957724.host:2,
.
Learned tokens from 1 message(s) (1 message(s) examined)

My issues seem to be relating to squirrelmail issuing the command when I
click the spam button, I wonder if it is trying to issue the command via the
www-data user.
-- 
View this message in context: http://www.nabble.com/sa-learn-question-tp16019261p16020246.html
Sent from the SpamAssassin - Users mailing list archive at Nabble.com.


Re: sa-learn question

Posted by Matt Kettler <mk...@verizon.net>.
Hungry Snail wrote:
>
> Hungry Snail wrote:
>   
>> Hi Guys,
>>
>> I am using spam/notspam via Squirrelmail
>>
>> If I mark an email as spam squirrelmail send this command.
>> COMMAND USED TO REPORT: /usr/bin/sa-learn --spam
>> --configpath=/etc/mail/spamassassin --showdots <
>> /var/spool/squirrelmail/attach//sb_tmp_174_1205370641
>>
>> The result I get is..
>> [0] => Learned tokens from 0 message(s) (1 message(s) examined)
>>
>> Does the result look correct? I was just wondering why is has 0 learned
>> tokens from 0 messages.
>>
>> Regards
>>
>>     
>
> Thats what I thought, but I forwarded the message to myself and it didnt get
> flagged as spam, it was also a message that was received before spamassassin
> was setup.
>   
Why would forwarding a message to yourself be a valid test?  Or do you 
mean something different like resubmitting the raw message to your mail 
queue.

Generally speaking forwarded messages generated by a mail client are 
*COMPLETELY* different than the original. New headers, new Recieved 
path, new body encoding, possibly removal of text/plain section of a 
multipart alternative message, probably new linewrapping..... Forwarding 
doesn't forward the same message. It forwards some rendering of the text 
parts, the rest is mangled by your MUA.

try redirecting or piping the raw message to spamassassin -t, like you 
did with sa-learn.

> I did sa-learn --dump magic and this is what I got back.
>
> 0.000          0          3          0  non-token data: bayes db version
> 0.000          0          0          0  non-token data: nspam
> 0.000          0          0          0  non-token data: nham
> 0.000          0          0          0  non-token data: ntokens
> 0.000          0          0          0  non-token data: oldest atime
> 0.000          0          0          0  non-token data: newest atime
> 0.000          0          0          0  non-token data: last journal sync
> atime
> 0.000          0          0          0  non-token data: last expiry atime
> 0.000          0          0          0  non-token data: last expire atime
> delta
> 0.000          0          0          0  non-token data: last expire
> reduction count
>
> is the command im using correct? 
That's quite suspect. Did you run it as the same user as the sa-learn?  
You might want to try the sa-learn again with -D to see what the 
debugging has to say.



> I want the spam/hame rules to apply to
> everyone and not have it on a per user basis.
>
> Regards
>   


Re: sa-learn question

Posted by Hungry Snail <ce...@hotmail.com>.


Hungry Snail wrote:
> 
> Hi Guys,
> 
> I am using spam/notspam via Squirrelmail
> 
> If I mark an email as spam squirrelmail send this command.
> COMMAND USED TO REPORT: /usr/bin/sa-learn --spam
> --configpath=/etc/mail/spamassassin --showdots <
> /var/spool/squirrelmail/attach//sb_tmp_174_1205370641
> 
> The result I get is..
> [0] => Learned tokens from 0 message(s) (1 message(s) examined)
> 
> Does the result look correct? I was just wondering why is has 0 learned
> tokens from 0 messages.
> 
> Regards
> 

Thats what I thought, but I forwarded the message to myself and it didnt get
flagged as spam, it was also a message that was received before spamassassin
was setup.

I did sa-learn --dump magic and this is what I got back.

0.000          0          3          0  non-token data: bayes db version
0.000          0          0          0  non-token data: nspam
0.000          0          0          0  non-token data: nham
0.000          0          0          0  non-token data: ntokens
0.000          0          0          0  non-token data: oldest atime
0.000          0          0          0  non-token data: newest atime
0.000          0          0          0  non-token data: last journal sync
atime
0.000          0          0          0  non-token data: last expiry atime
0.000          0          0          0  non-token data: last expire atime
delta
0.000          0          0          0  non-token data: last expire
reduction count

is the command im using correct? I want the spam/hame rules to apply to
everyone and not have it on a per user basis.

Regards
-- 
View this message in context: http://www.nabble.com/sa-learn-question-tp16019261p16019763.html
Sent from the SpamAssassin - Users mailing list archive at Nabble.com.