CGI problems i cannot figure out

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
dhs
Posts: 4
Joined: Fri Sep 07, 2012 4:29 am

CGI problems i cannot figure out

Post by dhs »

I got a bit of a problem which i do not seem to be able to tackle. I am hoping you lads might have had more luck when standing in line for the brainy part...

When connecting to my nagios machine it tells me:

Code: Select all

It appears as though you do not have permission to view information for any of the hosts you requested
If you believe this is an error, check the HTTP server authentication requirements for accessing this CGI
and check the authorization options in your CGI configuration file.
Now, i strongly believe this to be an error, so i checked the configuration a bit. First off, i must say it's a Debian machine with native APT installed Nagios on it. However, some tweaks have been done. This will explain the path and such. Think i better just put down parts of the config file. I do not think the problem is in nagios's cgi.cfg. This one seems correct:

/etc/nagios3/cgi.cfg

Code: Select all

use_authentication=1
use_ssl_authentication=0
authorized_for_system_information=*
authorized_for_configuration_information=*
authorized_for_system_commands=*
authorized_for_all_services=*
authorized_for_all_hosts=*
authorized_for_all_service_commands=*
authorized_for_all_host_commands=*
Here you see that the accounts should have access. I have confirmed this by actually going so far as to build a new machine, copy it's cgi config file over the one i had (so the clean on that works on new machine). This did not solve the problem, so a logical conclusion would be that the problem is not here.

A different location could be the Apache config, tho i doubt it.

/etc/apache2/conf.d/nagios3.conf

Code: Select all

ScriptAlias /cgi-bin/nagios3 /usr/lib/cgi-bin/nagios3
ScriptAlias /nagios3/cgi-bin /usr/lib/cgi-bin/nagios3
Alias /nagios3/stylesheets /etc/nagios3/stylesheets
Alias /nagios3 /usr/share/nagios3/htdocs
<DirectoryMatch (/usr/share/nagios3/htdocs|/usr/lib/cgi-bin/nagios3|/etc/nagios3/stylesheets)>
        Options FollowSymLinks

        DirectoryIndex index.php

        AllowOverride AuthConfig
        Order Allow,Deny
        Allow From All

        AuthName "Nagios Access"
        AuthType Basic
        AuthUserFile /etc/nagios3/htpasswd.users
        # nagios 1.x:
        #AuthUserFile /etc/nagios/htpasswd.users
        require valid-user
</DirectoryMatch>
Than the last file to check would be the htpasswd.users. This one is fine. Take it from me, i can log into the interface in the first place, so it should be fine.

Is there one of you fellows that spots my idiotic mistake??
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: CGI problems i cannot figure out

Post by mguthrie »

It doesn't appear to be your configs. Are you using https or a proxy at all?

Are the cgi's display the correct username as being logged in? There should be a "logged in as <username>" on the top left or several of the pages.
dhs
Posts: 4
Joined: Fri Sep 07, 2012 4:29 am

Re: CGI problems i cannot figure out

Post by dhs »

Ah that is a excellent point sir!

no proxy or https. But the loged in as states i am "?".

Obviously you're right. Now the question arises how to troubleshoot this part. I will give more info when i have it.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: CGI problems i cannot figure out

Post by lmiltchev »

What is the output of the following command?

Code: Select all

cat /etc/group | grep nagios
Be sure to check out our Knowledgebase for helpful articles and solutions!
dhs
Posts: 4
Joined: Fri Sep 07, 2012 4:29 am

Re: CGI problems i cannot figure out

Post by dhs »

Nice awnser just as expected.

nagios:x:106:www-data


So it should have all the required rights and memberships.
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: CGI problems i cannot figure out

Post by mguthrie »

Can you try commenting out the following line from the apache config and restart apache:

Code: Select all

AllowOverride AuthConfig
Not sure if this would make a difference or not, but for some reason apache isn't holding on to the remote username that's logged in with basic auth.
dhs
Posts: 4
Joined: Fri Sep 07, 2012 4:29 am

Re: CGI problems i cannot figure out

Post by dhs »

i have, tho i see no result. It is really true that Apache seems to have problems with the username i think. The user in the nagios screen does show as "Logged in as ?" in the top left. So it almost seems as if i have rights to get the menu but not the information in the main screen.

Strangely enough, vshell does seem to get the right information. However, this one has problems with the CGI when i try to do an action, such as reschedule a next check. Than it says The requested URL /nagios/cgi-bin/cmd.cgi. Tho this is by design i think. The vshell expects a nagios/ and not a nagios3/. This is part of the debian way and i have not bothered to fix vshell to go to nagios3. Tho with all the problems i am finding, i might consider making a backup of the vshell directory and start messing around with the url /nagios/cgi-bin to make it into /nagios3/cgi-bin, as vshell does not seem to have any authentication problems.

(edit typo)
Locked