Nagios Core 4.0.8 Unauthorized Login / New User

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
lingpanda
Posts: 10
Joined: Wed Sep 03, 2014 10:19 am

Nagios Core 4.0.8 Unauthorized Login / New User

Post by lingpanda »

Hello,

Installed Nagios from source on Ubuntu 14.04.1 LTS per the following link http://wellsie.net/p/512/ I can successfully log into the CGI with nagiosadmin. I created a new user via

Code: Select all

htpasswd  /usr/local/nagios/etc/htpasswd.users newuser
This user is unable to login to the CGI. Receive invalid user name or password.

Code: Select all

#cat /etc/apache2/conf-enabled/nagios.conf
has the following

Code: Select all

# 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
   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
</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 Access"
   AuthType Basic
   AuthUserFile /usr/local/nagios/etc/htpasswd.users
   Require valid-user
</Directory>

Code: Select all

#cat /etc/apache2/conf-available/nagios.conf
has the following

Code: Select all

# 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
   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
</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 Access"
   AuthType Basic
   AuthUserFile /usr/local/nagios/etc/htpasswd.users
   Require valid-user
</Directory>
Apache2 access.log has the following

Code: Select all

172.16.232.30 - - [01/Oct/2014:12:25:59 -0400] "GET /nagios/ HTTP/1.1" 401 725 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"
172.16.232.30 - [b]newuser[/b] [01/Oct/2014:12:26:06 -0400] "GET /nagios/ HTTP/1.1" 401 725 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"
File permissions on htpasswd.users is

Code: Select all

-rw-r--r-- 1 nagios nagcmd 50 Aug 29 12:15 /usr/local/nagios/etc/htpasswd.users
Any assistance please? Thanks.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Nagios Core 4.0.8 Unauthorized Login / New User

Post by abrist »

1) Have you added that use to cgi.cfg (if you are trying to access a restricted cgi)?
2) Check the htpass file for the user:

Code: Select all

cat /usr/local/nagios/etc/htpasswd.users
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
lingpanda
Posts: 10
Joined: Wed Sep 03, 2014 10:19 am

Re: Nagios Core 4.0.8 Unauthorized Login / New User

Post by lingpanda »

abrist wrote:1) Have you added that use to cgi.cfg (if you are trying to access a restricted cgi)?
2) Check the htpass file for the user:

Code: Select all

cat /usr/local/nagios/etc/htpasswd.users
Sometimes things can be so simple! Ran cat and new user was not in file. Strange. Ran again and verified user was created and was able to go in successfully! I believe I know the root cause. When i first ran

Code: Select all

htpasswd /usr/local/nagios/etc/htpasswd.users newuser
file permissions showed root as owner and group. I changed them after the fact. Thanks!
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Nagios Core 4.0.8 Unauthorized Login / New User

Post by sreinhardt »

You're welcome! Glad that all worked out.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Locked