You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Christopher Engelhard <ce...@lcts.de> on 2017/08/13 12:49:13 UTC

TxRep can't use SQLBasedAddrList factory module

Hi,
I'm trying to set up txrep with SQL storage, but TxRep does not seem to
allow SQLBasedAddrList as factory module.

Log:
spamd[8299]: TxRep: illegal factory setting
spamd[8299]: TxRep: could not open storages, quitting!
spamd[8299]: TxRep: illegal factory setting
spamd[8299]: TxRep: could not open storages, quitting!
spamd[8299]: Use of uninitialized value in addition (+) at
/usr/share/perl5/vendor_perl/Mail/SpamAssassin/Plugin/TxRep.pm line
1329, <GEN14> line 28.
spamd[8299]: TxRep: illegal factory setting
spamd[8299]: TxRep: could not open storages, quitting!
spamd[8299]: Use of uninitialized value in addition (+) at
/usr/share/perl5/vendor_perl/Mail/SpamAssassin/Plugin/TxRep.pm line
1330, <GEN14> line 28.
spamd[8299]: TxRep: illegal factory setting
spamd[8299]: TxRep: could not open storages, quitting!
spamd[8299]: Use of uninitialized value in addition (+) at
/usr/share/perl5/vendor_perl/Mail/SpamAssassin/Plugin/TxRep.pm line
1331, <GEN14> line 28.
spamd[8299]: TxRep: illegal factory setting
spamd[8299]: TxRep: could not open storages, quitting!
spamd[8299]: Use of uninitialized value in addition (+) at
/usr/share/perl5/vendor_perl/Mail/SpamAssassin/Plugin/TxRep.pm line
1334, <GEN14> line 28.
spamd[8299]: TxRep: illegal factory setting
spamd[8299]: TxRep: could not open storages, quitting!

Config:
header                       TXREP   eval:check_senders_reputation()
describe                     TXREP   Score normalizing based on sender's
reputation
tflags                       TXREP   userconf noautolearn
priority                     TXREP   1000
txrep_factory module         Mail::SpamAssassin::SQLBasedAddrList
user_awl_dsn                 DBI:mysql:spamdb:localhost
user_awl_sql_username        <user>
user_awl_sql_password        <password>
user_awl_sql_table           txrep

I'm running spamassassin 3.4.1 with config/bayes stored in SQL (both of
which work) on up-to-date archlinux. It's invoked via postfix
content_filter:

spamassassin unix -     n       n       -       -       pipe
  flags=R user=spamd argv=/usr/bin/vendor_perl/spamc -e
/usr/bin/sendmail -oi -f ${sender} ${recipient}

but the same error occurs if SA is invoked by amavis.

What am I doing wrong?

Best,
Christopher

Re: TxRep can't use SQLBasedAddrList factory module

Posted by "Kevin A. McGrail" <ke...@mcgrail.com>.
On 8/15/2017 9:22 AM, Christopher Engelhard wrote:
> On 08/14/2017 05:24 PM, Kevin A. McGrail wrote:
>> does mysql -u <user> -p<password> localhost spamdb work?
> Yes, that works. The user has INSERT, DELETE, UPDATE, SELECT privileges.
> Does it need CREATE? The table 'txrep' exists with columns username,
> email, ip, count, totscore, signedby.
>
> The Bayes-related tables reside in the same DB, and those can be
> accessed (though I've only tried it with amavis, not with pure spamd/spamc).
>
> christopher

Off-hand, I don't know.  We use TXREP with Mysql and I didn't see 
anything obvious.  A grant all might help pinpoint things.


Re: TxRep can't use SQLBasedAddrList factory module

Posted by Christopher Engelhard <ce...@lcts.de>.
> Please open a bug on bugzilla.  Nothing jumps to mind.  If you can
> include the version of mysql just for completeness sake as well as how
> you created the tables, that would be good.
> 
I'll do that, unless you can spot an error below.

> Do you have a line like user_awl_sql_table              txrep?
Yes.

> And can you run a show tables and describe like such?
> show tables;
> describe txrep;


MariaDB [spamdb]> show tables; describe txrep;
+-------------------+
| Tables_in_spamdb  |
+-------------------+
| bayes_expire      |
| bayes_global_vars |
| bayes_seen        |
| bayes_token       |
| bayes_vars        |
| txrep             |
+-------------------+
6 rows in set (0.00 sec)

+----------+--------------+------+-----+-------------------+-----------------------------+
| Field    | Type         | Null | Key | Default           | Extra
                |
+----------+--------------+------+-----+-------------------+-----------------------------+
| username | varchar(100) | NO   | PRI | NULL              |
                |
| email    | varchar(191) | NO   | PRI | NULL              |
                |
| ip       | varchar(48)  | NO   | PRI | NULL              |
                |
| count    | int(11)      | NO   |     | 0                 |
                |
| totscore | float        | NO   |     | 0                 |
                |
| signedby | varchar(191) | NO   | PRI | NULL              |
                |
| last_hit | timestamp    | NO   |     | CURRENT_TIMESTAMP | on update
CURRENT_TIMESTAMP |
+----------+--------------+------+-----+-------------------+-----------------------------+
7 rows in set (0.00 sec)


I didn't have a 'last_hit'-column originally, but adding it (as above)
did not change anything. One further difference: 'email' and 'signedby'
are varchar(191) instead of (255) because the db is utf8mb4, which means
varchar can be at most 191 characters long.

Best,
christopher

Re: TxRep can't use SQLBasedAddrList factory module

Posted by "Kevin A. McGrail" <ke...@mcgrail.com>.
On 8/16/2017 4:38 AM, Christopher Engelhard wrote:
>> I'd start by giving it all perms (excepting things like GRANT), see if
>> it works, and then scale back the perms until you find the minimal
>> necessary set.
> After giving the user full permissions I still get the exact same error
> message(s).
>
> For completeness' sake I tried the Bayes module with just spamassassin
> (no amavis), that works as well. 'spamdb' contains the tables for Bayes
> and TxRep, and all are accessed using the same user/password/privileges.
> Bayes works, TxRep doesn't, even with full privileges.
>
Please open a bug on bugzilla.  Nothing jumps to mind.  If you can 
include the version of mysql just for completeness sake as well as how 
you created the tables, that would be good.

Actually one more set of questions before a bug.

Do you have a line like user_awl_sql_table              txrep?

And can you run a show tables and describe like such?

show tables;

describe txrep;

+----------+--------------+------+-----+-------------------+-------+
| Field    | Type         | Null | Key | Default           | Extra |
+----------+--------------+------+-----+-------------------+-------+
| username | varchar(100) | NO   | PRI |                   | |
| email    | varchar(255) | NO   | PRI |                   | |
| ip       | varchar(40)  | NO   | PRI |                   | |
| count    | int(11)      | NO   |     | 0                 | |
| totscore | float        | NO   |     | 0                 | |
| signedby | varchar(255) | NO   | PRI |                   | |
| last_hit | timestamp    | NO   | MUL | CURRENT_TIMESTAMP | |
+----------+--------------+------+-----+-------------------+-------+
7 rows in set (0.00 sec)


Regards,

KAM


Re: TxRep can't use SQLBasedAddrList factory module

Posted by Christopher Engelhard <ce...@lcts.de>.
> I'd start by giving it all perms (excepting things like GRANT), see if
> it works, and then scale back the perms until you find the minimal
> necessary set.

After giving the user full permissions I still get the exact same error
message(s).

For completeness' sake I tried the Bayes module with just spamassassin
(no amavis), that works as well. 'spamdb' contains the tables for Bayes
and TxRep, and all are accessed using the same user/password/privileges.
Bayes works, TxRep doesn't, even with full privileges.



Re: TxRep can't use SQLBasedAddrList factory module

Posted by David B Funk <db...@engineering.uiowa.edu>.
On Tue, 15 Aug 2017, Christopher Engelhard wrote:

> On 08/14/2017 05:24 PM, Kevin A. McGrail wrote:
>> does mysql -u <user> -p<password> localhost spamdb work?
>
> Yes, that works. The user has INSERT, DELETE, UPDATE, SELECT privileges.
> Does it need CREATE? The table 'txrep' exists with columns username,
> email, ip, count, totscore, signedby.
>
> The Bayes-related tables reside in the same DB, and those can be
> accessed (though I've only tried it with amavis, not with pure spamd/spamc).
>
> christopher

I've not looked at the TxRep code but some kinds of SQL operations need to be 
able to create temporary tables.

I'd start by giving it all perms (excepting things like GRANT), see if it works, 
and then scale back the perms until you find the minimal necessary set.


-- 
Dave Funk                                  University of Iowa
<dbfunk (at) engineering.uiowa.edu>        College of Engineering
319/335-5751   FAX: 319/384-0549           1256 Seamans Center
Sys_admin/Postmaster/cell_admin            Iowa City, IA 52242-1527
#include <std_disclaimer.h>
Better is not better, 'standard' is better. B{

Re: TxRep can't use SQLBasedAddrList factory module

Posted by Christopher Engelhard <ce...@lcts.de>.
On 08/14/2017 05:24 PM, Kevin A. McGrail wrote:
> does mysql -u <user> -p<password> localhost spamdb work?

Yes, that works. The user has INSERT, DELETE, UPDATE, SELECT privileges.
Does it need CREATE? The table 'txrep' exists with columns username,
email, ip, count, totscore, signedby.

The Bayes-related tables reside in the same DB, and those can be
accessed (though I've only tried it with amavis, not with pure spamd/spamc).

christopher

Re: TxRep can't use SQLBasedAddrList factory module

Posted by "Kevin A. McGrail" <ke...@mcgrail.com>.
On 8/13/2017 8:49 AM, Christopher Engelhard wrote
> Log:
> spamd[8299]: TxRep: illegal factory setting
> spamd[8299]: TxRep: could not open storages, quitting!
>
> Config:
> header                       TXREP   eval:check_senders_reputation()
> describe                     TXREP   Score normalizing based on sender's
> reputation
> tflags                       TXREP   userconf noautolearn
> priority                     TXREP   1000
> txrep_factory module         Mail::SpamAssassin::SQLBasedAddrList
> user_awl_dsn                 DBI:mysql:spamdb:localhost
> user_awl_sql_username        <user>
> user_awl_sql_password        <password>
> user_awl_sql_table           txrep
>
>
Off the cuff, it looks fine to me.

does mysql -u <user> -p<password> localhost spamdb work?