Bug 3214 - Spamd not using per-user Bayes settings
Summary: Spamd not using per-user Bayes settings
Status: RESOLVED FIXED
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: spamc/spamd (show other bugs)
Version: SVN Trunk (Latest Devel Version)
Hardware: Other Linux
: P5 normal
Target Milestone: 3.0.0
Assignee: SpamAssassin Developer Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-25 11:46 UTC by Jay Eno
Modified: 2004-03-26 14:39 UTC (History)
0 users



Attachment Type Modified Status Actions Submitter/CLA Status
Spamd debug log. text/plain None Jay Eno [NoCLA]

Note You need to log in before you can comment on or make changes to this bug.
Description Jay Eno 2004-03-25 11:46:39 UTC
using 'spamd -d -c -m5 -H -x -q' and 'spamc -u "user@blee.com"' appears to cause
the userpref lookup to happen, but all of the bayes stuff happens for the
current user running spamd (root in this case) instead of the per user. Might be
some sort of configuration error on my part, or a bug, not sure. 

Using SVN Trunk Tarball 3.0.0-r9592

CONFIG:

allow_user_rules      1
required_hits           7.0
report_safe     0
use_bayes       1
bayes_min_ham_num     0
bayes_min_spam_num    0
bayes_auto_learn      1
bayes_auto_learn_threshold_nonspam      0.1
bayes_auto_learn_threshold_spam   10.0
skip_rbl_checks         1
use_razor2              1
use_dcc                 0
use_pyzor               0
razor_config            /home/qscand/.razor/razor-agent.conf
ok_languages            all
ok_locales              all
user_scores_dsn         DBI:mysql:spamassassin:localhost
user_scores_sql_username        spamassassin
user_scores_sql_password        sp@mg0d
auto_whitelist_factory  Mail::SpamAssassin::SQLBasedAddrList
user_awl_dsn          DBI:mysql:spamassassin:localhost
user_awl_sql_table    awl
user_awl_sql_username spamassassin
user_awl_sql_password sp@mg0d
bayes_store_module    Mail::SpamAssassin::BayesStore::SQL
bayes_sql_dsn         DBI:mysql:spamassassin:localhost
bayes_sql_username    spamassassin
bayes_sql_password    sp@mg0d

Will attach a debug dump to this bug after opening.
Comment 1 Jay Eno 2004-03-25 11:52:12 UTC
Created attachment 1869 [details]
Spamd debug log.

Debug dump from "spamd -D -c -m5 -H -x -q". Includes startup and reciept of 2
messages, one of which enters/updates a bunch of tokens under the root user, as
apposed to the user spamc was called with.
Comment 2 Jay Eno 2004-03-25 14:28:25 UTC
Got the per-user bayes stuff to start showing up in the database by hacking the
handle_user_sql function in spamd.

sub handle_user_sql {
  my ($username) = @_;
  unless($spamtest->load_scoreonly_sql(@_)) {
    $spamtest->signal_user_changed ({ username => $username,
                                      user_dir => "" });
    return 0;
  }
  $spamtest->signal_user_changed ({ username => $username,
                                    user_dir => "" });
  return 1;
}

(Note: I don't claim to be a developer, but the hack seems to work)

This however, brings up a bigger issue, when combined with Auto-Learn, in that
it will auto-learn and plug stuff into the database for every incoming email
when used from something like qmail-scanner on the front end system-wide. So
even non-existent accounts get plugged into the bayes database. There should
probably be some check with either a vpopmail lookup, or a system lookup to
verify an account before logging bayes stuff maybe?

Also, there's currently no way I can see to get ham into the bayes database on a
per user basis. It looks like to fully make use of the bayes database stuff a
flag is needed on sa-learn to give it a user.
Comment 3 Michael Parker 2004-03-25 14:48:52 UTC
Subject: Re:  Spamd not using per-user Bayes settings

On Thu, Mar 25, 2004 at 02:28:26PM -0800, bugzilla-daemon@bugzilla.spamassassin.org wrote:
> 
> ------- Additional Comments From jeno@finali.com  2004-03-25 14:28 -------
> Got the per-user bayes stuff to start showing up in the database by hacking the
> handle_user_sql function in spamd.
> 
> sub handle_user_sql {
>   my ($username) = @_;
>   unless($spamtest->load_scoreonly_sql(@_)) {
>     $spamtest->signal_user_changed ({ username => $username,
>                                       user_dir => "" });
>     return 0;
>   }
>   $spamtest->signal_user_changed ({ username => $username,
>                                     user_dir => "" });
>   return 1;
> }
> 

Yeah, but the real question is why was it not already signaling that
the user had changed?

Anyone know?

> This however, brings up a bigger issue, when combined with Auto-Learn, in that
> it will auto-learn and plug stuff into the database for every incoming email
> when used from something like qmail-scanner on the front end system-wide. So
> even non-existent accounts get plugged into the bayes database. There should
> probably be some check with either a vpopmail lookup, or a system lookup to
> verify an account before logging bayes stuff maybe?

Hmmm...this is an interesting problem, can you open up another bug so
we can track it separately.

> Also, there's currently no way I can see to get ham into the bayes database on a
> per user basis. It looks like to fully make use of the bayes database stuff a
> flag is needed on sa-learn to give it a user.

Yeah, I think there is a bug somewhere, you can cheat by setting
bayes_sql_override_username to the username you wish to train for.

Michael

Comment 4 Michael Parker 2004-03-26 23:39:48 UTC
Went ahead and added call to signal_user_changed for handle_user_sql and
handle_user_ldap.  I couldn't find/think of a reason why we shouldn't call them.

Committed revision 9785.