LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 07-03-2014, 04:51 PM   #1
sneakyimp
Senior Member
 
Registered: Dec 2004
Posts: 1,056

Rep: Reputation: 78
samhain Can't connect to local MySQL server through socket


I am trying to configure samhain so that it will write to a log table on a remote mysql database. The problem appears to be that samhain wants to connect to a *local* database despite the fact that I have specified that the db host is on a remote machine.

I compiled with these two options:
Code:
--enable-xml-log
--with-database=mysql
I checked the results of the configuration command and also "make clean all" and "make install" and there appeared to be no errors related to the database at all.

I edited /etc/samhain/samhainrc to specify these settings:
Code:
SetDBName = samhain
SetDBTable = log
SetDBUser = samhain
SetDBPassword = MyPasswordIsHere
SetDBHost = my-db-server.some-subdomain.example.com
I am able to connect to the db server using those credentials from this machine when I try it from the command line:
Code:
mysql -h my-db-server.some-subdomain.example.com -u samhain -p
HOWEVER, when I try to init my database with this command:
Code:
samhain -t init -p info
Then the first message in the samhain log is this:
Code:
<log sev="ERRO" tstamp="2014-07-03T17:35:08+0000" msg="Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)" subroutine="sh_database_query"  >
It would appear that samhain is ignoring my remote host setting and attempts to connect to a local database server (there is no mysql server installed on this machine).

How do I solve this problem?
 
Old 07-04-2014, 09:01 AM   #2
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Try SetDBHost = <IP> instead of SetDBHost = my-db-server.some-subdomain.example.com ?
 
Old 07-04-2014, 02:17 PM   #3
sneakyimp
Senior Member
 
Registered: Dec 2004
Posts: 1,056

Original Poster
Rep: Reputation: 78
Quote:
Originally Posted by Habitual View Post
Try SetDBHost = <IP> instead of SetDBHost = my-db-server.some-subdomain.example.com ?
I tried that (which would not have been a viable long-term solution) and it also did not solve the problem.

As it turns out, I didn't remove the comment in front of this line in the samhainrc file:
Code:
[Database]
I wasn't aware I needed to uncomment this line but apparently if you don't uncomment it, samhain falls back on the defaults, which would mean setDBHost would be localhost.

This problem is solved.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Frustration: Can't connect to local MySQL server through socket '/usr/local/mysql-5.0 nidala Linux - Newbie 1 09-27-2008 11:20 PM
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. SpellChainz Linux - Software 3 06-28-2007 11:46 AM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. SpellChainz Linux - Newbie 1 06-23-2007 03:35 PM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. Dannux Linux - Software 3 03-24-2006 08:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 11:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration