You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Duane Hill <d....@yournetplus.com> on 2007/05/08 07:59:02 UTC

per-user rules from mysql

I'm trying to get SA to read user rules from MySQL. I've exhausted all 
testing and have not found a way. I have spamd starting with the following 
parameters:

   --username=spamd --groupname=spamd --min-children=2 --max-children=8
   --min-spare=4 --max-spare=6 --max-conn-per-child=120 --timeout-tcp=15
   --timeout-child=120 --sql-config --nouser-config

I have the following in local.cf that would pertain to userprefs:

   user_scores_dsn                 DBI:mysql:postfix:localhost:3306
   user_scores_sql_username        sqlusr
   user_scores_sql_password        sqlpwd
   user_scores_sql_custom_query    SELECT preference, value FROM _TABLE_
     WHERE username = _USERNAME_ OR username = '@GLOBAL' OR
     username = concat('@', _DOMAIN_) ORDER BY username ASC

   allow_user_rules 1

The user_scores_sql_custom_query is wrapped for readablility. In the 
local.cf it appears all on one line.

The test rule I set up is the one in the wiki:

   header L_TO_ME ToCc =~ /d\.hill\@yournetplus\.com/
   describe L_TO_ME Email addressed to me
   score L_TO_ME 0.010

I've tried:

   1) placing the entire line into the 'preference' column

   2) placing the entire line into the 'value' column

   2) placing everything before the first space into the 'preference'
      column and everything after the first space into the 'value' column.

   3) placing everything before the second space into the 'preference'
      column and everything after the second space into the 'value' column.

It appears SA does not read user rules from anything other than a file 
stored within ~/.spamassassin/user_prefs. Is this the case?

Re: per-user rules from mysql

Posted by Duane Hill <d....@yournetplus.com>.
On Tue, 8 May 2007, Michael Parker wrote:

> Duane Hill wrote:
>>
>>   header L_TO_ME ToCc =~ /d\.hill\@yournetplus\.com/
>>   describe L_TO_ME Email addressed to me
>>   score L_TO_ME 0.010
>>
>
> You can't do rules with SQL user prefs, not even with allow_user_rules.
>
> Only non-admin config options are allowed.

That's what I've come to the conclusion already. Thanks for confirming. 
And, I've already seen from the spamd man page you can't combine 
--sql-config and --virtual-config-dir. Oh, well. That's ok. I was just 
doing some experimenting in a controlled install. I may visit the path 
with the virtual config dir.

Re: per-user rules from mysql

Posted by Michael Parker <pa...@pobox.com>.
Duane Hill wrote:
> 
>   header L_TO_ME ToCc =~ /d\.hill\@yournetplus\.com/
>   describe L_TO_ME Email addressed to me
>   score L_TO_ME 0.010
> 

You can't do rules with SQL user prefs, not even with allow_user_rules.

Only non-admin config options are allowed.

Michael