Page 1 of 1

Error cgi htpasswd.users

Posted: Tue Aug 29, 2017 7:13 am
by abe780
Hi everybody

I'm new in nagios and I have a problem with the authentication cgi's.

I have configured authentication with active directory in nagios xi.

When I created users using the menu "Manage Users" and I put the option Authentication Settings with the authentication type as active drectory till some days ago the file /usr/local/nagios/etc/htpasswd.users was updated correctly.

But the new users are not added as usual , I have to make it manually

htpasswd -s /usr/local/nagios/etc/htpasswd.users xxxxxxxxx

My config in nagios.conf is :

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

<Directory "/usr/local/nagios/sbin">
# SSLRequireSSL
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
AuthName "Nagios Core"
AuthType Basic
AuthUserFile "/usr/local/nagios/etc/htpasswd.users"
Require valid-user
Require all denied
</Directory>

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

<Directory "/usr/local/nagios/share">
# SSLRequireSSL
Options None
AllowOverride None
Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
AuthName "Nagios Core"
AuthType Basic
AuthUserFile "/usr/local/nagios/etc/htpasswd.users"
Require valid-user
Require all denied
</Directory>

Do you have some idea about the problem ?

Thanks in advance

Re: Error cgi htpasswd.users

Posted: Tue Aug 29, 2017 11:18 am
by scottwilkerson
This is because in nagios XI a different file is used:
/usr/local/nagiosxi/etc/htpasswd.users

Your config should look like this

Code: Select all

# SAMPLE CONFIG SNIPPETS FOR APACHE WEB SERVER
# Last Modified: 11-26-2005
#
# 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
   Order allow,deny
   Allow from all
#  Order deny,allow
#  Deny from all
#  Allow from 127.0.0.1
   AuthName "Nagios Core"
   AuthType Basic
   AuthUserFile /usr/local/nagiosxi/etc/htpasswd.users
   Require valid-user
</Directory>

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

<Directory "/usr/local/nagios/share">
#  SSLRequireSSL
   Options None
   AllowOverride None
   Order allow,deny
   Allow from all
#  Order deny,allow
#  Deny from all
#  Allow from 127.0.0.1
   AuthName "Nagios Core"
   AuthType Basic
   AuthUserFile /usr/local/nagiosxi/etc/htpasswd.users
   Require valid-user
</Directory>

Re: Error cgi htpasswd.users

Posted: Thu Aug 31, 2017 8:04 am
by abe780
Hello

Thanks for the answer

I updated the file nagios.conf

# SAMPLE CONFIG SNIPPETS FOR APACHE WEB SERVER
# Last Modified: 11-26-2005
#
# 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
Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
AuthName "Nagios Core"
AuthType Basic
AuthUserFile "/usr/local/nagiosxi/etc/htpasswd.users"
Require valid-user
Require all denied
</Directory>

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

<Directory "/usr/local/nagios/share">
# SSLRequireSSL
Options None
AllowOverride None
Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
AuthName "Nagios Core"
AuthType Basic
AuthUserFile "/usr/local/nagiosxi/etc/htpasswd.users"
Require valid-user
Require all denied
</Directory>

I puted the file in the location indicated in the file but it's continue without adding the new users

thanks in advance

Re: Error cgi htpasswd.users

Posted: Thu Aug 31, 2017 9:05 am
by scottwilkerson
You will need to restart httpd

Code: Select all

service httpd restart
Additionally, it will only add the users once the user logs into the Nagios XI UI and accepts the license. Then they will be added to /usr/local/nagiosxi/etc/htpasswd.users and able to login to the Core UI as well

Re: Error cgi htpasswd.users

Posted: Fri Sep 01, 2017 4:00 am
by abe780
Hi

It works , You are right after accept the terms the user appears in the file htpasswd.users

Thank you very much

Re: Error cgi htpasswd.users

Posted: Fri Sep 01, 2017 9:03 am
by scottwilkerson
abe780 wrote:Hi

It works , You are right after accept the terms the user appears in the file htpasswd.users

Thank you very much
Glad it is all working for you now.