Can not login the web interface on Nagios Core 4.2

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Alvin Lou
Posts: 1
Joined: Wed Aug 17, 2016 10:15 pm

Can not login the web interface on Nagios Core 4.2

Post by Alvin Lou »

Hello Guys,

Recently I installed the Nagios Core 4.2 on CentOS 6.6 to monitor my system, but after performed all of the steps in the doc, https://assets.nagios.com/downloads/nag ... Source.pdf

I'm not able to login the web interface http://x.x.x.x/nagios. Here is the error message prompted on the web browser,

========================
Authorization Required

This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required.
Apache/2.2.15 (CentOS) Server at x.x.x.x Port 80
========================

And I'm 100% sure that I'm typing the correct password and I even tried to add more users with simple password but got the same issue.

[root@localhost ~]# ll /usr/local/nagios/etc/htpasswd.users
-rw----r--. 1 nagios nagcmd 83 Aug 18 11:18 /usr/local/nagios/etc/htpasswd.users
[root@localhost ~]#

Here is the nagios.cfg,

Code: Select all

[root@localhost ~]# cat /etc/httpd/conf.d/nagios.conf
# SAMPLE CONFIG SNIPPETS FOR APACHE WEB SERVER
#
# This file contains examples of entries that need
# to be incorporated into your Apache web server
# configuration file.  Customize the paths, etc. as
# needed to fit your system.

ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"

<Directory "/usr/local/nagios/sbin">
#  SSLRequireSSL
   Options ExecCGI
   AllowOverride None
   <IfVersion >= 2.3>
      <RequireAll>
         Require all granted
#        Require host 127.0.0.1

         AuthName "Nagios Access"
         AuthType Basic
         AuthUserFile /usr/local/nagios/etc/htpasswd.users
         Require valid-user
      </RequireAll>
   </IfVersion>
   <IfVersion < 2.3>
      Order allow,deny
      Allow from all
#     Order deny,allow
#     Deny from all
#     Allow from 127.0.0.1
     Allow from 127.0.0.1

      AuthName "Nagios Access"
      AuthType Basic
      AuthUserFile /usr/local/nagios/etc/htpasswd.users
      Require valid-user
   </IfVersion>
</Directory>

Alias /nagios "/usr/local/nagios/share"

<Directory "/usr/local/nagios/share">
#  SSLRequireSSL
   Options None
   AllowOverride None
   <IfVersion >= 2.3>
      <RequireAll>
         Require all granted
#        Require host 127.0.0.1

         AuthName "Nagios Access"
         AuthType Basic
         AuthUserFile /usr/local/nagios/etc/htpasswd.users
         Require valid-user
      </RequireAll>
   </IfVersion>
   <IfVersion < 2.3>
      Order allow,deny
      Allow from all
#     Order deny,allow
#     Deny from all
#     Allow from 127.0.0.1

      AuthName "Nagios Access"
      AuthType Basic
      AuthUserFile /usr/local/nagios/etc/htpasswd.users
      Require valid-user
   </IfVersion>
</Directory>
[root@localhost ~]#
Here is the nagios.log,

Code: Select all

[root@localhost ~]# tail -n20 /usr/local/nagios/var/nagios.log
[1471489656] wproc: Registry request: name=Core Worker 1812;pid=1812
[1471489656] Successfully launched command file worker with pid 1825
[1471489925] Caught SIGTERM, shutting down...
[1471489925] Successfully shutdown... (PID=1809)
[1471489925] Event broker module 'NERD' deinitialized successfully.
[1471489925] Nagios 4.2.0 starting... (PID=1911)
[1471489925] Local time is Thu Aug 18 11:12:05 CST 2016
[1471489925] LOG VERSION: 2.0
[1471489925] qh: Socket '/usr/local/nagios/var/rw/nagios.qh' successfully initialized
[1471489925] qh: core query handler registered
[1471489925] nerd: Channel hostchecks registered successfully
[1471489925] nerd: Channel servicechecks registered successfully
[1471489925] nerd: Channel opathchecks registered successfully
[1471489925] nerd: Fully initialized and ready to rock!
[1471489925] wproc: Successfully registered manager as @wproc with query handler
[1471489925] wproc: Registry request: name=Core Worker 1915;pid=1915
[1471489925] wproc: Registry request: name=Core Worker 1916;pid=1916
[1471489925] wproc: Registry request: name=Core Worker 1913;pid=1913
[1471489925] wproc: Registry request: name=Core Worker 1914;pid=1914
[1471489925] Successfully launched command file worker with pid 1925
Here is the apache error logs,

Code: Select all

[root@localhost ~]# tail -n20 /var/log/httpd/error_log
[Thu Aug 18 11:10:31 2016] [error] [client 127.0.0.1] Directory index forbidden by Options directive: /var/www/html/
[Thu Aug 18 11:12:06 2016] [notice] caught SIGTERM, shutting down
[Thu Aug 18 11:12:06 2016] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Thu Aug 18 11:12:06 2016] [notice] Digest: generating secret for digest authentication ...
[Thu Aug 18 11:12:06 2016] [notice] Digest: done
[Thu Aug 18 11:12:06 2016] [notice] Apache/2.2.15 (Unix) DAV/2 PHP/5.3.3 configured -- resuming normal operations
[Thu Aug 18 11:12:10 2016] [error] [client x.x.x.x] File does not exist: /var/www/html/favicon.ico
[Thu Aug 18 11:12:10 2016] [error] [client x.x.x.x] File does not exist: /var/www/html/favicon.ico
[Thu Aug 18 11:12:18 2016] [error] [client x.x.x.x] (13)Permission denied: Could not open password file: /usr/local/nagios/etc/htpasswd.users
[Thu Aug 18 11:12:18 2016] [error] [client x.x.x.x] access to /nagios failed, reason: verification of user id 'nagiosalvin' not configured
[Thu Aug 18 11:12:21 2016] [error] [client x.x.x.x] (13)Permission denied: Could not open password file: /usr/local/nagios/etc/htpasswd.users
[Thu Aug 18 11:12:21 2016] [error] [client x.x.x.x] access to /nagios failed, reason: verification of user id 'test' not configured
[Thu Aug 18 11:15:31 2016] [error] [client 127.0.0.1] Directory index forbidden by Options directive: /var/www/html/
[Thu Aug 18 11:20:31 2016] [error] [client 127.0.0.1] Directory index forbidden by Options directive: /var/www/html/
[Thu Aug 18 11:25:31 2016] [error] [client 127.0.0.1] Directory index forbidden by Options directive: /var/www/html/
[Thu Aug 18 11:30:31 2016] [error] [client 127.0.0.1] Directory index forbidden by Options directive: /var/www/html/
[Thu Aug 18 11:33:49 2016] [error] [client x.x.x.x] (13)Permission denied: Could not open password file: /usr/local/nagios/etc/htpasswd.users
[Thu Aug 18 11:33:49 2016] [error] [client x.x.x.x] access to /nagios failed, reason: verification of user id 'nagiosadmin' not configured
[Thu Aug 18 11:33:53 2016] [error] [client x.x.x.x] File does not exist: /var/www/html/favicon.ico
[Thu Aug 18 11:33:53 2016] [error] [client x.x.x.x] File does not exist: /var/www/html/favicon.ico
Here is the apache access_logs,

Code: Select all

[root@localhost ~]# tail -n20 /var/log/httpd/access_log

127.0.0.1 - - [18/Aug/2016:11:15:31 +0800] "GET / HTTP/1.0" 403 4961 "-" "check_http/v2.1.2 (nagios-plugins 2.1.2)"
127.0.0.1 - - [18/Aug/2016:11:20:31 +0800] "GET / HTTP/1.0" 403 4961 "-" "check_http/v2.1.2 (nagios-plugins 2.1.2)"
127.0.0.1 - - [18/Aug/2016:11:25:31 +0800] "GET / HTTP/1.0" 403 4961 "-" "check_http/v2.1.2 (nagios-plugins 2.1.2)"
127.0.0.1 - - [18/Aug/2016:11:30:31 +0800] "GET / HTTP/1.0" 403 4961 "-" "check_http/v2.1.2 (nagios-plugins 2.1.2)"
x.x.x.x - - [18/Aug/2016:11:33:35 +0800] "GET /nagios HTTP/1.1" 401 480 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:44.0) Gecko/20100101 Firefox/44.0"
x.x.x.x - nagiosadmin [18/Aug/2016:11:33:49 +0800] "GET /nagios HTTP/1.1" 401 480 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:44.0) Gecko/20100101 Firefox/44.0"
x.x.x.x - - [18/Aug/2016:11:33:53 +0800] "GET /favicon.ico HTTP/1.1" 404 288 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:44.0) Gecko/20100101 Firefox/44.0"
x.x.x.x - - [18/Aug/2016:11:33:53 +0800] "GET /favicon.ico HTTP/1.1" 404 288 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:44.0) Gecko/20100101 Firefox/44.0"
[root@localhost ~]#
Do you guys have any idea or any workaround can fix this issue? Much appreciated!
Last edited by mcapra on Thu Aug 18, 2016 8:59 am, edited 1 time in total.
Reason: please wrap long/technical outputs in [code] tags
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Can not login the web interface on Nagios Core 4.2

Post by rkennedy »

What happens if you run chmod 644 /usr/local/nagios/etc/htpasswd.users? The permissions look off, and I think apache might not be able to read it.
Former Nagios Employee
Locked