Page 2 of 2

Re: nagiosql.loginNAGIOSQL LOGIN FAILED

Posted: Thu Jul 13, 2017 2:13 pm
by dwhitfield
Lets try and reset the Security Credentials and see if that resolves the issue.
In the XI GUI, Click on Admin > Reset Security Credentials and click on the Update Credentials button.
Try that and let us know how it works for you.

Also, what's the output of ls -l /usr/local/nagiosxi/html/includes/components/ccm/?

Re: nagiosql.loginNAGIOSQL LOGIN FAILED

Posted: Fri Jul 14, 2017 5:54 am
by vmwareguy
dwhitfield wrote:Lets try and reset the Security Credentials and see if that resolves the issue.
In the XI GUI, Click on Admin > Reset Security Credentials and click on the Update Credentials button.
Try that and let us know how it works for you.

Also, what's the output of ls -l /usr/local/nagiosxi/html/includes/components/ccm/?
Here is the output -
total 152
-rw-r-----. 1 nagios nagios 13648 Jul 13 12:12 ajax.php
-rw-r-----. 1 nagios nagios 24042 Jul 13 12:12 ccm.inc.php
-rw-r-----. 1 nagios nagios 17450 Jul 13 12:12 ccm-splash.inc.php
-rw-r-----. 1 nagios nagios 15310 Jul 13 12:12 CHANGES.txt
drwxr-x---. 2 nagios nagios 4096 May 20 2016 classes
-rw-r-----. 1 nagios nagios 6552 Jul 13 12:12 command_test.php
-rw-r-----. 1 nagios nagios 1618 Jul 13 12:12 config.inc.php
drwxr-x---. 2 nagios nagios 4096 May 20 2016 css
-rw-r-----. 1 nagios nagios 4252 Jul 13 12:12 download.php
drwxr-x---. 2 nagios nagios 4096 Jul 13 12:12 images
drwxr-x---. 2 nagios nagios 4096 May 20 2016 includes
-rw-r-----. 1 nagios nagios 7821 Jul 13 12:12 index.php
drwxr-x---. 2 nagios nagios 4096 May 20 2016 javascript
-rw-r-----. 1 nagios nagios 4128 Jul 13 12:12 LICENSE.txt
drwxr-x---. 2 nagios nagios 4096 Jul 13 12:12 page_templates
-rw-r-----. 1 nagios nagios 4577 Jul 8 2016 sanity.sh
drwxr-x---. 3 nagios nagios 4096 May 20 2016 templates
-rw-r-----. 1 nagios nagios 2099 Jul 13 12:12 xi-index.php

I will reset the security credentials and try the upgrade again.

Re: nagiosql.loginNAGIOSQL LOGIN FAILED

Posted: Fri Jul 14, 2017 6:20 am
by vmwareguy
Same error as before

Resolving localhost... 127.0.0.1, ::1
Connecting to localhost|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 500 Internal Server Error
2017-07-14 07:19:39 ERROR 500: Internal Server Error.

NAGIOSQL LOGIN FAILED!

Re: nagiosql.loginNAGIOSQL LOGIN FAILED

Posted: Fri Jul 14, 2017 3:05 pm
by tgriep
There is a permission issue with that PHP script causing the Apache 500 error.
To fix it, login as root to the server and run the following

Code: Select all

chown nagios.nagios /usr/local/nagiosxi/html/includes/phpmailer/PHPMailerAutoload.php
chmod 640 /usr/local/nagiosxi/html/includes/phpmailer/PHPMailerAutoload.php
If that is resolved, and you are still getting the SQL login error, login to the XI GUI and go to the Admin > Reset Security Credentials menu and just click the Update Credentials button without changing anything.
Then check and see if the SQL login error is resolved.

Re: nagiosql.loginNAGIOSQL LOGIN FAILED

Posted: Mon Jul 17, 2017 7:42 am
by vmwareguy
tgriep wrote:There is a permission issue with that PHP script causing the Apache 500 error.
To fix it, login as root to the server and run the following

Code: Select all

chown nagios.nagios /usr/local/nagiosxi/html/includes/phpmailer/PHPMailerAutoload.php
chmod 640 /usr/local/nagiosxi/html/includes/phpmailer/PHPMailerAutoload.php
If that is resolved, and you are still getting the SQL login error, login to the XI GUI and go to the Admin > Reset Security Credentials menu and just click the Update Credentials button without changing anything.
Then check and see if the SQL login error is resolved.
I don't have a PHPMailerAutoload.php file - this is all that's in the phpmailer folder

root@server phpmailer]# ls
class.phpmailer.php class.pop3.php class.smtp.php


I am back to a pre upgrade attempt - do I need to run the upgrade again for this file to be created?

Re: nagiosql.loginNAGIOSQL LOGIN FAILED

Posted: Mon Jul 17, 2017 8:30 am
by vmwareguy
So I reran the install and now the file is there -

[root@Chunk includes]# cd phpmailer/
[root@Chunk phpmailer]# ls
class.phpmailer.php class.pop3.php class.smtp.php PHPMailerAutoload.php
[root@Chunk phpmailer]# ls -la
total 212
drwxr-x---. 2 nagios nagios 4096 Jul 17 09:16 .
drwxr-x---. 11 nagios nagios 4096 Jul 17 09:16 ..
-rwxr-x---. 1 nagios nagios 146762 Jul 17 09:16 class.phpmailer.php
-rwxr-x---. 1 nagios nagios 11005 Jul 17 09:16 class.pop3.php
-rwxr-x---. 1 nagios nagios 42194 Jul 17 09:16 class.smtp.php
-rw-------. 1 nagios nagios 1688 Jul 17 09:16 PHPMailerAutoload.php
[root@Chunk phpmailer]# chown nagios.nagios /usr/local/nagiosxi/html/includes/phpmailer/PHPMailerAutoload.php
[root@Chunk phpmailer]# chmod 640 /usr/local/nagiosxi/html/includes/phpmailer/PHPMailerAutoload.php
[root@Chunk phpmailer]# ls -la
total 212
drwxr-x---. 2 nagios nagios 4096 Jul 17 09:16 .
drwxr-x---. 11 nagios nagios 4096 Jul 17 09:16 ..
-rwxr-x---. 1 nagios nagios 146762 Jul 17 09:16 class.phpmailer.php
-rwxr-x---. 1 nagios nagios 11005 Jul 17 09:16 class.pop3.php
-rwxr-x---. 1 nagios nagios 42194 Jul 17 09:16 class.smtp.php
-rw-r-----. 1 nagios nagios 1688 Jul 17 09:16 PHPMailerAutoload.php
[root@Chunk phpmailer]# reboot


before and after running your recommended command - but I still can log in

This page isn’t working

chunk.mysite.com is currently unable to handle this request.
HTTP ERROR 500

Re: nagiosql.loginNAGIOSQL LOGIN FAILED

Posted: Mon Jul 17, 2017 8:48 am
by tgriep
On thing to do is to verify the settings in this KB article if your system in behind a proxy server.
https://support.nagios.com/kb/article/n ... oxies.html
If after going through the KB article, you still have issues, do the following

Run this while logged in as root to the Nagios server.

Code: Select all

tail -f /var/log/httpd/*_log
Then try and login to the XI GUI and if you still cannot login, post the full output of the tail command.

Re: nagiosql.loginNAGIOSQL LOGIN FAILED

Posted: Mon Jul 17, 2017 9:18 am
by vmwareguy
tgriep wrote:On thing to do is to verify the settings in this KB article if your system in behind a proxy server.
https://support.nagios.com/kb/article/n ... oxies.html
If after going through the KB article, you still have issues, do the following

Run this while logged in as root to the Nagios server.

Code: Select all

tail -f /var/log/httpd/*_log
Then try and login to the XI GUI and if you still cannot login, post the full output of the tail command.
I've already made all of the recommended proxy changes.

Here is the tail

Code: Select all

==> /var/log/httpd/ssl_access_log <==
160.107.103.23 - - [17/Jul/2017:08:57:01 -0400] "GET /nagiosxi/ajaxhelper.php?cmd=getxicoreajax&opts=%7B%22func%22%3A%22get_pagetop_alert_content_html%22%2C%22args%22%3A%22%22%7D&nsp=3fc016b2dd6a9f54f22d818a12d709755217adfe2a7d26b3fbc69e372f551331 HTTP/1.1" 200 1260
160.107.103.23 - - [17/Jul/2017:08:57:01 -0400] "GET /nagiosxi/ajaxhelper.php?cmd=getxicoreajax&opts=%7B%22func%22%3A%22get_tray_alert_html%22%2C%22args%22%3A%22%22%7D&nsp=3fc016b2dd6a9f54f22d818a12d709755217adfe2a7d26b3fbc69e372f551331 HTTP/1.1" 200 1129
160.107.103.23 - - [17/Jul/2017:08:57:31 -0400] "GET /nagiosxi/ajaxhelper.php?cmd=getxicoreajax&opts=%7B%22func%22%3A%22get_pagetop_alert_content_html%22%2C%22args%22%3A%22%22%7D&nsp=3fc016b2dd6a9f54f22d818a12d709755217adfe2a7d26b3fbc69e372f551331 HTTP/1.1" 200 1260
160.107.103.23 - - [17/Jul/2017:08:57:31 -0400] "GET /nagiosxi/ajaxhelper.php?cmd=getxicoreajax&opts=%7B%22func%22%3A%22get_tray_alert_html%22%2C%22args%22%3A%22%22%7D&nsp=3fc016b2dd6a9f54f22d818a12d709755217adfe2a7d26b3fbc69e372f551331 HTTP/1.1" 200 1129
160.107.103.23 - - [17/Jul/2017:08:58:01 -0400] "GET /nagiosxi/ajaxhelper.php?cmd=getxicoreajax&opts=%7B%22func%22%3A%22get_tray_alert_html%22%2C%22args%22%3A%22%22%7D&nsp=3fc016b2dd6a9f54f22d818a12d709755217adfe2a7d26b3fbc69e372f551331 HTTP/1.1" 200 1129
160.107.103.23 - - [17/Jul/2017:08:58:01 -0400] "GET /nagiosxi/ajaxhelper.php?cmd=getxicoreajax&opts=%7B%22func%22%3A%22get_pagetop_alert_content_html%22%2C%22args%22%3A%22%22%7D&nsp=3fc016b2dd6a9f54f22d818a12d709755217adfe2a7d26b3fbc69e372f551331 HTTP/1.1" 200 1260
160.107.103.23 - - [17/Jul/2017:09:28:35 -0400] "GET /nagiosxi/login.php?redirect=/nagiosxi/index.php%3f&noauth=1 HTTP/1.1" 500 -
160.107.103.23 - - [17/Jul/2017:09:40:15 -0400] "GET /nagiosxi/login.php?redirect=/nagiosxi/index.php%3f&noauth=1 HTTP/1.1" 500 -
160.107.103.23 - - [17/Jul/2017:10:12:23 -0400] "GET /nagiosxi/login.php?redirect=/nagiosxi/index.php%3f&noauth=1 HTTP/1.1" 500 -
160.107.103.23 - - [17/Jul/2017:10:16:39 -0400] "GET /nagiosxi/login.php?redirect=/nagiosxi/index.php%3f&noauth=1 HTTP/1.1" 500 -

==> /var/log/httpd/ssl_error_log <==
[Mon Jul 17 09:03:45 2017] [warn] RSA server certificate CommonName (CN) `Chunk.spf.nawcad.navy.mil' does NOT match server name!?
[Mon Jul 17 09:03:45 2017] [warn] RSA server certificate CommonName (CN) `Chunk.spf.nawcad.navy.mil' does NOT match server name!?
[Mon Jul 17 09:25:44 2017] [warn] RSA server certificate CommonName (CN) `Chunk.spf.nawcad.navy.mil' does NOT match server name!?
[Mon Jul 17 09:25:46 2017] [warn] RSA server certificate CommonName (CN) `Chunk.spf.nawcad.navy.mil' does NOT match server name!?
[Mon Jul 17 09:28:35 2017] [error] [client 160.107.103.23] PHP Warning:  require_once(/usr/local/nagiosxi/html/includes/utils-rrdexport.inc.php): failed to open stream: Permission denied in /usr/local/nagiosxi/html/includes/utils.inc.php on line 38
[Mon Jul 17 09:33:22 2017] [warn] RSA server certificate CommonName (CN) `Chunk.spf.nawcad.navy.mil' does NOT match server name!?
[Mon Jul 17 09:33:22 2017] [warn] RSA server certificate CommonName (CN) `Chunk.spf.nawcad.navy.mil' does NOT match server name!?
[Mon Jul 17 09:40:15 2017] [error] [client 160.107.103.23] PHP Warning:  require_once(/usr/local/nagiosxi/html/includes/utils-rrdexport.inc.php): failed to open stream: Permission denied in /usr/local/nagiosxi/html/includes/utils.inc.php on line 38
[Mon Jul 17 10:12:23 2017] [error] [client 160.107.103.23] PHP Warning:  require_once(/usr/local/nagiosxi/html/includes/utils-rrdexport.inc.php): failed to open stream: Permission denied in /usr/local/nagiosxi/html/includes/utils.inc.php on line 38
[Mon Jul 17 10:16:39 2017] [error] [client 160.107.103.23] PHP Warning:  require_once(/usr/local/nagiosxi/html/includes/utils-rrdexport.inc.php): failed to open stream: Permission denied in /usr/local/nagiosxi/html/includes/utils.inc.php on line 38

==> /var/log/httpd/ssl_request_log <==
[17/Jul/2017:08:57:01 -0400] 160.107.103.23 TLSv1.2 ECDHE-RSA-AES128-GCM-SHA256 "GET /nagiosxi/ajaxhelper.php?cmd=getxicoreajax&opts=%7B%22func%22%3A%22get_pagetop_alert_content_html%22%2C%22args%22%3A%22%22%7D&nsp=3fc016b2dd6a9f54f22d818a12d709755217adfe2a7d26b3fbc69e372f551331 HTTP/1.1" 1260
[17/Jul/2017:08:57:01 -0400] 160.107.103.23 TLSv1.2 ECDHE-RSA-AES128-GCM-SHA256 "GET /nagiosxi/ajaxhelper.php?cmd=getxicoreajax&opts=%7B%22func%22%3A%22get_tray_alert_html%22%2C%22args%22%3A%22%22%7D&nsp=3fc016b2dd6a9f54f22d818a12d709755217adfe2a7d26b3fbc69e372f551331 HTTP/1.1" 1129
[17/Jul/2017:08:57:31 -0400] 160.107.103.23 TLSv1.2 ECDHE-RSA-AES128-GCM-SHA256 "GET /nagiosxi/ajaxhelper.php?cmd=getxicoreajax&opts=%7B%22func%22%3A%22get_pagetop_alert_content_html%22%2C%22args%22%3A%22%22%7D&nsp=3fc016b2dd6a9f54f22d818a12d709755217adfe2a7d26b3fbc69e372f551331 HTTP/1.1" 1260
[17/Jul/2017:08:57:31 -0400] 160.107.103.23 TLSv1.2 ECDHE-RSA-AES128-GCM-SHA256 "GET /nagiosxi/ajaxhelper.php?cmd=getxicoreajax&opts=%7B%22func%22%3A%22get_tray_alert_html%22%2C%22args%22%3A%22%22%7D&nsp=3fc016b2dd6a9f54f22d818a12d709755217adfe2a7d26b3fbc69e372f551331 HTTP/1.1" 1129
[17/Jul/2017:08:58:01 -0400] 160.107.103.23 TLSv1.2 ECDHE-RSA-AES128-GCM-SHA256 "GET /nagiosxi/ajaxhelper.php?cmd=getxicoreajax&opts=%7B%22func%22%3A%22get_tray_alert_html%22%2C%22args%22%3A%22%22%7D&nsp=3fc016b2dd6a9f54f22d818a12d709755217adfe2a7d26b3fbc69e372f551331 HTTP/1.1" 1129
[17/Jul/2017:08:58:01 -0400] 160.107.103.23 TLSv1.2 ECDHE-RSA-AES128-GCM-SHA256 "GET /nagiosxi/ajaxhelper.php?cmd=getxicoreajax&opts=%7B%22func%22%3A%22get_pagetop_alert_content_html%22%2C%22args%22%3A%22%22%7D&nsp=3fc016b2dd6a9f54f22d818a12d709755217adfe2a7d26b3fbc69e372f551331 HTTP/1.1" 1260
[17/Jul/2017:09:28:35 -0400] 160.107.103.23 TLSv1.2 ECDHE-RSA-AES128-GCM-SHA256 "GET /nagiosxi/login.php?redirect=/nagiosxi/index.php%3f&noauth=1 HTTP/1.1" -
[17/Jul/2017:09:40:15 -0400] 160.107.103.23 TLSv1.2 ECDHE-RSA-AES128-GCM-SHA256 "GET /nagiosxi/login.php?redirect=/nagiosxi/index.php%3f&noauth=1 HTTP/1.1" -
[17/Jul/2017:10:12:23 -0400] 160.107.103.23 TLSv1.2 ECDHE-RSA-AES128-GCM-SHA256 "GET /nagiosxi/login.php?redirect=/nagiosxi/index.php%3f&noauth=1 HTTP/1.1" -
[17/Jul/2017:10:16:39 -0400] 160.107.103.23 TLSv1.2 ECDHE-RSA-AES128-GCM-SHA256 "GET /nagiosxi/login.php?redirect=/nagiosxi/index.php%3f&noauth=1 HTTP/1.1" -

==> /var/log/httpd/ssl_error_log <==
[Mon Jul 17 10:17:08 2017] [error] [client 160.107.103.23] PHP Warning:  require_once(/usr/local/nagiosxi/html/includes/utils-rrdexport.inc.php): failed to open stream: Permission denied in /usr/local/nagiosxi/html/includes/utils.inc.php on line 38

==> /var/log/httpd/ssl_access_log <==
160.107.103.23 - - [17/Jul/2017:10:17:08 -0400] "GET /nagiosxi/login.php?redirect=/nagiosxi/index.php%3f&noauth=1 HTTP/1.1" 500 -

==> /var/log/httpd/ssl_request_log <==
[17/Jul/2017:10:17:08 -0400] 160.107.103.23 TLSv1.2 ECDHE-RSA-AES128-GCM-SHA256 "GET /nagiosxi/login.php?redirect=/nagiosxi/index.php%3f&noauth=1 HTTP/1.1" -

Re: nagiosql.loginNAGIOSQL LOGIN FAILED

Posted: Mon Jul 17, 2017 9:29 am
by vmwareguy
Looks like I got it working -

I found this thread https://support.nagios.com/forum/viewto ... 16&t=35730 and ran

Code: Select all

cd /usr/local/nagiosxi/html
find . -type f -exec chmod 640 {} \;
find . -type d -exec chmod 750 {} \;
I can now log into the system.

Thanks for the help

Re: nagiosql.loginNAGIOSQL LOGIN FAILED

Posted: Mon Jul 17, 2017 9:32 am
by tgriep
There are more permission issues with the PHP scripts that Nagios uses. Let's fix all of them by running the following as root.

Code: Select all

chown nagios.nagios /usr/local/nagiosxi/html/includes/*
chmod 640 /usr/local/nagiosxi/html/includes/*
If you still see the "failed to open stream" error in the ssl_error_log file, reset the permissions and see if you can login after they have been fixed.