Nagios - Access Forbidden 403

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.
Post Reply
JohnSonandrla
Posts: 6
Joined: Sun Jul 10, 2022 12:49 am

Nagios - Access Forbidden 403

Post by JohnSonandrla »

I have seen a few question this regard, but unfortunately that does not solve my problem. Please let me know if you have been able to successfully run Nagios on OpenSuse on a virtual machine.

I have Open Suse installed in two different computers. one via VMware and one via VirtualBox and they run just fine for any other application. No problem on accessing network etc.

But after following the open Suse installation steps as mentioned at: http://nagios.sourceforge.net/docs/nagi ... nsuse.html

I find the "Access Forbidden! Error 403" messege when I start localhost/nagios (removed the http:// purposefully in the post) on firefox. The installation looks went through fine with no error. I am using OpenSuse 13.1 version, I tried with nagios version 4.0.6 and 4.0.7 along with plugins 2.0.2.

I made sure, apache(apache2), gcc, gcc++, kernel-source (as suggested in nagios forum by a user), php, apache2-mod_php5, make etc are all installed. apache2 service is running and was retasrted after running: make install-webconf

The username and password was rightly keyed in :).

Can you please guide me on what is going wrong on this.

Here is the apache2/error_log:

[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
Here is the apache2/acsess_log:

::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)"
The conf file is:

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>
nehakakar
Posts: 9
Joined: Tue Jun 20, 2023 2:10 am

Re: Nagios - Access Forbidden 403

Post by nehakakar »

Hi JohnSonandrla,
The error log suggests that there is no matching DirectoryIndex (index.html or index.html.var) found in the /srv/www/htdocs/ directory.
Check that you have an index file index.html in that directory or update the DirectoryIndex directive in your Apache configuration.
Also check permissions and ownership.
The /usr/local/nagios/sbin and /usr/local/nagios/share directories should be accessible by the web server user.
verify Apache configuration for Nagios is correctly set up.
Ad that the ScriptAlias and Alias directives in your configuration file match the correct paths to the Nagios CGI scripts and HTML files. Also, double-check that the AuthUserFile directive points to the correct location of the htpasswd.users file. Hope That help you.
You can verify your URL and get detail redirection chain try any online tool such as Redirect Checker for its redirection header detail.
Last edited by nehakakar on Sun Jul 30, 2023 2:12 pm, edited 1 time in total.
JackMurphy
Posts: 1
Joined: Sun Jul 09, 2023 10:42 pm
Contact:

Re: Nagios - Access Forbidden 403

Post by JackMurphy »

Is there a way to replace :AuthUserFile with the password itself?
nehakakar
Posts: 9
Joined: Tue Jun 20, 2023 2:10 am

Re: Nagios - Access Forbidden 403

Post by nehakakar »

cryptosp wrote: Thu Jul 13, 2023 7:07 am I find the "Access Forbidden! Error 403" messege

Check the paths specified in the ScriptAlias and Alias directives in your Apache configuration match the correct paths to the Nagios CGI scripts and HTML files. For the /nagios/cgi-bin and /nagios aliases, ensure that the paths are accurate.
then set the chown chown -R www-data:www-data /usr/local/nagios/sbin/ /usr/local/nagios/share/
I hope this might help you. and please share more detail if still encounter same issue.
campillo
Posts: 2
Joined: Sat Jul 22, 2023 4:14 am

Re: Nagios - Access Forbidden 403

Post by campillo »

Thank you so much for this useful information.
Founder of Windy Jets
campillo
Posts: 2
Joined: Sat Jul 22, 2023 4:14 am

Re: Nagios - Access Forbidden 403

Post by campillo »

I had a very similar issue on CentOS 7 but I just installed the php package and it worked.
Founder of Windy Jets
moralgrouchy
Posts: 1
Joined: Tue Jul 25, 2023 9:17 pm

Re: Nagios - Access Forbidden 403

Post by moralgrouchy »

The aforementioned predicament makes me feel a great deal of unease, Is there a method that is less difficult to cope with them?geometry dash unblocked
nehakakar
Posts: 9
Joined: Tue Jun 20, 2023 2:10 am

Re: Nagios - Access Forbidden 403

Post by nehakakar »

campillo wrote: Mon Jul 24, 2023 2:39 am I had a very similar issue on CentOS 7 but I just installed the php package and it worked.
Sure! you can try the following steps as far i can understand.
1. SELinux might be enforcing strict policies that could cause issues with Nagios. You can temporarily disable SELinux to see if it is causing the problem.

Code: Select all

sudo setenforce 0
2. Check that the necessary ports for Nagios, You can open the ports with this commend.

Code: Select all

sudo firewall-cmd --add-service=http --permanent
sudo firewall-cmd --add-service=https --permanent
sudo firewall-cmd --reload
3. Check and Verify the permissions and ownership of Nagios directories

Code: Select all

ls -ld /usr/local/nagios/sbin /usr/local/nagios/share
ls -l /usr/local/nagios/sbin
ls -l /usr/local/nagios/share
then Restart Apache and manually check
i hope it helps you
Post Reply