You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Steve Thomas <li...@sthomas.net> on 2006/02/22 20:55:27 UTC

spamd & mysql redux

Howdy list,

I'm having the exact same problem that Glenn is/was having as posted about
last week. (see
http://article.gmane.org/gmane.mail.spam.spamassassin.general/77708)

I'm using Fedora Core 4, perl 5.8.6, SA 3.1.0 and mysql 4.1. SA was
installed by building an RPM directly from the tarball. It's a fresh
install of everything on a brand new box.

The sql username/password/database/port/etc is all fine. If I start spamd
from the command line (spamd -q) it works fine. If I start it daemonized
("spamd -q -d" from the command line or "service spamd start" [with
appropriate options in init script]), it won't talk to the database. The
errors it produces (when run with -D) are:

Feb 22 11:45:42 ronin spamd[3322]: bayes: using username: root
Feb 22 11:45:42 ronin spamd[3322]: bayes: unable to connect to database:
Can't connect to local MySQL server through socket
'/var/lib/mysql/mysql.sock' (13)
Feb 22 11:45:42 ronin spamd[3322]: config: score set 1 chosen.
Feb 22 11:45:42 ronin spamd[3322]: config: failed to load user (root)
scores from SQL database: config: SQL error: Can't connect to local MySQL
server through socket '/var/lib/mysql/mysql.sock' (13)
Feb 22 11:45:42 ronin spamd[3322]: spamd: service unavailable: Error
fetching user preferences via SQL at /usr/bin/spamd line 1682.

I have it set up to use the db for bayes and user prefs. When it isn't
running daemonized, I get the expected "less than 200 spams learned" and
"no user prefs found" type of messages, indicating that the connection is
being made and queries are being run successfully.

This seems to be an issue with the daemonization of spamd, perhaps only on
FC4. I've contacted Glen and he was nice enough to reply in a very timely
manner, but he also hasn't found a solution. I've been pounding on this
for a couple of days now and all I've got for my troubles is less hair
(that's what happens when you pull it out!).

I'm at my wit's end, and have to get this up and integrated this week.
It's replacing an OLD SA installation (2.70-cvs) that's eating up all the
resources on the server it's running on, which handles some other
business-critical processes.

If anyone has a suggestion beyond what's already been posted in the
earlier thread, I'm all ears...

Thanks,
St-



Re: spamd & mysql redux

Posted by Scott Russell <ln...@us.ibm.com>.
Steve Thomas wrote:
> I'm most curious about the error number given - (13). In mysql speak,
> that's a 'permission denied', but according to the logs, there's no
> connection attempt even being made. I don't know if that number is coming
> from spamd, the perl db api or mysql. I doubt it's coming from mysql,
> since I'm not seeing any connection attempt whatsoever.

In /etc/my.cf make sure the 'log' option is set in [mysqld] and watch 
the logs in /var/lib/mysql/*.log.

In mysql make sure you have given the correct permissions for root to 
have access to the spamassassin database from both localhost and the 
primary hostname of the system. (Chances are you don't need both but 
until you figure out how you're connecting....)

Check your mysql.user and mysql.db tables to make sure things are as you 
expect them to be. Be wary of root logins from % (any host) with read 
only perms that maybe overriding your other root logins.

Run flush privileges in mysql to make sure everything is sane after 
making any mysql.* changes.

-- 
Scott Russell <ln...@us.ibm.com>
IBM Linux Technology Center

Re: Take a look at this spam

Posted by Rick Macdougall <ri...@ummm-beer.com>.
qqqq wrote:
> HelLo qqqq-at-use! I fouNd yoUr profile in seaRch result Here. whEn I read it I deCidEd to wriTe you and intRoduce mysElf. sO, mY
> nAme iS AnAstasia. I Know tHat my letteR may get loSt among oThers that comE to you evEry day, but It will be coOL if yoU'll write
> me. If yoU really searChing for your sEcond half wTh serious inTEntions to bUild a family, if you prefEr present diaLOgue instead of
> gaMe, I'll wait for yoUr ansWer.
> 
> 
> You mAy write me tO my e-maiL: dzumon{--at--]altern.org
> 
> HaVe a nIce dAy!!!
> I'm waiTing... Bye-BYe!
> 
> 
> This scored really low.
> 
> 
> QQQQ
> 

o_O

...

RE: Take a look at this spam

Posted by Ruben Cardenal <ru...@ruben.cn>.
> HelLo qqqq-at-use! I fouNd yoUr profile in seaRch result Here. whEn I read
> it I deCidEd to wriTe you and intRoduce mysElf. sO, mY
> nAme iS AnAstasia. I Know tHat my letteR may get loSt among oThers that
> comE to you evEry day, but It will be coOL if yoU'll write
> me. If yoU really searChing for your sEcond half wTh serious inTEntions to
> bUild a family, if you prefEr present diaLOgue instead of
> gaMe, I'll wait for yoUr ansWer.
> 
> 
> You mAy write me tO my e-maiL: dzumon{--at--]altern.org
> 
> HaVe a nIce dAy!!!
> I'm waiTing... Bye-BYe!
> 
> 
> This scored really low.

In one of my systems:

X-Spam-Report:
     * 6.0 BAYES_99 BODY: Bayesian spam probability is 99 to 100%
     * [score: 1.0000]
     * 2.0 RCVD_IN_SORBS_DUL RBL: SORBS: sent directly from dynamic IP
address
     * [201.21.5.106 listed in dnsbl.sorbs.net]

Ruben



Take a look at this spam

Posted by qqqq <qq...@usermail.com>.
HelLo qqqq-at-use! I fouNd yoUr profile in seaRch result Here. whEn I read it I deCidEd to wriTe you and intRoduce mysElf. sO, mY
nAme iS AnAstasia. I Know tHat my letteR may get loSt among oThers that comE to you evEry day, but It will be coOL if yoU'll write
me. If yoU really searChing for your sEcond half wTh serious inTEntions to bUild a family, if you prefEr present diaLOgue instead of
gaMe, I'll wait for yoUr ansWer.


You mAy write me tO my e-maiL: dzumon{--at--]altern.org

HaVe a nIce dAy!!!
I'm waiTing... Bye-BYe!


This scored really low.


QQQQ


Re: spamd & mysql redux

Posted by Matthias Fuhrmann <Ma...@stud.uni-hannover.de>.
On Wed, 22 Feb 2006, Steve Thomas wrote:

> > i googled a bit and found this related to fedora3 and SELinux:
> > http://forums.mysql.com/read.php?11,20759,21482#msg-21482
>
> I had seen that page, but didn't know what selinux was (thought it was a
> distro!) so I thought it was irrelevant. After checking it out, it turns
> out that that's what the problem is/was! I disabled selinux and the first
> test after rebooting seems to have worked.
>
> I don't believe I need selinux for anything, as our environment's pretty
> well controlled and we've made do without it for.. well forever, but I'll
> probably have to learn about it eventually so I suppose I'll start looking
> into it...
>
> Thanks a million Matthias. I'm kind of embarrassed that I was looking at
> the answer yesterday and dismissed it... :\

your welcome :)

> For Glen and the archives:
> I disabled selinux by setting the SELINUX environment variable to
> "disabled" in /etc/selinux/config and rebooting.

when installing fedora, it ask for SELinux behavior (enabled / warnings
only / disabled), IIRC right after "firewall default settings". since i
wasnt sure of what it really "protects" or is used for, i always set it
to "warnings only". still too lazy, reading the manpages :)

regards,
Matthias

Re: spamd & mysql redux

Posted by Steve Thomas <li...@sthomas.net>.
> i googled a bit and found this related to fedora3 and SELinux:
> http://forums.mysql.com/read.php?11,20759,21482#msg-21482

I had seen that page, but didn't know what selinux was (thought it was a
distro!) so I thought it was irrelevant. After checking it out, it turns
out that that's what the problem is/was! I disabled selinux and the first
test after rebooting seems to have worked.

I don't believe I need selinux for anything, as our environment's pretty
well controlled and we've made do without it for.. well forever, but I'll
probably have to learn about it eventually so I suppose I'll start looking
into it...

Thanks a million Matthias. I'm kind of embarrassed that I was looking at
the answer yesterday and dismissed it... :\

For Glen and the archives:
I disabled selinux by setting the SELINUX environment variable to
"disabled" in /etc/selinux/config and rebooting.

Thanks again,
St-



Re: spamd & mysql redux

Posted by Matthias Fuhrmann <Ma...@stud.uni-hannover.de>.
On Wed, 22 Feb 2006, Steve Thomas wrote:

> >> Feb 22 11:45:42 ronin spamd[3322]: bayes: unable to connect to database:
> >> Can't connect to local MySQL server through socket
> >> '/var/lib/mysql/mysql.sock' (13)
> >
> > Is that where mysql.sock is located? I don't know where the MySQL RPMs
> > might
> > stick it, but source installs stick it at /tmp/mysql.sock by default.
>
> Yep, that's where it's at. I've also tried specifying the port in the dsn
> options in the cf file, i.e.
> "user_scores_dsn DBI:mysql:spamassassin:localhost:3306"
>
> I'm most curious about the error number given - (13). In mysql speak,
> that's a 'permission denied', but according to the logs, there's no
> connection attempt even being made. I don't know if that number is coming
> from spamd, the perl db api or mysql. I doubt it's coming from mysql,
> since I'm not seeing any connection attempt whatsoever.

i googled a bit and found this related to fedora3 and SELinux:
http://forums.mysql.com/read.php?11,20759,21482#msg-21482

worth a try :)

regards,
Matthias

Re: spamd & mysql redux

Posted by "Barton L. Phillips" <ba...@applitec.com>.
To specify the socket in a perl DBI connect do the following:

my $DBH = 
DBI->connect('dbi:mysql:databaseName;mysql_socket=/tmp/mysql.sock', 
'user', 'password',
               {ShowErrorStatement => 1}) or die "Can't open database";

Steve Thomas wrote:
>>> Feb 22 11:45:42 ronin spamd[3322]: bayes: unable to connect to database:
>>> Can't connect to local MySQL server through socket
>>> '/var/lib/mysql/mysql.sock' (13)
>>>       
>> Is that where mysql.sock is located? I don't know where the MySQL RPMs
>> might
>> stick it, but source installs stick it at /tmp/mysql.sock by default.
>>     
>
> Yep, that's where it's at. I've also tried specifying the port in the dsn
> options in the cf file, i.e.
> "user_scores_dsn DBI:mysql:spamassassin:localhost:3306"
>
> I'm most curious about the error number given - (13). In mysql speak,
> that's a 'permission denied', but according to the logs, there's no
> connection attempt even being made. I don't know if that number is coming
> from spamd, the perl db api or mysql. I doubt it's coming from mysql,
> since I'm not seeing any connection attempt whatsoever.
>
> Thanks,
> St-
>
>
>   

-- 
----------------
Barton L. Phillips
Applied Technology Resources, Inc.
Tel: (818)652-9850
Web: http://www.applitec.com


Re: spamd & mysql redux

Posted by Steve Thomas <li...@sthomas.net>.
>> Feb 22 11:45:42 ronin spamd[3322]: bayes: unable to connect to database:
>> Can't connect to local MySQL server through socket
>> '/var/lib/mysql/mysql.sock' (13)
>
> Is that where mysql.sock is located? I don't know where the MySQL RPMs
> might
> stick it, but source installs stick it at /tmp/mysql.sock by default.

Yep, that's where it's at. I've also tried specifying the port in the dsn
options in the cf file, i.e.
"user_scores_dsn DBI:mysql:spamassassin:localhost:3306"

I'm most curious about the error number given - (13). In mysql speak,
that's a 'permission denied', but according to the logs, there's no
connection attempt even being made. I don't know if that number is coming
from spamd, the perl db api or mysql. I doubt it's coming from mysql,
since I'm not seeing any connection attempt whatsoever.

Thanks,
St-




Re: spamd & mysql redux

Posted by Mike Jackson <mj...@barking-dog.net>.
> Feb 22 11:45:42 ronin spamd[3322]: bayes: unable to connect to database:
> Can't connect to local MySQL server through socket
> '/var/lib/mysql/mysql.sock' (13)

Is that where mysql.sock is located? I don't know where the MySQL RPMs might 
stick it, but source installs stick it at /tmp/mysql.sock by default.