Page 1 of 1

CGI problems i cannot figure out

Posted: Fri Sep 07, 2012 4:54 am
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??

Re: CGI problems i cannot figure out

Posted: Tue Sep 11, 2012 12:32 pm
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.

Re: CGI problems i cannot figure out

Posted: Fri Sep 14, 2012 2:31 am
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.

Re: CGI problems i cannot figure out

Posted: Fri Sep 14, 2012 8:47 am
by lmiltchev
What is the output of the following command?

Code: Select all

cat /etc/group | grep nagios

Re: CGI problems i cannot figure out

Posted: Wed Oct 03, 2012 1:54 am
by dhs
Nice awnser just as expected.

nagios:x:106:www-data


So it should have all the required rights and memberships.

Re: CGI problems i cannot figure out

Posted: Wed Oct 03, 2012 9:16 am
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.

Re: CGI problems i cannot figure out

Posted: Thu Oct 04, 2012 12:27 am
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)