Access forbidden! Error 403 on openSuse 13.1

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
schowdh
Posts: 4
Joined: Sat Jun 21, 2014 11:31 pm

Access forbidden! Error 403 on openSuse 13.1

Post by schowdh »

Hi Team,

I am very new to novice. In the process of learning I tried to install Nagios on virtual machine.
I have installed Open Suse 13.1 both via Virtual box and VM in two different computers. But encountered same error in both cases. Please let me know what is going wrong here. I am really confused as it seems I have followed all steps methodically as mentioned at the site for OpenSuse and encountering same error.

On the top of that I foloowed the instructions at:

http://nagios.sourceforge.net/docs/nagi ... nsuse.html

Nagios version installed: nagios-4.0.7 and nagios 4.0.6 [4.0.7 in one computer and 4.0.6 on the other computer]
Nagios plugin version installed: 2.0.2

gcc, gcc-c++, httpd, kernel-source, make, are all installed via zypper. apache2-mod_php5 installed via yast2.

please see the error log file output:

Code: Select all

[Mon Jun 23 14:50:57.331306 2014] [autoindex:error] [pid 6138] [client 127.0.0.1:46061] AH01276: Cannot serve directory /srv/www/htdocs/: No matching DirectoryIndex (index.html,index.html.var) found, and server-generated directory index forbidden by Options directive
[Mon Jun 23 14:51:57.317399 2014] [autoindex:error] [pid 6139] [client 127.0.0.1:46066] AH01276: Cannot serve directory /srv/www/htdocs/: No matching DirectoryIndex (index.html,index.html.var) found, and server-generated directory index forbidden by Options directive
[Mon Jun 23 14:52:57.299316 2014] [autoindex:error] [pid 24637] [client 127.0.0.1:46068] AH01276: Cannot serve directory /srv/www/htdocs/: No matching DirectoryIndex (index.html,index.html.var) found, and server-generated directory index forbidden by Options directive
[Mon Jun 23 14:57:57.289446 2014] [autoindex:error] [pid 6137] [client 127.0.0.1:46077] AH01276: Cannot serve directory /srv/www/htdocs/: No matching DirectoryIndex (index.html,index.html.var) found, and server-generated directory index forbidden by Options directive
[Mon Jun 23 14:58:59.372027 2014] [autoindex:error] [pid 6136] [client ::1:59841] AH01276: Cannot serve directory /usr/local/nagios/share/: No matching DirectoryIndex (index.html,index.html.var) found, and server-generated directory index forbidden by Options directive
[Mon Jun 23 15:02:57.274830 2014] [autoindex:error] [pid 6139] [client 127.0.0.1:46119] AH01276: Cannot serve directory /srv/www/htdocs/: No matching DirectoryIndex (index.html,index.html.var) found, and server-generated directory index forbidden by Options directive
[Mon Jun 23 15:07:57.263871 2014] [autoindex:error] [pid 24637] [client 127.0.0.1:46143] AH01276: Cannot serve directory /srv/www/htdocs/: No matching DirectoryIndex (index.html,index.html.var) found, and server-generated directory index forbidden by Options directive
[Mon Jun 23 15:12:57.251875 2014] [autoindex:error] [pid 6137] [client 127.0.0.1:46147] AH01276: Cannot serve directory /srv/www/htdocs/: No matching DirectoryIndex (index.html,index.html.var) found, and server-generated directory index forbidden by Options directive
[Mon Jun 23 15:17:57.239626 2014] [autoindex:error] [pid 6135] [client 127.0.0.1:46152] AH01276: Cannot serve directory /srv/www/htdocs/: No matching DirectoryIndex (index.html,index.html.var) found, and server-generated directory index forbidden by Options directive
[Mon Jun 23 15:22:57.228968 2014] [autoindex:error] [pid 6136] [client 127.0.0.1:46155] AH01276: Cannot serve directory /srv/www/htdocs/: No matching DirectoryIndex (index.html,index.html.var) found, and server-generated directory index forbidden by Options directive
[Mon Jun 23 15:27:57.217628 2014] [autoindex:error] [pid 6138] [client 127.0.0.1:46158] AH01276: Cannot serve directory /srv/www/htdocs/: No matching DirectoryIndex (index.html,index.html.var) found, and server-generated directory index forbidden by Options directive
[Mon Jun 23 15:32:57.206081 2014] [autoindex:error] [pid 6139] [client 127.0.0.1:46161] AH01276: Cannot serve directory /srv/www/htdocs/: No matching DirectoryIndex (index.html,index.html.var) found, and server-generated directory index forbidden by Options directive
[Mon Jun 23 15:37:57.197239 2014] [autoindex:error] [pid 24637] [client 127.0.0.1:46165] AH01276: Cannot serve directory /srv/www/htdocs/: No matching DirectoryIndex (index.html,index.html.var) found, and server-generated directory index forbidden by Options directive
[Mon Jun 23 15:42:57.180851 2014] [autoindex:error] [pid 6137] [client 127.0.0.1:46168] AH01276: Cannot serve directory /srv/www/htdocs/: No matching DirectoryIndex (index.html,index.html.var) found, and server-generated directory index forbidden by Options directive
[Mon Jun 23 15:47:57.165708 2014] [autoindex:error] [pid 6135] [client 127.0.0.1:46172] AH01276: Cannot serve directory /srv/www/htdocs/: No matching DirectoryIndex (index.html,index.html.var) found, and server-generated directory index forbidden by Options directive
[Mon Jun 23 15:52:57.154070 2014] [autoindex:error] [pid 6136] [client 127.0.0.1:46174] AH01276: Cannot serve directory /srv/www/htdocs/: No matching DirectoryIndex (index.html,index.html.var) found, and server-generated directory index forbidden by Options directive
[Mon Jun 23 15:57:57.136265 2014] [autoindex:error] [pid 6138] [client 127.0.0.1:46182] AH01276: Cannot serve directory /srv/www/htdocs/: No matching DirectoryIndex (index.html,index.html.var) found, and server-generated directory index forbidden by Options directive
[Mon Jun 23 16:02:57.122498 2014] [autoindex:error] [pid 6139] [client 127.0.0.1:46186] AH01276: Cannot serve directory /srv/www/htdocs/: No matching DirectoryIndex (index.html,index.html.var) found, and server-generated directory index forbidden by Options directive
[Mon Jun 23 16:07:57.110446 2014] [autoindex:error] [pid 24637] [client 127.0.0.1:46191] AH01276: Cannot serve directory /srv/www/htdocs/: No matching DirectoryIndex (index.html,index.html.var) found, and server-generated directory index forbidden by Options directive
[Mon Jun 23 16:12:57.092886 2014] [autoindex:error] [pid 6137] [client 127.0.0.1:46197] AH01276: Cannot serve directory /srv/www/htdocs/: No matching DirectoryIndex (index.html,index.html.var) found, and server-generated directory index forbidden by Options directive
[Mon Jun 23 16:17:57.077070 2014] [autoindex:error] [pid 6135] [client 127.0.0.1:46204] AH01276: Cannot serve directory /srv/www/htdocs/: No matching DirectoryIndex (index.html,index.html.var) found, and server-generated directory index forbidden by Options directive
[Mon Jun 23 16:22:57.067403 2014] [autoindex:error] [pid 6136] [client 127.0.0.1:46206] AH01276: Cannot serve directory /srv/www/htdocs/: No matching DirectoryIndex (index.html,index.html.var) found, and server-generated directory index forbidden by Options directive
[Mon Jun 23 16:27:57.054625 2014] [autoindex:error] [pid 6138] [client 127.0.0.1:46209] AH01276: Cannot serve directory /srv/www/htdocs/: No matching DirectoryIndex (index.html,index.html.var) found, and server-generated directory index forbidden by Options directive
[Mon Jun 23 16:32:57.042447 2014] [autoindex:error] [pid 6139] [client 127.0.0.1:46213] AH01276: Cannot serve directory /srv/www/htdocs/: No matching DirectoryIndex (index.html,index.html.var) found, and server-generated directory index forbidden by Options directive
[Mon Jun 23 16:37:57.030372 2014] [autoindex:error] [pid 24637] [client 127.0.0.1:46219] AH01276: Cannot serve directory /srv/www/htdocs/: No matching DirectoryIndex (index.html,index.html.var) found, and server-generated directory index forbidden by Options directive
Please see the access log file below:

Code: Select all

::1 - - [23/Jun/2014:14:58:59 -0700] "GET /nagios HTTP/1.1" 401 1233 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:25.0) Gecko/20100101 Firefox/25.0"
::1 - nagiosadmin [23/Jun/2014:14:58:59 -0700] "GET /nagios HTTP/1.1" 301 310 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:25.0) Gecko/20100101 Firefox/25.0"
::1 - - [23/Jun/2014:14:58:59 -0700] "GET /nagios/ HTTP/1.1" 403 1004 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:25.0) Gecko/20100101 Firefox/25.0"
::1 - nagiosadmin [23/Jun/2014:15:01:43 -0700] "GET /nagios/index.php HTTP/1.1" 200 1628 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:25.0) Gecko/20100101 Firefox/25.0"
127.0.0.1 - - [23/Jun/2014:15:02:57 -0700] "GET / HTTP/1.0" 403 1004 "-" "check_http/v2.0.2 (nagios-plugins 2.0.2)"
127.0.0.1 - - [23/Jun/2014:15:07:57 -0700] "GET / HTTP/1.0" 403 1004 "-" "check_http/v2.0.2 (nagios-plugins 2.0.2)"
127.0.0.1 - - [23/Jun/2014:15:12:57 -0700] "GET / HTTP/1.0" 403 1004 "-" "check_http/v2.0.2 (nagios-plugins 2.0.2)"
127.0.0.1 - - [23/Jun/2014:15:17:57 -0700] "GET / HTTP/1.0" 403 1004 "-" "check_http/v2.0.2 (nagios-plugins 2.0.2)"
127.0.0.1 - - [23/Jun/2014:15:22:57 -0700] "GET / HTTP/1.0" 403 1004 "-" "check_http/v2.0.2 (nagios-plugins 2.0.2)"
127.0.0.1 - - [23/Jun/2014:15:27:57 -0700] "GET / HTTP/1.0" 403 1004 "-" "check_http/v2.0.2 (nagios-plugins 2.0.2)"
127.0.0.1 - - [23/Jun/2014:15:32:57 -0700] "GET / HTTP/1.0" 403 1004 "-" "check_http/v2.0.2 (nagios-plugins 2.0.2)"
127.0.0.1 - - [23/Jun/2014:15:37:57 -0700] "GET / HTTP/1.0" 403 1004 "-" "check_http/v2.0.2 (nagios-plugins 2.0.2)"
127.0.0.1 - - [23/Jun/2014:15:42:57 -0700] "GET / HTTP/1.0" 403 1004 "-" "check_http/v2.0.2 (nagios-plugins 2.0.2)"
127.0.0.1 - - [23/Jun/2014:15:47:57 -0700] "GET / HTTP/1.0" 403 1004 "-" "check_http/v2.0.2 (nagios-plugins 2.0.2)"
127.0.0.1 - - [23/Jun/2014:15:52:57 -0700] "GET / HTTP/1.0" 403 1004 "-" "check_http/v2.0.2 (nagios-plugins 2.0.2)"
127.0.0.1 - - [23/Jun/2014:15:57:57 -0700] "GET / HTTP/1.0" 403 1004 "-" "check_http/v2.0.2 (nagios-plugins 2.0.2)"
127.0.0.1 - - [23/Jun/2014:16:02:57 -0700] "GET / HTTP/1.0" 403 1004 "-" "check_http/v2.0.2 (nagios-plugins 2.0.2)"
127.0.0.1 - - [23/Jun/2014:16:07:57 -0700] "GET / HTTP/1.0" 403 1004 "-" "check_http/v2.0.2 (nagios-plugins 2.0.2)"
127.0.0.1 - - [23/Jun/2014:16:12:57 -0700] "GET / HTTP/1.0" 403 1004 "-" "check_http/v2.0.2 (nagios-plugins 2.0.2)"
127.0.0.1 - - [23/Jun/2014:16:17:57 -0700] "GET / HTTP/1.0" 403 1004 "-" "check_http/v2.0.2 (nagios-plugins 2.0.2)"
127.0.0.1 - - [23/Jun/2014:16:22:57 -0700] "GET / HTTP/1.0" 403 1004 "-" "check_http/v2.0.2 (nagios-plugins 2.0.2)"
127.0.0.1 - - [23/Jun/2014:16:27:57 -0700] "GET / HTTP/1.0" 403 1004 "-" "check_http/v2.0.2 (nagios-plugins 2.0.2)"
127.0.0.1 - - [23/Jun/2014:16:32:57 -0700] "GET / HTTP/1.0" 403 1004 "-" "check_http/v2.0.2 (nagios-plugins 2.0.2)"
127.0.0.1 - - [23/Jun/2014:16:37:57 -0700] "GET / HTTP/1.0" 403 1004 "-" "check_http/v2.0.2 (nagios-plugins 2.0.2)"
127.0.0.1 - - [23/Jun/2014:16:42:57 -0700] "GET / HTTP/1.0" 403 1004 "-" "check_http/v2.0.2 (nagios-plugins 2.0.2)"
nagios config file:

Code: Select all

# 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>
emislivec
Posts: 52
Joined: Tue Feb 25, 2014 10:06 am

Re: Access forbidden! Error 403 on openSuse 13.1

Post by emislivec »

This is normal for the default installation. What's happening is that the default sample configuration runs check_http on localhost:

Code: Select all

127.0.0.1 - - [23/Jun/2014:15:27:57 -0700] "GET / HTTP/1.0" 403 1004 "-" "check_http/v2.0.2 (nagios-plugins 2.0.2)"
But the Nagios Core installation only configures apache to serve http://localhost/nagios/. So when apache receives the GET request for http://localhost/, it looks for an index.html file to serve and doesn't find one in /srv/www/htdocs/. Since automatic indices are disabled, it has no index to serve and responds with an error.

Code: Select all

[Mon Jun 23 16:27:57.054625 2014] [autoindex:error] [pid 6138] [client 127.0.0.1:46209] AH01276: Cannot serve directory /srv/www/htdocs/: No matching DirectoryIndex (index.html,index.html.var) found, and server-generated directory index forbidden by Options directive
You can see this on the command line:

Code: Select all

wget -S localhost -O - # This should result in a 403
sudo touch /srv/www/htdocs/index.html
wget -S localhost -O - # This should result in a 200
Once /srv/www/htdocs/index.html exists the errors should stop, and the next check of the localhost HTTP service by Nagios should have an OK status.

Edit: I overlooked the errors accessing http://localhost/nagios/. Did you create the htpasswd file?

Code: Select all

htpasswd2 -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
One more edit: I see a successful request for /nagios/index.php so it looks like you were able to log into the Nagios web interface. Normally we'll see other requests as the browser loads the stylesheets and scripts. Are you having problems accessing the web interface too?
schowdh
Posts: 4
Joined: Sat Jun 21, 2014 11:31 pm

Re: Access forbidden! Error 403 on openSuse 13.1

Post by schowdh »

Hi emislivec, thanks for the explanation.

I have created the users file
/usr/local/nagios/etc # ls -lrt

.
.
-rw-r--r-- 1 root root 50 Jun 23 14:41 htpasswd.users


Please see the content;

nagiosadmin:$apr1$s.hq(some more part of the encrypted string)

I once tried to access http://localhost/nagios/index.php and it did not throw error but asked me how I want to open it (using a text editor... etc.) not sure if the success entry you saw is because of that.

Also, I tried to create a index.html page

Code: Select all

touch /usr/local/nagios/share/index.html  
/usr/local/nagios/share/, the browser opens the page but it is obviously a blank one.

So, so far I am still at the same place, down with Access Forbidden.

Just one point I think I should mention here. The complete installation process I did as a root user, never logged into as nagios/any other user mode [as it was not mentioned in the installation guide that I need to something of that sort]. I am facing the the access forbidden issue whether I am logged in as root or nagios user anyway.

Please let me know your input.
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Access forbidden! Error 403 on openSuse 13.1

Post by lmiltchev »

You can try recompiling to see if this is going to fix your error. Our guide for openSUSE could be somewhat outdated. You can try this guide:

http://www.unixmen.com/how-to-install-n ... nsuse-113/

I used it to install Nagios Core 4.0.7 on openSUSE 11.4 and didn't have any issues. I haven't tried it on 13.1 though.
Be sure to check out our Knowledgebase for helpful articles and solutions!
schowdh
Posts: 4
Joined: Sat Jun 21, 2014 11:31 pm

Re: Access forbidden! Error 403 on openSuse 13.1

Post by schowdh »

Hi,

I tried, but unfortunately that did not work. I finally followed Ubuntu installation step and installed Nagios on Ubuntu (Ubuntu version 14.04, Nagios core version 4.0.7 and Nagios plugins version 2.0.2). That worked.

But it looks like due to changes in Apache, the steps mentioned in quickstart documentation will not work as it is. One needs to make changes in Makefile under nagios-4.0.7 to make sure the HTTPD path is set to /etc/apache2/conf-enabled instead of /etc/httpd/conf.d.
i.e.,

Code: Select all

HTTPD_CONF=/etc/apache2/conf-enabled
Anyway, I'll try to look into OpenSuse and see what is the issue with it. Thanks for your pointers. Please let me know if you think there is any other possible issue with OpenSuse.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Access forbidden! Error 403 on openSuse 13.1

Post by tmcdonald »

Thanks for pointing that out! I'll try and get that updated soon.

In the meantime, is Nagios working alright for you on Ubuntu?
Former Nagios employee
schowdh
Posts: 4
Joined: Sat Jun 21, 2014 11:31 pm

Re: Access forbidden! Error 403 on openSuse 13.1

Post by schowdh »

Sorry I got pulled into different things, so could not reply early. It looks like working fine, but I need to explore Nagios a bit more in depth to see if I am facing any issue in Ubuntu. But so far have not faced any issue as such.
Locked