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 Pluta <pe...@placidpublishing.net> on 2007/06/10 08:17:59 UTC

mySQL bayes not working correctly

I'm running amavisd-new with spamassassin and setup bayes and mysql earlier
today. It seems to connect to the db fine with user vscan when running
spamassassin -d. I ran sa-learn --spam/ham < spam.txt (full email headers
too) a few times and those are the only entires in the db, the ones that I
added, all other email is untouched. What's the deal? Here is my local.cf
file... awl seems to work fine, but it scores mail funky sometimes. 

# Enable the Bayes system
use_bayes 1
bayes_store_module                Mail::SpamAssassin::BayesStore::SQL
bayes_sql_dsn                     DBI:mysql:bayes
bayes_sql_username                vscan
bayes_sql_password                vscan
bayes_sql_override_username       vscan

# Enable awl
auto_whitelist_factory            Mail::SpamAssassin::SQLBasedAddrList
user_awl_dsn                      DBI:mysql:bayes
user_awl_sql_username             vscan
user_awl_sql_password             vscan

-- 
View this message in context: http://www.nabble.com/mySQL-bayes-not-working-correctly-tf3896467.html#a11046183
Sent from the SpamAssassin - Users mailing list archive at Nabble.com.


RE: mySQL bayes not working correctly

Posted by Gary V <mr...@hotmail.com>.
> > I would run
> > amavisd stop
> > amavisd -d bayes debug-sa
> >
> > then send a message containing the gtube string through it. Send the
> > message
> > from the outside world (smtp), not from the local machine. See what
> > amavisd-new thinks of Bayes.
> >

>I will try that, what exactly is the "gtube" string?

This is the first link Goole produced:

http://spamassassin.apache.org/gtube/

_________________________________________________________________
Get a preview of Live Earth, the hottest event this summer - only on MSN 
http://liveearth.msn.com?source=msntaglineliveearthhm


RE: mySQL bayes not working correctly

Posted by Peter Pluta <pe...@placidpublishing.net>.


Gary V-2 wrote:
> 
>>Gary V-2 wrote:
>> >
>> >>I'm running amavisd-new with spamassassin and setup bayes and mysql
>>earlier
>> >>today. It seems to connect to the db fine with user vscan when running
>> >>spamassassin -d. I ran sa-learn --spam/ham < spam.txt (full email 
>>headers
>> >>too) a few times and those are the only entires in the db, the ones
>> that 
>>I
>> >>added, all other email is untouched. What's the deal? Here is my 
>>local.cf
>> >>file... awl seems to work fine, but it scores mail funky sometimes.
>> >>
>> >># Enable the Bayes system
>> >>use_bayes 1
>> >>bayes_store_module                Mail::SpamAssassin::BayesStore::SQL
>> >>bayes_sql_dsn                     DBI:mysql:bayes
>> >>bayes_sql_username                vscan
>> >>bayes_sql_password                vscan
>> >>bayes_sql_override_username       vscan
>> >>
>> >># Enable awl
>> >>auto_whitelist_factory            Mail::SpamAssassin::SQLBasedAddrList
>> >>user_awl_dsn                      DBI:mysql:bayes
>> >>user_awl_sql_username             vscan
>> >>user_awl_sql_password             vscan
>> >>
>> >>--
>> >
>> > You probably ran the commands as root, so you are only looking at
>> root's
>> > data. Add this in local.cf:
>> >
>> > bayes_sql_override_username vscan
>> >
>> > That way everyone will see the same data (site wide configuration). You
>> > want
>> > to always run spamassassin and sa-learn commands as the vscan user but
>> > adding this seting means that even if you learn spam or ham as root,
>> > vscan's
>> > data will be updated.
>> >
>> > su vscan -c 'sa-learn --spam < spam.txt'
>> >
>> > Gary V
>>
> 
>>The command was run as user vscan (amavisd-new user and spamassassin
user).
>>If you look closer you will see that my config already has that directive.
>>
> 
> Indeed, I missed it.
> 
> Not related, but if running MySQL 4.1 or newer, change:
> Mail::SpamAssassin::BayesStore::SQL
> to
> Mail::SpamAssassin::BayesStore::MySQL
> 
> I would run
> amavisd stop
> amavisd -d bayes debug-sa
> 
> then send a message containing the gtube string through it. Send the
> message 
> from the outside world (smtp), not from the local machine. See what 
> amavisd-new thinks of Bayes.
> 
> Gary V
> 
> _________________________________________________________________
> Get a preview of Live Earth, the hottest event this summer - only on MSN 
> http://liveearth.msn.com?source=msntaglineliveearthhm
> 
> 
> 

I will try that, what exactly is the "gtube" string?
-- 
View this message in context: http://www.nabble.com/mySQL-bayes-not-working-correctly-tf3896467.html#a11049840
Sent from the SpamAssassin - Users mailing list archive at Nabble.com.


RE: mySQL bayes not working correctly

Posted by Gary V <mr...@hotmail.com>.
>Gary V-2 wrote:
> >
> >>I'm running amavisd-new with spamassassin and setup bayes and mysql
>earlier
> >>today. It seems to connect to the db fine with user vscan when running
> >>spamassassin -d. I ran sa-learn --spam/ham < spam.txt (full email 
>headers
> >>too) a few times and those are the only entires in the db, the ones that 
>I
> >>added, all other email is untouched. What's the deal? Here is my 
>local.cf
> >>file... awl seems to work fine, but it scores mail funky sometimes.
> >>
> >># Enable the Bayes system
> >>use_bayes 1
> >>bayes_store_module                Mail::SpamAssassin::BayesStore::SQL
> >>bayes_sql_dsn                     DBI:mysql:bayes
> >>bayes_sql_username                vscan
> >>bayes_sql_password                vscan
> >>bayes_sql_override_username       vscan
> >>
> >># Enable awl
> >>auto_whitelist_factory            Mail::SpamAssassin::SQLBasedAddrList
> >>user_awl_dsn                      DBI:mysql:bayes
> >>user_awl_sql_username             vscan
> >>user_awl_sql_password             vscan
> >>
> >>--
> >
> > You probably ran the commands as root, so you are only looking at root's
> > data. Add this in local.cf:
> >
> > bayes_sql_override_username vscan
> >
> > That way everyone will see the same data (site wide configuration). You
> > want
> > to always run spamassassin and sa-learn commands as the vscan user but
> > adding this seting means that even if you learn spam or ham as root,
> > vscan's
> > data will be updated.
> >
> > su vscan -c 'sa-learn --spam < spam.txt'
> >
> > Gary V
>

>The command was run as user vscan (amavisd-new user and spamassassin user).
>If you look closer you will see that my config already has that directive.
>

Indeed, I missed it.

Not related, but if running MySQL 4.1 or newer, change:
Mail::SpamAssassin::BayesStore::SQL
to
Mail::SpamAssassin::BayesStore::MySQL

I would run
amavisd stop
amavisd -d bayes debug-sa

then send a message containing the gtube string through it. Send the message 
from the outside world (smtp), not from the local machine. See what 
amavisd-new thinks of Bayes.

Gary V

_________________________________________________________________
Get a preview of Live Earth, the hottest event this summer - only on MSN 
http://liveearth.msn.com?source=msntaglineliveearthhm


RE: mySQL bayes not working correctly

Posted by Peter Pluta <pe...@placidpublishing.net>.

Gary V-2 wrote:
> 
>>I'm running amavisd-new with spamassassin and setup bayes and mysql
earlier
>>today. It seems to connect to the db fine with user vscan when running
>>spamassassin -d. I ran sa-learn --spam/ham < spam.txt (full email headers
>>too) a few times and those are the only entires in the db, the ones that I
>>added, all other email is untouched. What's the deal? Here is my local.cf
>>file... awl seems to work fine, but it scores mail funky sometimes.
>>
>># Enable the Bayes system
>>use_bayes 1
>>bayes_store_module                Mail::SpamAssassin::BayesStore::SQL
>>bayes_sql_dsn                     DBI:mysql:bayes
>>bayes_sql_username                vscan
>>bayes_sql_password                vscan
>>bayes_sql_override_username       vscan
>>
>># Enable awl
>>auto_whitelist_factory            Mail::SpamAssassin::SQLBasedAddrList
>>user_awl_dsn                      DBI:mysql:bayes
>>user_awl_sql_username             vscan
>>user_awl_sql_password             vscan
>>
>>--
> 
> You probably ran the commands as root, so you are only looking at root's 
> data. Add this in local.cf:
> 
> bayes_sql_override_username vscan
> 
> That way everyone will see the same data (site wide configuration). You
> want 
> to always run spamassassin and sa-learn commands as the vscan user but 
> adding this seting means that even if you learn spam or ham as root,
> vscan's 
> data will be updated.
> 
> su vscan -c 'sa-learn --spam < spam.txt'
> 
> Gary V
> 
> _________________________________________________________________
> PC Magazine’s 2007 editors’ choice for best Web mail—award-winning Windows 
> Live Hotmail. 
> http://imagine-windowslive.com/hotmail/?locale=en-us&ocid=TXT_TAGHM_migration_HM_mini_pcmag_0507
> 
> 
> 

The command was run as user vscan (amavisd-new user and spamassassin user).
If you look closer you will see that my config already has that directive. 

-- 
View this message in context: http://www.nabble.com/mySQL-bayes-not-working-correctly-tf3896467.html#a11049679
Sent from the SpamAssassin - Users mailing list archive at Nabble.com.


Re: mySQL bayes not working correctly

Posted by Peter Pluta <pe...@placidpublishing.net>.

Steven Stern wrote:
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Gary V wrote:
>>> I'm running amavisd-new with spamassassin and setup bayes and mysql
>>> earlier
>>> today. It seems to connect to the db fine with user vscan when running
>>> spamassassin -d. I ran sa-learn --spam/ham < spam.txt (full email
>>> headers
>>> too) a few times and those are the only entires in the db, the ones
>>> that I
>>> added, all other email is untouched. What's the deal? Here is my
>>> local.cf
>>> file... awl seems to work fine, but it scores mail funky sometimes.
>>>
>>> # Enable the Bayes system
>>> use_bayes 1
>>> bayes_store_module                Mail::SpamAssassin::BayesStore::SQL
>>> bayes_sql_dsn                     DBI:mysql:bayes
>>> bayes_sql_username                vscan
>>> bayes_sql_password                vscan
>>> bayes_sql_override_username       vscan
>>>
>>> # Enable awl
>>> auto_whitelist_factory            Mail::SpamAssassin::SQLBasedAddrList
>>> user_awl_dsn                      DBI:mysql:bayes
>>> user_awl_sql_username             vscan
>>> user_awl_sql_password             vscan
>>>
>>> -- 
>> 
>> You probably ran the commands as root, so you are only looking at root's
>> data. Add this in local.cf:
>> 
>> bayes_sql_override_username vscan
>> 
>> That way everyone will see the same data (site wide configuration). You
>> want to always run spamassassin and sa-learn commands as the vscan user
>> but adding this seting means that even if you learn spam or ham as root,
>> vscan's data will be updated.
>> 
>> su vscan -c 'sa-learn --spam < spam.txt'
>> 
>> Gary V
> 
> 
> As for the funky AWL values, you need to do some AWL expiry.
> 
> Add a field to the AWL table that shows the last time that address got
> hit:
>   ALTER TABLE awl ADD lastupdate timestamp(14) NOT NULL;
>   UPDATE awl SET lastupdate = NOW( ) WHERE lastupdate < 1;
> 
> Then set up a script to clean up awl entries:
> 
>   /usr/bin/mysql -usa_user -psa_user_psw < /usr/local/bin/trim-awl.sql
> 
>   USE sa_bayes;
>   DELETE FROM awl WHERE lastupdate <= DATE_SUB(SYSDATE(), INTERVAL 2
> MONTH);
>   DELETE FROM awl WHERE count = 1 AND lastupdate <= DATE_SUB(SYSDATE(),
>    INTERVAL 15 DAY);
> 
> (reference: http://www200.pair.com/mecham/spam/fc4-spamassassin-sql.html)
> - --
> 
>   Steve
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.7 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iD4DBQFGbBlSeERILVgMyvARAuQ4AJjmzxS8+XmQwclH1/2alQlx+slUAJ9m/EpM
> M+0aSAR00llWR5ROGdp/kw==
> =H68i
> -----END PGP SIGNATURE-----
> 
> 

I see, I will take a look. I figured spamassassin did all the work for me,
guess not. 
-- 
View this message in context: http://www.nabble.com/mySQL-bayes-not-working-correctly-tf3896467.html#a11049848
Sent from the SpamAssassin - Users mailing list archive at Nabble.com.


Re: mySQL bayes not working correctly

Posted by Steven Stern <su...@sterndata.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Gary V wrote:
>> I'm running amavisd-new with spamassassin and setup bayes and mysql
>> earlier
>> today. It seems to connect to the db fine with user vscan when running
>> spamassassin -d. I ran sa-learn --spam/ham < spam.txt (full email headers
>> too) a few times and those are the only entires in the db, the ones
>> that I
>> added, all other email is untouched. What's the deal? Here is my local.cf
>> file... awl seems to work fine, but it scores mail funky sometimes.
>>
>> # Enable the Bayes system
>> use_bayes 1
>> bayes_store_module                Mail::SpamAssassin::BayesStore::SQL
>> bayes_sql_dsn                     DBI:mysql:bayes
>> bayes_sql_username                vscan
>> bayes_sql_password                vscan
>> bayes_sql_override_username       vscan
>>
>> # Enable awl
>> auto_whitelist_factory            Mail::SpamAssassin::SQLBasedAddrList
>> user_awl_dsn                      DBI:mysql:bayes
>> user_awl_sql_username             vscan
>> user_awl_sql_password             vscan
>>
>> -- 
> 
> You probably ran the commands as root, so you are only looking at root's
> data. Add this in local.cf:
> 
> bayes_sql_override_username vscan
> 
> That way everyone will see the same data (site wide configuration). You
> want to always run spamassassin and sa-learn commands as the vscan user
> but adding this seting means that even if you learn spam or ham as root,
> vscan's data will be updated.
> 
> su vscan -c 'sa-learn --spam < spam.txt'
> 
> Gary V


As for the funky AWL values, you need to do some AWL expiry.

Add a field to the AWL table that shows the last time that address got hit:
  ALTER TABLE awl ADD lastupdate timestamp(14) NOT NULL;
  UPDATE awl SET lastupdate = NOW( ) WHERE lastupdate < 1;

Then set up a script to clean up awl entries:

  /usr/bin/mysql -usa_user -psa_user_psw < /usr/local/bin/trim-awl.sql

  USE sa_bayes;
  DELETE FROM awl WHERE lastupdate <= DATE_SUB(SYSDATE(), INTERVAL 2 MONTH);
  DELETE FROM awl WHERE count = 1 AND lastupdate <= DATE_SUB(SYSDATE(),
   INTERVAL 15 DAY);

(reference: http://www200.pair.com/mecham/spam/fc4-spamassassin-sql.html)
- --

  Steve
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD4DBQFGbBlSeERILVgMyvARAuQ4AJjmzxS8+XmQwclH1/2alQlx+slUAJ9m/EpM
M+0aSAR00llWR5ROGdp/kw==
=H68i
-----END PGP SIGNATURE-----

RE: mySQL bayes not working correctly

Posted by Gary V <mr...@hotmail.com>.
>I'm running amavisd-new with spamassassin and setup bayes and mysql earlier
>today. It seems to connect to the db fine with user vscan when running
>spamassassin -d. I ran sa-learn --spam/ham < spam.txt (full email headers
>too) a few times and those are the only entires in the db, the ones that I
>added, all other email is untouched. What's the deal? Here is my local.cf
>file... awl seems to work fine, but it scores mail funky sometimes.
>
># Enable the Bayes system
>use_bayes 1
>bayes_store_module                Mail::SpamAssassin::BayesStore::SQL
>bayes_sql_dsn                     DBI:mysql:bayes
>bayes_sql_username                vscan
>bayes_sql_password                vscan
>bayes_sql_override_username       vscan
>
># Enable awl
>auto_whitelist_factory            Mail::SpamAssassin::SQLBasedAddrList
>user_awl_dsn                      DBI:mysql:bayes
>user_awl_sql_username             vscan
>user_awl_sql_password             vscan
>
>--

You probably ran the commands as root, so you are only looking at root's 
data. Add this in local.cf:

bayes_sql_override_username vscan

That way everyone will see the same data (site wide configuration). You want 
to always run spamassassin and sa-learn commands as the vscan user but 
adding this seting means that even if you learn spam or ham as root, vscan's 
data will be updated.

su vscan -c 'sa-learn --spam < spam.txt'

Gary V

_________________________________________________________________
PC Magazine’s 2007 editors’ choice for best Web mail—award-winning Windows 
Live Hotmail. 
http://imagine-windowslive.com/hotmail/?locale=en-us&ocid=TXT_TAGHM_migration_HM_mini_pcmag_0507