Authentication problem

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.
hellb0y77
Posts: 18
Joined: Wed May 28, 2014 3:14 am

Authentication problem

Post by hellb0y77 »

Hi,
i installed last version of Nagios following the official documentation (http://nagios.sourceforge.net/docs/nagi ... edora.html) but i have a problem with authentication, when connect with http://myhost/nagios i have this error:

It appears as though you do not have permission to view information for any of the services you requested...

And at the top of page: Logged in as ?

/etc/httpd/conf.d/nagios.conf:

Code: Select all

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
The file /usr/local/nagios/etc/htpasswd.users is present also the file .htaccess in /usr/local/nagios/share and /usr/local/nagios/sbin is present

Code: Select all

AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
require valid-user
The file /usr/local/nagios/etc/cgi.cfg is the original, user "nagiosadmin" is set and auth is:

Code: Select all

use_authentication=1
When i connect to web interface don't ask any user and password

Any ideas?
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Authentication problem

Post by eloyd »

Completely close all browser windows and try again. Your browser may have the username cached from a previous access.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
hellb0y77
Posts: 18
Joined: Wed May 28, 2014 3:14 am

Re: Authentication problem

Post by hellb0y77 »

I tried with other browser with other computer....same result
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Authentication problem

Post by eloyd »

You have this set in /etc/httpd/conf.d/nagios.conf:
AllowOverride None
But then in .htaccess you are trying to do:
require valid-user
I think these are messing you up. My personal preference would be to put the authentication requirement information in /etc/httpd/conf.d/nagios.conf and get rid of .htaccess entirely. Or vice-versa, but you'll need to specify the AllowOverride properly to be able to set authentication in the .htaccess file.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
hellb0y77
Posts: 18
Joined: Wed May 28, 2014 3:14 am

Re: Authentication problem

Post by hellb0y77 »

I found the problem, is the directive "AllowOverride" in httpd.conf, if set to "None", Nagios auth work, but if "All", nagios auth don't ask user and password.
Unfortunately i can't change "AllowOverride" in httpd.conf that is set to "All", i tried to insert "AllowOverride None" in .htaccess file but don't work.....what can I do?
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Authentication problem

Post by eloyd »

Look at http://httpd.apache.org/docs/2.2/mod/co ... owoverride and read up on the "AuthConfig" part.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
hellb0y77
Posts: 18
Joined: Wed May 28, 2014 3:14 am

Re: Authentication problem

Post by hellb0y77 »

I tried also with AuthConfig like described here http://nagios.manubulon.com/traduction/ ... web_server but don't work
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Authentication problem

Post by eloyd »

I'm pretty sure your problem lies in your base Apache configuration not letting your .htaccess work as expected. Is there a reason why you can't move all the authentication information to /etc/httpd/conf.d/nagios.conf?

And can you look in the Apache error_log and access_log to see what it's doing? NOT authenticating means it's been told NOT to authenticate. Fundamentally, it's a problem with your Apache configurations.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Authentication problem

Post by tmcdonald »

Also, what OS and version are you on? I know some distros set up Apache differently if installed with a package manager.
Former Nagios employee
hellb0y77
Posts: 18
Joined: Wed May 28, 2014 3:14 am

Re: Authentication problem

Post by hellb0y77 »

I use an Amazon AMI Linux (CentOs), version 3.5.1 and latest version in another AMI Linux. I have installed nagios from tar.gz, not yum.
Locked