Page 1 of 2

Unauthorized login in nagios 4.0.8

Posted: Thu Sep 18, 2014 12:22 pm
by rafaelbraga
Hi folks,

I installed the nagios 4.0.8 in my ubuntu 10.04 flowing all step that have in this tutorial:
http://assets.nagios.com/downloads/nagi ... Source.pdf

But when I will login in the web interface always appears this mensage:

Unauthorized

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.

What may be happening? I hope your help!

Thanks!

Re: Unauthorized login in nagios 4.0.8

Posted: Thu Sep 18, 2014 3:47 pm
by slansing
Are you logging in as the nagiosadmin account? Or did you add an additional account? You need to make sure your use whatever you set up with htpasswd:

Code: Select all

htpasswd –c /usr/local/nagios/etc/htpasswd.users nagiosadmin

Re: Unauthorized login in nagios 4.0.8

Posted: Thu Sep 18, 2014 4:55 pm
by rafaelbraga
I using the nagiosadmin account and doesn't include another user.
I've changed the password of the nagiosadmin many times. And don't work. :/
I suspect that the problem can be in the permission of the files in the Apache.

Re: Unauthorized login in nagios 4.0.8

Posted: Fri Sep 19, 2014 12:51 pm
by tmcdonald
What version of apache are you running?

Does anything appear in your apache logs?

Re: Unauthorized login in nagios 4.0.8

Posted: Fri Sep 19, 2014 2:31 pm
by rafaelbraga
Version: 2.4.7-1ubuntu4.1

In the five last request of login have:

127.0.0.1 - - [19/Sep/2014:16:25:17 -0300] "GET /nagios HTTP/1.1" 401 691 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/37.0.2062.94 Chrome/37.0.2062.94 Safari/537.36"
127.0.0.1 - nagiosadmin [19/Sep/2014:16:25:24 -0300] "GET /nagios HTTP/1.1" 401 644 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/37.0.2062.94 Chrome/37.0.2062.94 Safari/537.36"
127.0.0.1 - - [19/Sep/2014:16:25:32 -0300] "GET /nagios HTTP/1.1" 401 691 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/37.0.2062.94 Chrome/37.0.2062.94 Safari/537.36"
127.0.0.1 - nagiosadmin [19/Sep/2014:16:25:39 -0300] "GET /nagios HTTP/1.1" 401 644 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/37.0.2062.94 Chrome/37.0.2062.94 Safari/537.36"
127.0.0.1 - - [19/Sep/2014:16:25:41 -0300] "GET /favicon.ico HTTP/1.1" 404 468 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/37.0.2062.94 Chrome/37.0.2062.94 Safari/537.36"

Re: Unauthorized login in nagios 4.0.8

Posted: Fri Sep 19, 2014 3:56 pm
by lmiltchev
Can you show us the nagios.conf file? I believe on Ubuntu the file should be located in "/etc/apache2/conf.d/" directory.

Re: Unauthorized login in nagios 4.0.8

Posted: Sat Sep 20, 2014 1:18 pm
by rafaelbraga
Hi,

Follows the contents of the file:

# 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>

Re: Unauthorized login in nagios 4.0.8

Posted: Mon Sep 22, 2014 3:55 pm
by lmiltchev
This looks correct. Run one more time:

Code: Select all

htpasswd –c /usr/local/nagios/etc/htpasswd.users nagiosadmin
and set a simple password (no special chars). Restart apache:

Code: Select all

service apache2 retart
Make sure selinux is disabled:

Code: Select all

setenforce 0
Stop iptables:

Code: Select all

service iptables stop
Try to log in the web UI:

Code: Select all

http://<ip address>/nagios
BTW, what do you see if you only type the ip in the browsers address bar?

Code: Select all

http://<ip address>

Re: Unauthorized login in nagios 4.0.8

Posted: Mon Sep 22, 2014 7:04 pm
by rafaelbraga
Hi!

Doesn't worked... :/

When I put only my address IP in the browser shows the first page of the RoundCube that is configured in my machine...

Any ideia?

Thanks!

Re: Unauthorized login in nagios 4.0.8

Posted: Tue Sep 23, 2014 10:18 am
by lmiltchev
I will try to recreate the issue in house and will get back to you sometime today.