403 - Forbidden

Please follow the below template, it will help us to help you!

Expected Behaviour:

Getting a log-in screen for the admin interface

Actual Behaviour:

White page with "403 - Forbidden", tried incognito window to

Debug Token:

xs4hv9fjnn

What are the permissions on your /var/www/html folder?

pi@raspberrypi:~ $ ls -l /var/www/
totalt 8
drwxr-xr-x 2 root root 4096 jan 14 2017 cgi-bin
drwxrwxr-x 4 www-data www-data 4096 feb 7 11:23 html

Like this, or did you want to see the contents of the html folder?

Yes, this as well, please.

This is the html folder:

pi@raspberrypi:~ $ ls -l /var/www/html/
totalt 16
drwxr-xr-x 7 root root 4096 feb 7 11:22 admin
-rw-r--r-- 1 www-data www-data 13 mar 11 2017 custom_disable_timer
-rw-r--r-- 1 root root 3378 okt 30 17:26 index.lighttpd.orig
drwxr-xr-x 2 root root 4096 feb 7 11:32 pihole
pi@raspberrypi:~ $

Admin Folder:

pi@raspberrypi:~ $ ls -l /var/www/html/admin/
totalt 216
-rw-r--r-- 1 root root 6622 feb 7 11:22 api_db.php
-rw-r--r-- 1 root root 7320 feb 7 11:22 api_FTL.php
-rw-r--r-- 1 root root 2173 feb 7 11:22 api.php
-rw-r--r-- 1 root root 2745 feb 7 11:22 api_PHP.php
-rw-r--r-- 1 root root 2794 feb 7 11:22 auditlog.php
-rw-r--r-- 1 root root 2339 feb 7 11:22 CONTRIBUTING.md
-rw-r--r-- 1 root root 1934 feb 7 11:22 db_graph.php
-rw-r--r-- 1 root root 3962 feb 7 11:22 db_lists.php
-rw-r--r-- 1 root root 4418 feb 7 11:22 db_queries.php
-rw-r--r-- 1 root root 949 feb 7 11:22 debug.php
-rw-r--r-- 1 root root 1253 feb 7 11:22 gravity.php
-rw-r--r-- 1 root root 9586 feb 7 11:22 help.php
drwxr-xr-x 2 root root 4096 feb 7 11:22 img
-rw-r--r-- 1 root root 9690 feb 7 11:22 index.php
-rw-r--r-- 1 root root 14164 feb 7 11:22 LICENSE
-rw-r--r-- 1 root root 3311 feb 7 11:22 list.php
-rw-r--r-- 1 root root 4630 feb 7 11:22 queries.php
-rw-r--r-- 1 root root 1106 feb 7 11:22 queryads.php
-rw-r--r-- 1 root root 2038 feb 7 11:22 README.md
drwxr-xr-x 4 root root 4096 feb 7 11:22 scripts
-rw-r--r-- 1 root root 78491 feb 7 11:22 settings.php
drwxr-xr-x 3 root root 4096 feb 7 11:22 style
-rw-r--r-- 1 root root 903 feb 7 11:22 taillog-FTL.php
-rw-r--r-- 1 root root 895 feb 7 11:22 taillog.php
pi@raspberrypi:~ $

Okay, so the permissions seem to be fine in this folder. Are there any messages about the reason for the 403 error in the log files of the HTTP server?

Would you be so kind to point me in the right direction of the HTTP servers logs and I'll gladly share them!

I think they should be in /var/log/lighttpd/ (probably something like error.log or auth.log)

Thanks, here's the content:

Access.log

1518070582|192.168.1.119|GET / HTTP/1.1|403|345
1518095018|192.168.1.119|GET /admin HTTP/1.1|301|0
1518095018|192.168.1.119|GET /admin/ HTTP/1.1|403|345
1518095021|192.168.1.119|GET /admin/ HTTP/1.1|403|345
1518095021|192.168.1.119|GET /favicon.ico HTTP/1.1|404|345
1518162493|192.168.1.119|GET /admin/api.php HTTP/1.1|403|345
1518165940|192.168.1.119|GET /admin/api.php HTTP/1.1|403|345
1518180699|192.168.1.119|GET /admin/api.php HTTP/1.1|403|345
1518185976|192.168.1.119|GET /admin/api.php HTTP/1.1|403|345
1518187787|192.168.1.119|GET /admin/api.php HTTP/1.1|403|345

Error.log

2018-02-08 00:07:02: (server.c.1534) logfiles cycled UID = 0 PID = 6829
2018-02-08 14:03:18: (server.c.1828) server stopped by UID = 0 PID = 1
2018-02-08 14:03:19: (log.c.217) server started
2018-02-09 08:46:53: (server.c.1828) server stopped by UID = 0 PID = 1
2018-02-09 08:47:43: (log.c.217) server started
2018-02-09 09:44:48: (server.c.1828) server stopped by UID = 0 PID = 1
2018-02-09 09:45:08: (log.c.217) server started
2018-02-09 13:50:46: (server.c.1828) server stopped by UID = 0 PID = 1
2018-02-09 13:51:07: (log.c.217) server started
2018-02-09 15:18:25: (server.c.1828) server stopped by UID = 0 PID = 1
2018-02-09 15:19:07: (log.c.217) server started
2018-02-09 15:47:37: (server.c.1828) server stopped by UID = 0 PID = 1
2018-02-09 15:49:15: (log.c.217) server started

What do you see when you run this command?

curl http://pi.hole/admin/index.php

Hmm, now this is strange...

pi@raspberrypi:~ $ curl http://pi.hole/admin/index.php
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
  <title>403 - Forbidden</title>
 </head>
 <body>
  <h1>403 - Forbidden</h1>
 </body>
</html>
pi@raspberrypi:~ $

Should I remove the index file and repair the install?

Try this command first: curl -i http://pi.hole/admin/index.php

Here's the result:

Run pihole -d for a new debug token. Have you made any changes to the lighttpd config or folders under /var/www/?

Not that I'm aware of... so I'm fine with a complete reinstall of it :smiley:

New token: swvtml1413

Try a reinstall

oh dear, this is worse then I though...
So I did a pihole uninstall, if I press Yes if I want to go through all the dependencies it just quits the uninstall:

pi@raspberrypi:~ $ pihole uninstall
[?] Are you sure you would like to remove Pi-hole? [y/N] y
[✓] Root user check
[i] All dependencies are safe to remove on Raspbian
[i] The following dependencies may have been added by the Pi-hole install:
apt-utils dialog debconf dhcpcd5 git iproute2 whiptail bc cron curl dnsmasq dnsutils iputils-ping lsof netcat sudo unzip wget idn2 lighttpd php-common php-cgi php-sqlite3
[?] Do you wish to go through each dependency for removal? (Choosing No will leave all dependencies installed) [Y/n] y
pi@raspberrypi:~ $

Doing the same but pressing N and it looks like it's working:

pi@raspberrypi:~ $ pihole uninstall
[?] Are you sure you would like to remove Pi-hole? [y/N] y
[✓] Root user check
[i] All dependencies are safe to remove on Raspbian
[i] The following dependencies may have been added by the Pi-hole install:
apt-utils dialog debconf dhcpcd5 git iproute2 whiptail bc cron curl dnsmasq dnsutils iputils-ping lsof netcat sudo unzip wget idn2 lighttpd php-common php-cgi php-sqlite3
[?] Do you wish to go through each dependency for removal? (Choosing No will leave all dependencies installed) [Y/n] n
[✓] Removed Web Interface
[✓] Removed /etc/cron.d/pihole
pi@raspberrypi:~ $

But wait for it... still after a reboot I get!

pi@raspberrypi:~ $ pihole status
[✓] DNS service is running
[✓] Pi-hole blocking is Enabled
pi@raspberrypi:~ $

Try an OS reinstall.

yeah I'll just have to wait a while with doing that, running home-assistant, node-red and unifi controller on the same machine and don't want to redo all of them atm. Might get a new raspi and run pi-hole on that tough...

Any good idea how I can uninstall pi-hole when pihole uninstalldoesn't seem to work?