Re: spamd & mysql redux

2006-02-22 Thread Barton L. Phillips

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

2006-02-22 Thread Matthias Fuhrmann
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

2006-02-22 Thread Steve Thomas
> 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

2006-02-22 Thread Scott Russell

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 <[EMAIL PROTECTED]>
IBM Linux Technology Center


Re: spamd & mysql redux

2006-02-22 Thread Matthias Fuhrmann
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

2006-02-22 Thread Steve Thomas
>> 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

2006-02-22 Thread Mike Jackson

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. 



spamd & mysql redux

2006-02-22 Thread Steve Thomas
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-