Login.php corrupt

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
TenTimes
Posts: 40
Joined: Fri Oct 14, 2011 9:54 am

Login.php corrupt

Post by TenTimes »

When I want to log in to Nagios XI it gives me a empty page where the log in screen was. This is after i connected to x.x.x.x and got the continue to Nagios XI screen.
When I tried to restart Nagios, the command line gave me a config error which after some research had to do with the services configuration. When I corrected this, Nagios started just fine, but I still couldnt't login. I can login to Nagios Core, but I need the config options from Nagios XI.

Some more research led to the discovery that my login.php file was probably corrupted because all the other PHP files are just code (I can't read PHP yet) but the login.php is all just garbled letters and numbers. Is there a place where I can download a new login.php file or do I have to start over from scratch (which isn't a problem)?

This problem occured when I installed the X Window system with KDE on the CentOS machine. I use the virtual appliance with CentOS 6.

Thanks for helping.

-Edit-
I researched some more and found the login.php file of another test version of Nagios XI. This file has the same crazy code which I don't understand. I still think there is something wrong with this file because I haven't changed any of the PHP files.
To make it easier for you guys I include the code here.

Code: Select all

<?php @"SourceGuardian"; //v8.2 ?><?php // Copyright (c) 2008-2010 Nagios Enterprises, LLC.  All rights reserved. ?><?php
if(!function_exists('sg_load')){$__v=phpversion();$__x=explode('.',$__v);$__n=$__x[0]*10000+$__x[1]*100+$__x[2];$__u=strtolower(substr(php_uname(),0,3));$__f=$__f0='ixed.'.substr($__v,0,strpos($__v,'.',3)).'.'.$__u;$__ff=$__ff0='ixed.'.$__v.'.'.$__u;$__ed=ini_get('extension_dir');if(!$__e=realpath($__ed)) die('extension_dir does not exist: '.$__ed);if($__n<50205){$__d=getcwd();if(@$__d[1]==':'){$__d=str_replace('\\','/',substr($__d,2));$__e=str_replace('\\','/',substr($__e,2));}$__e.=($__h=str_repeat('/..',substr_count($__e,'/')));$__f='/ixed/'.$__f;$__ff='/ixed/'.$__ff;while(!file_exists($__e.$__d.$__ff) && !file_exists($__e.$__d.$__f) && strlen($__d)>1){$__d=dirname($__d);}if (file_exists($__e.$__d.$__ff)) dl($__h.$__d.$__ff);else if (file_exists($__e.$__d.$__f)) dl($__h.$__d.$__f);}if(!function_exists('sg_load')){if(file_exists($__e.'/'.$__ff0)) dl($__ff0);else if(file_exists($__e.'/'.$__f0)) dl($__f0);}if(!function_exists('sg_load')){die('PHP script <B>'.__FILE__.'</B> is protected by <A HREF="http://www.sourceguardian.com/">SourceGuardian</A> and requires the SourceGuardian loader <B>'.$__f0.'</B>. The SourceGuardian loader has not been installed, or is not installed correctly. Please find the required loader within SourceGuardian installation directory or visit the <A HREF="http://www.sourceguardian.com/ixeds/">SourceGuardian php encoder</A> site to download it.');exit();}}return sg_load('E6A4CE1AD86196B2AAQAAAARAAAABHAAAACABAAAAAAAAAD/G2i/sqE/YFCOn/NJqq41V2NJLfPOKshYuiTL8f7rExZguiHxZxDBBbWf9ILET/9W9mW8iN9tlUujlJaAnaq2utL9cdbGJpgpMECzeOdIKYmk1PQw2BuLB9pgRviMeD06TfpemXk8u1Bz8hVdLD053AUAAAAoTgAATlWIgXkH2fWT1K2Zf2vnsiXniPn6jKhPyZEkcu/HUQMhZRI0IxgGEI9ZYnF7lA50XUDT58EtT9knKSkVCjHio4B4/gMz92tzGahbfB4Tzyx5c/ZXPR/OIAoGiugBgm3moMGolct2proocMcbJIQiwNBYr5/TDgCzkHJRrnjOGXL5j0woKXuAn1BVHugbFcaaIu8joJWOjZJafWX1A3S/1T+dCYGBiG5WiI1B8rBICq01nMwu+zn06bQXFZRDZIrIV9LhYZujEttOki1EfKa3dWQpGyMErADUwhA63UGqu1glMNuCUm6z7WhBnpxloyB/vsSi0mipq7RBHT5DSKaA1anO+/XMO+c4jMOfjwdQrJfz4BoORBs/QCthtkxLAv2bXLbvD3MMmf9ZqXLtfHKMYvATKZi7GPcIyET/Wf3i2LwQLckKP70Z9X6hBMV1zuhiHErrMZXSGO/67EjvowH49ln3bYVUrlZAlu4ePOMJKgCmj1RusGHiE+SpZdzFg1wMeLzARjyEKnVrR84JW/Ag4vTrRL9jxmBineJivAB52MsjW/4ZYSl/8HrQdoKETjageoQ2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DArA5i8dQQmnI4C2cmnFiaqBQXmAFqIEMYJq0vbrvFsbiqc6Btf/Ud/ybPskQ78aMBoUGBGYGhCxoNsVu5Jk+QWaLKjA02ujbu3nhbhTgdmndqiFyclnWoHuteUbqblUR15DJ2supC9bsG8xcAj6dLNrXd25Cjh/+1YJuZf7Kh6kp2jcTO0cLvuFLdLso6OJGuLeVP8GNyrB3qjcefYGLEerUtC9ir26uhBzsE+XrfV2S85Jh+lYm2pbn3rl4nC33fvVLMfSJfYuJz7V64kmIT6O70DrqATv4a1blC0TRWJ4V/bDz3wCmxrgSqISC1z/TGx9X/b273tU8c1pqTQ9eDh9N60njAW8XQ6XKHrk56VrN/JxmRyvs2i+UPe+ktNX4cpWAMxIwI9V6UXXfnI02CnnSpgXm1wx233SzgukCIjUUT8o3nGgqJObisSkm6nX7Udin+mRut+kp073/yi9I650ZIkDgTXKuyYQG3QwpH6fWx57bft1um83T9ymN3Aas2cJskqQWTM/Y2FvTREhKvr/lsNN1Chmx4inmxDTc2+l2oe36ufKx67lZ5y1EHrM9egB3y9heU7yqaACXSJitpPjP/aBu0LL+MQ6LcLm5RZxFFapwJolp9m7jZRKh1oa2Js9CkD2Wqfb8jNfkXXS0FW7HfUzh3xlOmP7NJ8GDaIBkNE9IqF4cz//ZJqLRoBzmO2mqIvlSdPoA4CbqLjo3cmUO8SysGlHJPsJi
..........
And so on. The code is to long to post. :D 
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Login.php corrupt

Post by lmiltchev »

Type in your browser: htt://<your_nagios_server_IP_address>/nagiosxi and try to log in, then run in terminal the following commands and post the output:

Code: Select all

# tail /var/log/httpd/error_log
# tail /var/log/messages
Be sure to check out our Knowledgebase for helpful articles and solutions!
TenTimes
Posts: 40
Joined: Fri Oct 14, 2011 9:54 am

Re: Login.php corrupt

Post by TenTimes »

When I entered the commands, I got this back:

Code: Select all

=~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2011.11.29 09:25:51 =~=~=~=~=~=~=~=~=~=~=~=
login as: root
Access denied
[email protected]'s password: 
Last login: Tue Nov 29 08:21:45 2011 from 192.168.2.15

[root@nagios ~]# tail /var/log/httpd/error_log
[Sun Nov 27 03:16:03 2011] [notice] Apache/2.2.15 (Unix) DAV/2 PHP/5.3.2 configured -- resuming normal operations
[Mon Nov 28 14:44:37 2011] [error] [client 192.168.2.14] PHP Warning:  mysql_pconnect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /usr/local/nagiosxi/html/db/adodb/drivers/adodb-mysql.inc.php on line 383
[Mon Nov 28 14:44:37 2011] [error] [client 192.168.2.14] PHP Warning:  mysql_pconnect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /usr/local/nagiosxi/html/db/adodb/drivers/adodb-mysql.inc.php on line 383
[Mon Nov 28 14:44:54 2011] [error] [client 192.168.2.14] PHP Warning:  mysql_pconnect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /usr/local/nagiosxi/html/db/adodb/drivers/adodb-mysql.inc.php on line 383, referer: http://192.168.2.11/
[Mon Nov 28 14:44:54 2011] [error] [client 192.168.2.14] PHP Warning:  mysql_pconnect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /usr/local/nagiosxi/html/db/adodb/drivers/adodb-mysql.inc.php on line 383, referer: http://192.168.2.11/
[Mon Nov 28 14:45:05 2011] [error] [client 192.168.2.14] PHP Warning:  mysql_pconnect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /usr/local/nagiosxi/html/db/adodb/drivers/adodb-mysql.inc.php on line 383
[Mon Nov 28 14:45:05 2011] [error] [client 192.168.2.14] PHP Warning:  mysql_pconnect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /usr/local/nagiosxi/html/db/adodb/drivers/adodb-mysql.inc.php on line 383
[Tue Nov 29 08:21:16 2011] [error] [client 192.168.2.15] PHP Warning:  mysql_pconnect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /usr/local/nagiosxi/html/db/adodb/drivers/adodb-mysql.inc.php on line 383
[Tue Nov 29 08:21:16 2011] [error] [client 192.168.2.15] PHP Warning:  mysql_pconnect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /usr/local/nagiosxi/html/db/adodb/drivers/adodb-mysql.inc.php on line 383
[Tue Nov 29 08:21:16 2011] [error] [client 192.168.2.15] File does not exist: /var/www/html/favicon.ico
[root@nagios ~]# tail /var/log/measssages
Nov 29 08:26:30 nagios ndo2db: Error: Could not connect to MySQL database: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Nov 29 08:26:30 nagios ndo2db: Error: Could not connect to MySQL database: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Nov 29 08:26:30 nagios ndo2db: Error: Could not connect to MySQL database: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Nov 29 08:26:30 nagios ndo2db: Error: Could not connect to MySQL database: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Nov 29 08:26:30 nagios ndo2db: Error: Could not connect to MySQL database: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Nov 29 08:26:30 nagios ndo2db: Error: Could not connect to MySQL database: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Nov 29 08:26:30 nagios ndo2db: Error: Could not connect to MySQL database: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Nov 29 08:26:30 nagios ndo2db: Error: Could not connect to MySQL database: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Nov 29 08:26:30 nagios ndo2db: Error: Could not connect to MySQL database: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Nov 29 08:26:30 nagios ndo2db: Error: Could not connect to MySQL database: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
[root@nagios ~]# 
TenTimes
Posts: 40
Joined: Fri Oct 14, 2011 9:54 am

Re: Login.php corrupt

Post by TenTimes »

I fixed the problem.

When you asked to send the logfile (which I didn't find before yout suggestion, thanks) I looked at the logfile and saw that the problem was the mysql.sock file.
It didn't exsist so I tried to find a solution to this.

This was the instrustion to fix this:

1) Stop MySQL server,
2) Type safe_mysqld --socket=/var/lib/mysql/mysql.sock
3) ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
4) Start MySQL . ( Recommended )

I als found out that there (strangely) no MySQL service installed on the server. With "yum groupinstall mysql" I installed the MySQL server role and then stopped the service.
The second step didn't work, so went on with step 3 like this:

ln -s /var/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock

After this, I started the MySQL service again and Nagios XI login worked. The sad thing is the trial licence has expired, so I need to buy a licence.

Thanks for looking into this, and I hope this post is usefull for other people.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Login.php corrupt

Post by lmiltchev »

I'm glad you got it fixed! Thanks for the feedback, TenTimes!
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked