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?