You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Ray Anderson <rs...@rb-com.com> on 2004/02/24 15:03:44 UTC

Mysql + user body checks

Is there no way to do this?  Or did I miss something in the
documentation?  Is this just one of those questions that make you roll
your eyes?  :)

#########################################
Original message:

Greetings,

I've just deployed my first spamassassin site, and my users and I are
pleased 
with the results so far with one exception....

I wanted to do BODY CHECKS on a per user basis, using mysql to store the
body 
check data, but it doesn't seem to work correctly.

My local.cf file looks like this:

  user_scores_dsn            DBI:mysql:<spam_database>:localhost
  user_scores_sql_username   <spam_user_name>
  user_scores_sql_password   <secret_spam_pass>
  user_scores_sql_table      <spam_table>

  # turn on user prefs
  allow_user_rules 1

  #test rule......
  body       CUST_BODY_CHECKS    /should_never_be_seen/
  describe   CUST_BODY_CHECKS    SQL-based body checks
  score      CUST_BODY_CHECKS   -10

My MySQL entries look like this:

  prefid  username  preference  value  
      2   me        score       CUST_BODY_CHECKS 75 
      3   me        body        CUST_BODY_CHECKS /test/ 

When I do the following:
  # echo -e "From: me\n\ntest test \n" | spamc -u me

I get:
  From: rsa
  X-Spam-Status: No, hits=1.6 required=5.0
          tests=DATE_MISSING,MISSING_HEADERS

If I do:
  # echo -e "From: me\n\nshould_never_be_seen\n" | spamc -u me

I get the expected results:
  X-Spam-Status: Yes, hits=76.6 required=5.0
          tests=CUST_BODY_CHECKS,DATE_MISSING,MISSING_HEADERS

So how can I implement my OWN custom body checks WITHOUT using
~/.spamassassin 
files?  None of my users have a local account, this is all done through 
postfix/spamassassin/mysql/cyrus.

Thanks for any advice,

-=Ray


Re: Mysql + user body checks

Posted by Adam Denenberg <ad...@sa.dberg.org>.
Ray,

   There is some bug (well not really a bug, but the way it is designed
currently) in the code that prevents a user defined rule from working in
MySql if it is not defined in the local.cf file.  Dallas has done some
research in this area you may want to ping him (i think).  Basically if
you add the rule you have below to your local.cf file, restart spamd,
the user defined rule shoudl work.

 I am not aware of a current workaround but one would be nice.  i think
enough of us have decided this was an important feature and should
probably take a look at the code and figure out why this is the case.  I
am alwyas more than willing to help if other people are interested as
well.

adam

On Tue, 2004-02-24 at 09:03, Ray Anderson wrote:
> Is there no way to do this?  Or did I miss something in the
> documentation?  Is this just one of those questions that make you roll
> your eyes?  :)
> 
> #########################################
> Original message:
> 
> Greetings,
> 
> I've just deployed my first spamassassin site, and my users and I are
> pleased 
> with the results so far with one exception....
> 
> I wanted to do BODY CHECKS on a per user basis, using mysql to store the
> body 
> check data, but it doesn't seem to work correctly.
> 
> My local.cf file looks like this:
> 
>   user_scores_dsn            DBI:mysql:<spam_database>:localhost
>   user_scores_sql_username   <spam_user_name>
>   user_scores_sql_password   <secret_spam_pass>
>   user_scores_sql_table      <spam_table>
> 
>   # turn on user prefs
>   allow_user_rules 1
> 
>   #test rule......
>   body       CUST_BODY_CHECKS    /should_never_be_seen/
>   describe   CUST_BODY_CHECKS    SQL-based body checks
>   score      CUST_BODY_CHECKS   -10
> 
> My MySQL entries look like this:
> 
>   prefid  username  preference  value  
>       2   me        score       CUST_BODY_CHECKS 75 
>       3   me        body        CUST_BODY_CHECKS /test/ 
> 
> When I do the following:
>   # echo -e "From: me\n\ntest test \n" | spamc -u me
> 
> I get:
>   From: rsa
>   X-Spam-Status: No, hits=1.6 required=5.0
>           tests=DATE_MISSING,MISSING_HEADERS
> 
> If I do:
>   # echo -e "From: me\n\nshould_never_be_seen\n" | spamc -u me
> 
> I get the expected results:
>   X-Spam-Status: Yes, hits=76.6 required=5.0
>           tests=CUST_BODY_CHECKS,DATE_MISSING,MISSING_HEADERS
> 
> So how can I implement my OWN custom body checks WITHOUT using
> ~/.spamassassin 
> files?  None of my users have a local account, this is all done through 
> postfix/spamassassin/mysql/cyrus.
> 
> Thanks for any advice,
> 
> -=Ray
>