Page 1 of 4

Authentication problem

Posted: Wed May 28, 2014 5:01 am
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?

Re: Authentication problem

Posted: Wed May 28, 2014 8:50 am
by eloyd
Completely close all browser windows and try again. Your browser may have the username cached from a previous access.

Re: Authentication problem

Posted: Wed May 28, 2014 9:52 am
by hellb0y77
I tried with other browser with other computer....same result

Re: Authentication problem

Posted: Wed May 28, 2014 11:01 am
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.

Re: Authentication problem

Posted: Wed May 28, 2014 1:41 pm
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?

Re: Authentication problem

Posted: Wed May 28, 2014 1:52 pm
by eloyd
Look at http://httpd.apache.org/docs/2.2/mod/co ... owoverride and read up on the "AuthConfig" part.

Re: Authentication problem

Posted: Wed May 28, 2014 2:13 pm
by hellb0y77
I tried also with AuthConfig like described here http://nagios.manubulon.com/traduction/ ... web_server but don't work

Re: Authentication problem

Posted: Wed May 28, 2014 2:23 pm
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.

Re: Authentication problem

Posted: Thu May 29, 2014 10:34 am
by tmcdonald
Also, what OS and version are you on? I know some distros set up Apache differently if installed with a package manager.

Re: Authentication problem

Posted: Thu May 29, 2014 1:31 pm
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.