Page 1 of 1

How to disable Nagios Core GUI authentication

Posted: Wed Feb 27, 2019 10:46 am
by xlin125
We have a Nagios Core v4.2.1 installed on a Ubuntu 16.04 server. We want to disable the Apache authentication when accessing this Nagios Core GUI. What needs to be changed to disable the Apache authentication? Thanks!

Re: How to disable Nagios Core GUI authentication

Posted: Thu Feb 28, 2019 3:04 pm
by benjaminsmith
Hi @xlin125,

This is really not something we would reccomend doing due security issues. That said, here's how I was able to get it working.

Change the following line in the /usr/local/nagios/etc/cgi.cfg from:

Code: Select all

use_authentication=1
# to
use_authentication=0
See: https://assets.nagios.com/downloads/nag ... igcgi.html .. for documentation on this parameter.

Next, you'll need to comment out the authorization lines in the nagios Apache configuration file found in /etc/httpd/conf.d ( be sure to make a backup of this file before changing anything).

Sample File:

Code: Select all

<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

#      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>
Once you make all the changes, restart httpd and nagios:

Code: Select all

service httpd restart
service nagios restart
Then try to access the Nagios home page.

Re: How to disable Nagios Core GUI authentication

Posted: Thu Feb 28, 2019 5:16 pm
by xlin125
@benjaminsmith,
Thanks for the response. I commented out the authentication lines in the Nagios.conf, and restart the Nagios. The authentication is disabled now. However, the Nagios Core Web Interface does not show who is the user, it only shows "Logged in as ?". It seems this unknown user has nagiosadmin privilege. I remember we can set this user to a user defined in the cgi.cfg file (set $USER to a user defined in cgi.cfg). Where is this configuration file? I am searching for it.

Re: How to disable Nagios Core GUI authentication

Posted: Thu Feb 28, 2019 11:31 pm
by xlin125
I found it. It can be set in the cgi.cfg file.

Re: How to disable Nagios Core GUI authentication

Posted: Fri Mar 01, 2019 2:40 pm
by benjaminsmith
Hi @xlin125,
I found it. It can be set in the cgi.cfg file.
Great. Is ok to close this topic or did you have any other questions?

Re: How to disable Nagios Core GUI authentication

Posted: Wed Mar 13, 2019 12:20 pm
by xlin125
@benjaminsmith, thank you! yes, please close this topic.

Re: How to disable Nagios Core GUI authentication

Posted: Wed Mar 13, 2019 12:34 pm
by benjaminsmith
Sounds good. Closing topic.

Thank you for using the Nagios Support Forum.