Re: Learn Ham/Spam to more than Bayes DB

2007-10-14 Thread Magnus Anderson



Michael Parker wrote:
> 
> Magnus Anderson wrote:
>> Hi,
>> 
>> I have a script that runs every night with sa-learn to learn new ham/spam
>> messages for every user.
>> I do this with running these commands
>> 
>> /usr/bin/sa-learn --ham --no-sync -u {$_array['sa_user']}
>> {$_dir['inbox']}
>> /usr/bin/sa-learn --ham --no-sync -u {$_array['sa_user']} {$_dir['ham']}
>> /usr/bin/sa-learn --spam --no-sync -u {$_array['sa_user']}
>> {$_dir['spam']}
>> 
>> These mail boxes are in mbox format. I also rely on -u for overriding the
>> username, as I use Bayes and AWL in MySQL for eatch username. 
>> 
>> The problem now is though that I want to report ham/spam to more than
>> just
>> my Bayes DB if users want to do that. I want to report spam to
>> Pyzor,Razor,Dcc and SpamCop.
>> 
>> But sa-learn doesn't support this. Does anyone have an idea on how to
>> make
>> this work?
> 
> spamassassin -r does what you want, but there is no way to specify the
> username on the command line.  You could write a script using the SA API.
> 
> Michael
> 
> 
That's what I would like to avoid. I think it's silly they made the option
to pass a username to the sa-learn command, but not to the spamassassin
command.

Someone sudjested to use spamc/spamd, but it has no option to pass a mbox
command to it, so I can't use that one either.
-- 
View this message in context: 
http://www.nabble.com/Learn-Ham-Spam-to-more-than-Bayes-DB-tf4621792.html#a13201318
Sent from the SpamAssassin - Users mailing list archive at Nabble.com.



Learn Ham/Spam to more than Bayes DB

2007-10-14 Thread Magnus Anderson

Hi,

I have a script that runs every night with sa-learn to learn new ham/spam
messages for every user.
I do this with running these commands

/usr/bin/sa-learn --ham --no-sync -u {$_array['sa_user']} {$_dir['inbox']}
/usr/bin/sa-learn --ham --no-sync -u {$_array['sa_user']} {$_dir['ham']}
/usr/bin/sa-learn --spam --no-sync -u {$_array['sa_user']} {$_dir['spam']}

These mail boxes are in mbox format. I also rely on -u for overriding the
username, as I use Bayes and AWL in MySQL for eatch username. 

The problem now is though that I want to report ham/spam to more than just
my Bayes DB if users want to do that. I want to report spam to
Pyzor,Razor,Dcc and SpamCop.

But sa-learn doesn't support this. Does anyone have an idea on how to make
this work?
-- 
View this message in context: 
http://www.nabble.com/Learn-Ham-Spam-to-more-than-Bayes-DB-tf4621792.html#a13199123
Sent from the SpamAssassin - Users mailing list archive at Nabble.com.



Global Bayes and AWL

2007-10-13 Thread Magnus Anderson

Hi,

I have read this thread,
http://www.nabble.com/forum/ViewPost.jtp?post=819176&framed=y

This is also what I am searching for to do. Make SpamAssassin score against
both a AWL/Bayes by the user and a AWL/Bayes by the system.

What I was thinking on was to make a new set of rules for SA that checks
agains the AWL and Bayes again, but this time as a specific user, like
. 

I copied the /usr/share/spamassassin/60_awl.cf and 23_bayes.cf to
/etc/mail/spamassassin and renamed all BAYES_* and AWL to GLOBAL_BAYES_* and
GLOBAL_AWL.

Then I added "user_awl_sql_override_username" and
"user_bayes_sql_override_username" to the new rules.

This however made CGPSA, that I use against CommuniGate Pro, to run AWL
saves against the MySQL table as  to.

It also wrote output like "Merging duplicate GLOBAL_AWL and AWL".

Is this not possible at all, has someone made this work?
-- 
View this message in context: 
http://www.nabble.com/Global-Bayes-and-AWL-tf4618683.html#a13190805
Sent from the SpamAssassin - Users mailing list archive at Nabble.com.



Re: Reporting spam with Spmassassin-run instead of sa-learn

2007-07-31 Thread Magnus Anderson


Matt Kettler-3 wrote:
> 
> Matt Kettler wrote:
>> su -c "username" spamassassin --revoke...
>>
>>
>>   
> Erk, that should be su "username" -c "spamassassin --revoke".. Pardon my
> error.
> 

Please read my reply to Martin Schütte earlier.
-- 
View this message in context: 
http://www.nabble.com/Reporting-spam-with-Spmassassin-run-instead-of-sa-learn-tf4165350.html#a11931540
Sent from the SpamAssassin - Users mailing list archive at Nabble.com.



Re: Reporting spam with Spmassassin-run instead of sa-learn

2007-07-29 Thread Magnus Anderson



Martin Schütte wrote:
> 
> Magnus Anderson schrieb:
>> So basicly, I want to run the "spamassassin --revoke/--report" commands
>> as a
>> specific username. How can I do that?
> 
> man su
> 
> For example: su vscan -c "spamassassin --report ${train_dir_sa_spam}/*"
> (Make sure the user has permission to read the mails.)
> 

The user is not exisiting on the system itself, just inside CommuniGate that
I run.
When I run now I run like "sa-learn --spam --no-sync -u [EMAIL PROTECTED]
/system-path-to-mbox"

Sorry if I wasn't explaining myself correctly.

-- 
View this message in context: 
http://www.nabble.com/Reporting-spam-with-Spmassassin-run-instead-of-sa-learn-tf4165350.html#a11851371
Sent from the SpamAssassin - Users mailing list archive at Nabble.com.



Reporting spam with Spmassassin-run instead of sa-learn

2007-07-29 Thread Magnus Anderson

At the moment I run sa-learn for learning new messages as spam/ham. The
problem with this is that it just reports to bayes, not razor2, pyzor, dcc
or spamcop.

It is stated in the spamassassin-run manual that spamassassin-run is for
reporting to these places, and to use sa-learn only if I want to report to
bayes locally.

My problem is that I use a DB for user preferences and different bays DBs
for every user. This works with sa-learn by specifying "-u ", but
I can't seem to find this option in the spamassassin command. It defaults as
"root" for me.

So basicly, I want to run the "spamassassin --revoke/--report" commands as a
specific username. How can I do that?
-- 
View this message in context: 
http://www.nabble.com/Reporting-spam-with-Spmassassin-run-instead-of-sa-learn-tf4165350.html#a11850845
Sent from the SpamAssassin - Users mailing list archive at Nabble.com.



Re: CGPSA + MySQL, Userprefs Problems

2006-11-12 Thread Magnus Anderson
On Sun, 12 Nov 2006 12:59:33 +0100, Magnus Anderson wrote:

> Hi,
> 
> I'm having a problem with CGPSA and MySQL Userprefs settings.
> 
> For the record, this *was* working a few days ago when I was testing to
> set it up, but somehow it stopped working suddenly. Just in time for me
> to implement it into a working system.
> 
> Well, my problem is that it  only reacts on Global settings in the
> Userprefs database. If I change $GLOBAL required_hits 7 to 8 it follows
> nicely. But if I add a user or domain rule, it doesn't work.
> 
> It may be some clue that my mail server reports this...
> 
> Attempting to load domain configuration for sonic2000.org Using root
> configuration for sonic2000.org domain configuration already loaded,
> discard_threshold = 25 Attempting to load user configuration for
> [EMAIL PROTECTED] Using domain configuration for [EMAIL PROTECTED]
> Local address [EMAIL PROTECTED], account name [EMAIL PROTECTED],
> effective home
> directory /var/CommuniGate/Settings/SpamAssassin Using system default
> SpamAssassin settings for [EMAIL PROTECTED] Processing CGP header
> line: \n
> Finished processing CGP headers
> Running SpamAssassin with domain sonic2000.org default settings for 1
> address
> SQL preferences in use, no state or user home directory Identified
> non-spam (7.1/8.0) for  in 1.9 seconds
> 
> What makes me confused is that it now reports "for " and not
> "for [EMAIL PROTECTED]" as it used to do.
> 
> The only thing I have done is removing the state directories for
> SpamAssassin in the CommuniGate folder. (account.web/.spamassassin)
> 
> My CGPSA Settings are these...
> cgp_username = cgpsa-spamassassin-cli cgp_password = xxx
> use_cli = true
> loop_prevention_header = X-TFF-CGPSA-Filter debug = true
> debug_level = 9
> allow_user_prefs = true
> allow_user_state = true
> use_domain_prefs = true
> allow_auto_whitelist = true
> use_cgpsa = true
> use_user_prefs = true
> sql_user_prefs = true
> use_user_state = true
> use_auto_whitelist = true
> sql_auto_whitelist = true
> 
> Hopefully someone can point me into the right direction for solving this


I solved the problem with MySQL And the Userprefs file.

If there are no user_prefs file in the account.web/.spamassassin folder
the script thinks that the user doesn't have any preferences to load even
tough the user has preferences in the SQL DB.

To solve this I have to touch a empty file into each users
account.web/.spamassassin folder so it think it does need to run for that
user, and then it reports "Identified (spam/non-spam) (score) for
[EMAIL PROTECTED]" correctly.

This seems like a nasty bug, since there are no documents on this and I
was thinking I could remove all these files now when I was using SQL (so
it didn't read the wrong settings, like the ones that was once used in
these files).

Best Regards,
 Magnus



CGPSA + MySQL, Userprefs Problems

2006-11-12 Thread Magnus Anderson
Hi,

I'm having a problem with CGPSA and MySQL Userprefs settings.

For the record, this *was* working a few days ago when I was testing to
set it up, but somehow it stopped working suddenly. Just in time for me
to implement it into a working system.

Well, my problem is that it  only reacts on Global settings in the
Userprefs database. If I change $GLOBAL required_hits 7 to 8 it follows
nicely. But if I add a user or domain rule, it doesn't work.

It may be some clue that my mail server reports this...

Attempting to load domain configuration for sonic2000.org
Using root configuration for sonic2000.org
domain configuration already loaded, discard_threshold = 25
Attempting to load user configuration for [EMAIL PROTECTED]
Using domain configuration for [EMAIL PROTECTED]
Local address [EMAIL PROTECTED], account name [EMAIL PROTECTED],
effective home
directory /var/CommuniGate/Settings/SpamAssassin
Using system default SpamAssassin settings for [EMAIL PROTECTED]
Processing CGP header line: \n
Finished processing CGP headers
Running SpamAssassin with domain sonic2000.org default settings for 1
address
SQL preferences in use, no state or user home directory
Identified non-spam (7.1/8.0) for  in 1.9 seconds

What makes me confused is that it now reports "for " and not
"for [EMAIL PROTECTED]" as it used to do.

The only thing I have done is removing the state directories for
SpamAssassin in the CommuniGate folder. (account.web/.spamassassin)

My CGPSA Settings are these...
cgp_username = cgpsa-spamassassin-cli
cgp_password = xxx
use_cli = true
loop_prevention_header = X-TFF-CGPSA-Filter
debug = true
debug_level = 9
allow_user_prefs = true
allow_user_state = true
use_domain_prefs = true
allow_auto_whitelist = true
use_cgpsa = true
use_user_prefs = true
sql_user_prefs = true
use_user_state = true
use_auto_whitelist = true
sql_auto_whitelist = true

Hopefully someone can point me into the right direction for solving this



AWL Rule not Kicking in

2006-11-06 Thread Magnus Anderson
Hi,

I have enabled AWL on my SpamAssassin configuration

- local.cf
# Store AWL in MySQL
auto_whitelist_factory  Mail::SpamAssassin::SQLBasedAddrList
user_awl_dsnDBI:mysql:spamassassin:localhost
user_awl_sql_username   spamassassin
user_awl_sql_password   xx
user_awl_sql_table  awl

- v310.cf
# AWL - do auto-whitelist checks
#
loadplugin Mail::SpamAssassin::Plugin::AWL

It stores and reads AWL scores from the MySQL DB, so it does work.
But I never see any single thing about AWL scores in my incomming emails
that I get. Not even in the ones that are tagged as SPAM.

What I understand I don't have to enable it in my user_prefs file any
longer since it's on by default to be used.

Do I need any certain amount of records from one address before it's
kicking in, or what?

I can't seem to find anything in the Wiki about this either, so if
someone could be so kind to point me in the right direction I would be
happy.

-- Magnus



[Solved]

2006-10-23 Thread Magnus Anderson
I have solved my problem with this.

I used CGPSA v 1.4f and the developer has completed v 1.5 that now
supports MySQL DB for all the user_auto_whitelist data.

--Magnus



Re: auto-whitelist and MySQL Problems

2006-10-21 Thread Magnus Anderson
Benny Pedersen wrote:
> On Sat, October 21, 2006 11:54, Magnus Anderson wrote:
> 
>> If someone knows how to solve this problem I would be very happy.
> 
> give the users there own mysql db is one solution
> 
> another is to define mysql db in site wide config
> 
> where overwrite username is not used, this should work for unix acoounts where
> users have user_prefs
> 
> for virtual users its more tricky since it will depend on how
> spamc/spamassassin is called
> 

For storing the AWL data in the DB I use this in my local.cf file.

auto_whitelist_factory  Mail::SpamAssassin::SQLBasedAddrList
user_awl_dsnDBI:mysql:spamassassin:localhost
user_awl_sql_username   spamassassin
user_awl_sql_password   
user_awl_sql_table  awl

For storing the data in the DB for Bayes I use this in my local.cf file.

bayes_store_module  Mail::SpamAssassin::BayesStore::MySQL
bayes_sql_dsn   DBI:mysql:spamassassin:localhost
bayes_sql_username  spamassassin
bayes_sql_password  

The Bayes are working, but the AWL are not.
But as I wrote in my first message, the satrting process of the call to
SA are telling me that it is accessing the MySQL DB.

I am calling to SA with a script called CGPSA for integrating
CommuniGate with SpamAssassin.

I can't see why this shouldn't work.

Is there some problem in SA 3.14 for this?



auto-whitelist and MySQL Problems

2006-10-21 Thread Magnus Anderson
I have a problem with auto-whitelisting and MySQL.
I've setted up SpamAssassin (v. 3.14) to connect to MySQL and store
Bayes and AWL Data.

Bayes data are stored as it should for everyone, but the AWL doesn't
work properly.

When I start up SA I get this in the debug logs, and it looks good.

[8494] dbg: plugin: registering glue method for
check_from_in_auto_whitelist
(Mail::SpamAssassin::Plugin::AWL=HASH(0xa589130))
[8494] dbg: auto-whitelist: sql-based connected to
DBI:mysql:spamassassin:localhost
[8494] dbg: auto-whitelist: sql-based using username: root
[8494] dbg: auto-whitelist: sql-based get_addr_entry: no entry found for
[EMAIL PROTECTED]|ip=none
[8494] dbg: auto-whitelist: sql-based
[EMAIL PROTECTED]|ip=none scores 0/0
[8494] dbg: auto-whitelist: AWL active, pre-score: 2.216, autolearn
score: 2.216, mean: undef, IP: undef
[8494] dbg: auto-whitelist: sql-based finish: disconnected from
DBI:mysql:spamassassin:localhost
[8494] dbg: auto-whitelist: post auto-whitelist score: 2.216

This proves it gets to the DB and gets the data, and I can confirm that
this is saved and read from the DB.

But when someone gets a mail this is what the logs are saying...

[8657] dbg: locker: safe_lock: created
name.macnt/account.web/.spamassassin/auto-whitelist.lock.8657
[8657] dbg: locker: safe_lock: trying to get lock on
name.macnt/account.web/.spamassassin/auto-whitelist with 0 retries
[8657] dbg: locker: safe_lock: link to
name.macnt/account.web/.spamassassin/auto-whitelist.lock: link ok
[8657] dbg: auto-whitelist: tie-ing to DB file of type DB_File R/W in
name.macnt/account.web/.spamassassin/auto-whitelist
[8657] dbg: auto-whitelist: db-based
[EMAIL PROTECTED]|ip=91.103 scores 0/0
[8657] dbg: auto-whitelist: db-based [EMAIL PROTECTED]|ip=none
scores 0/0
[8657] dbg: auto-whitelist: AWL active, pre-score: 20.713, autolearn
score: 20.713, mean: undef, IP: 91.103.187.48
[8657] dbg: auto-whitelist: add_score: new count: 1, new totscore: 20.713
[8657] dbg: auto-whitelist: DB addr list: untie-ing and unlocking
[8657] dbg: auto-whitelist: DB addr list: file locked, breaking lock
[8657] dbg: locker: safe_unlock: unlink
name.macnt/account.web/.spamassassin/auto-whitelist.lock
[8657] dbg: auto-whitelist: post auto-whitelist score: 20.713


This shows that it are actually reading and saving to the Bayes DB File
instead of the MySQL DB. It worked in the test run, why not here?

Does the user has to have something in their user_prefs file, or could
something in them override the system settings?

The fact that every user now has their own DB file is what I wanted, not
one big for everyone, so it is working kind of. But I want it all stored
in the MySQL DB.

If someone knows how to solve this problem I would be very happy.

--
Magnus



Re: AWL: Plugin doesn't register glue with MySQL

2006-08-19 Thread Magnus Anderson
My setup are this in local.cf:

auto_whitelist_factory  Mail::SpamAssassin::SQLBasedAddrList
user_awl_dsnDBI:mysql:spamassassin:localhost
user_awl_sql_username   spamassassin
user_awl_sql_password   xxx
user_awl_sql_table  awl



AWL: Plugin doesn't register glue with MySQL

2006-08-19 Thread Magnus Anderson
I have just migrated over from file R/W of AWL to using our MySQL server.

But it seems like it misses registering to use it for uses. It still
wrties a file for everyone.

When I run 'spamassassin -D -t < sample-spam.txt' it works and registers
a record for user root in the awl database in mysql, so it should work.

During startup it prints this:
---
[19660] dbg: plugin: registering glue method for
check_from_in_auto_whitelist
(Mail::SpamAssassin::Plugin::AWL=HASH(0xaa0d6b4))
[19660] dbg: auto-whitelist: sql-based connected to
DBI:mysql:spamassassin:localhost
[19660] dbg: auto-whitelist: sql-based using username: root
[19660] dbg: auto-whitelist: sql-based get_addr_entry: no entry found
for [EMAIL PROTECTED]|ip=none
[19660] dbg: auto-whitelist: sql-based
[EMAIL PROTECTED]|ip=none scores 0/0
[19660] dbg: auto-whitelist: AWL active, pre-score: 2.216, autolearn
score: 2.216, mean: undef, IP: undef
[19660] dbg: auto-whitelist: sql-based finish: disconnected from
DBI:mysql:spamassassin:localhost
[19660] dbg: auto-whitelist: post auto-whitelist score: 2.216
[19660] dbg: rules: running body-text per-line regexp tests; score so
far=2.216

That seems like it's doing what it should.
But when checking the logs (I'm using CGPSA and looking in its log for
this) it gives me something completly different when it checkes the
mails it gets.

[19702] dbg: locker: safe_lock: created
/var/CommuniGate/Domains/sonic2000.org/magnus.macnt/account.web/.spamassassin/auto-whitelist.lock.lynx.us-se.com.19702
[19702] dbg: locker: safe_lock: trying to get lock on
/var/CommuniGate/Domains/sonic2000.org/magnus.macnt/account.web/.spamassassin/auto-whitelist
with 0 retries
[19702] dbg: locker: safe_lock: link to
/var/CommuniGate/Domains/sonic2000.org/magnus.macnt/account.web/.spamassassin/auto-whitelist.lock:
link ok
[19702] dbg: auto-whitelist: tie-ing to DB file of type DB_File R/W in
/var/CommuniGate/Domains/sonic2000.org/magnus.macnt/account.web/.spamassassin/auto-whitelist
[19702] dbg: auto-whitelist: db-based [EMAIL PROTECTED]|ip=213.67 scores 0/0
[19702] dbg: auto-whitelist: db-based [EMAIL PROTECTED]|ip=none scores 0/0
[19702] dbg: auto-whitelist: AWL active, pre-score: -1.44, autolearn
score: -1.44, mean: undef, IP: 213.67.205.235
[19702] dbg: auto-whitelist: add_score: new count: 1, new totscore: -1.44
[19702] dbg: auto-whitelist: DB addr list: untie-ing and unlocking
[19702] dbg: auto-whitelist: DB addr list: file locked, breaking lock
[19702] dbg: locker: safe_unlock: unlink
/var/CommuniGate/Domains/sonic2000.org/magnus.macnt/account.web/.spamassassin/auto-whitelist.lock
[19702] dbg: auto-whitelist: post auto-whitelist score: -1.44

My question now is, why is it still using a DB File and not MySQL when
it has been registering it at the beginning of the startup process?

For now I just have to live with  it using DB files, but migrating the
whole thing to MySQL would be alot better.

Thanks in advance,
 Magnus