You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Rich West <Ri...@wesmo.com> on 2004/11/16 05:45:11 UTC

SQL user config

Now, I know I had this working with SA 3.0 and below on a previous 
incarnation of our mail server (Fedora Linux, SA 3.0.1, Sendmail 8.13.1, 
procmail), but I have noticed that it no longer picks up the individual 
user whitelist/blacklist information from the database as it should..

Our installation is somewhat simple.  We have a global .procmailrc file 
that pipes everything through spamc (we have a running spamd process) to 
flag incoming spam.  It worked wonderfully.

In the /etc/mai/spamassassin/local.cf, I have:
user_scores_dsn                 DBI:mysql:Email:localhost
user_scores_sql_username        mydbuser
user_scores_sql_password        mydbpasswd

Now, when I run spamd in the foreground with the -D option, and I run 
something through the spamc process, I never see it match the email 
against what exists in the whitelist entries in the database.

The database looks like the following:
mysql> show fields from userpref;
+------------+--------------+------+-----+---------+----------------+
| Field      | Type         | Null | Key | Default | Extra          |
+------------+--------------+------+-----+---------+----------------+
| username   | varchar(100) |      | MUL |         |                |
| preference | varchar(30)  |      |     |         |                |
| value      | varchar(100) |      |     |         |                |
| prefid     | int(11)      |      | PRI | NULL    | auto_increment |
+------------+--------------+------+-----+---------+----------------+

Now, on startup, it does mention that it was successful in getting a DB 
connection, but, aside from that, I have not seen any other activity 
relating to the database...  Is there something that I have missed here?

In the debug tests I have run with a clean message from an address in my 
whitelist (stored in the database), I see:
debug: bayes: Database connection established
debug: bayes: found bayes db version 3
debug: bayes: Using userid: 2
debug: Score set 3 chosen.

But, it's like it is not using the database at all....

Any ideas as to where I can begin to look?
-Rich


Re: SQL user config

Posted by Michael Parker <pa...@pobox.com>.
On Mon, Nov 15, 2004 at 11:52:55PM -0500, Rich West wrote:
> >
> >Now, on startup, it does mention that it was successful in getting a 
> >DB connection, but, aside from that, I have not seen any other 
> >activity relating to the database...  Is there something that I have 
> >missed here?
> >
> >In the debug tests I have run with a clean message from an address in 
> >my whitelist (stored in the database), I see:
> >debug: bayes: Database connection established
> >debug: bayes: found bayes db version 3
> >debug: bayes: Using userid: 2
> >debug: Score set 3 chosen.
> >
> >But, it's like it is not using the database at all....
> >

I think you've figured it out (ie -q or -Q) but I wanted to point out
one thing.  The debug above has nothing to do with User Prefs, it is
for the bayes DB connection.

Michael

-- 
ApacheCon November 13-17 2004 http://www.apachecon.com/
See three SpamAssassin sessions & more
Birds of a Feather Session: November 16th, 9-10pm

Re: SQL user config

Posted by Rich West <Ri...@wesmo.com>.
Never mind..

I think I just found it..

> The spamd server will not pay attention to SQL preferences by default,
> even with user_scores_dsn set in the config files.  You must startup
> spamd with the proper options (ie -q or -Q, see perldoc spamd for more
> information).  If the user_scores_dsn option does not exist,
> SpamAssassin will not attempt to use SQL for retrieving users'
> preferences.


Grr.. ok.. I'll give that a shot. :)

Although, from the man page, the -q or -Q options seem a little threatening:

>         -q, --sql-config                   Enable SQL config (only 
> useful with -x)
>         -Q, --setuid-with-sql              Enable SQL config (only 
> useful with -x,

>         -x, --nouser-config                Disable user config files


Then again.. now that I read that.. maybe not so threatening.. :)

-Rich


Rich West wrote:

> Now, I know I had this working with SA 3.0 and below on a previous 
> incarnation of our mail server (Fedora Linux, SA 3.0.1, Sendmail 
> 8.13.1, procmail), but I have noticed that it no longer picks up the 
> individual user whitelist/blacklist information from the database as 
> it should..
>
> Our installation is somewhat simple.  We have a global .procmailrc 
> file that pipes everything through spamc (we have a running spamd 
> process) to flag incoming spam.  It worked wonderfully.
>
> In the /etc/mai/spamassassin/local.cf, I have:
> user_scores_dsn                 DBI:mysql:Email:localhost
> user_scores_sql_username        mydbuser
> user_scores_sql_password        mydbpasswd
>
> Now, when I run spamd in the foreground with the -D option, and I run 
> something through the spamc process, I never see it match the email 
> against what exists in the whitelist entries in the database.
>
> The database looks like the following:
> mysql> show fields from userpref;
> +------------+--------------+------+-----+---------+----------------+
> | Field      | Type         | Null | Key | Default | Extra          |
> +------------+--------------+------+-----+---------+----------------+
> | username   | varchar(100) |      | MUL |         |                |
> | preference | varchar(30)  |      |     |         |                |
> | value      | varchar(100) |      |     |         |                |
> | prefid     | int(11)      |      | PRI | NULL    | auto_increment |
> +------------+--------------+------+-----+---------+----------------+
>
> Now, on startup, it does mention that it was successful in getting a 
> DB connection, but, aside from that, I have not seen any other 
> activity relating to the database...  Is there something that I have 
> missed here?
>
> In the debug tests I have run with a clean message from an address in 
> my whitelist (stored in the database), I see:
> debug: bayes: Database connection established
> debug: bayes: found bayes db version 3
> debug: bayes: Using userid: 2
> debug: Score set 3 chosen.
>
> But, it's like it is not using the database at all....
>
> Any ideas as to where I can begin to look?
> -Rich