Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DietPi-Software | Pi-hole: Block access to blocking page from web by default #3054

Merged
merged 8 commits into from
Aug 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .conf/dps_93/lighttpd.block_nonlocal_admin.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Block non-LAN access to Pi-hole admin panel
$HTTP["url"] =~ "^(/html)?/admin(/|$)" {
$HTTP["remoteip"] !~ "^1(27|92.168|0|72.(1[6-9]|2[0-9]|3[0-1]))\." {
url.access-deny = ("")
}
}
9 changes: 9 additions & 0 deletions .conf/dps_93/lighttpd.pihole.conf
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,12 @@ $HTTP["url"] =~ "^/admin/" {
$HTTP["url"] =~ "^/admin/\.(.*)" {
url.access-deny = ("")
}

# If it's a request to Pi-hole blocking page...
$HTTP["url"] =~ "^(/html)?/pihole(/|$)" {
# ... and the request isn't local
$HTTP["remoteip"] !~ "^1(27|92.168|0|72.(1[6-9]|2[0-9]|3[0-1]))\." {
# block!
url.access-deny = ("")
}
}
11 changes: 11 additions & 0 deletions dietpi/dietpi-software
Original file line number Diff line number Diff line change
Expand Up @@ -8756,6 +8756,17 @@ _EOF_
dps_index=$software_id Download_Install 'lighttpd.pihole.conf' /etc/lighttpd/conf-available/99-dietpi-pihole.conf
lighttpd-enable-mod dietpi-pihole

# Ask user if they want to block report access to the admin page
dps_index=$software_id Download_Install 'lighttpd.block_nonlocal_admin.conf' /etc/lighttpd/conf-available/99-dietpi-pihole-block_nonlocal_admin.conf

G_WHIP_BUTTON_OK_TEXT='YES'
G_WHIP_BUTTON_CANCEL_TEXT='NO'
G_WHIP_YESNO "In order to increase security, it is recommended that you block remote access to the Pi-hole admin panel, so that unless you're on a local network, the Pi-hole admin panel isn't accessible.\n
You can always enable/disable this at a later point using the commands:
- lighttpd-enable-mod dietpi-pihole-block_nonlocal_admin
- lighttpd-disable-mod dietpi-pihole-block_nonlocal_admin\n
Do you want to block remote access to the admin panel now?" && lighttpd-enable-mod dietpi-pihole-block_nonlocal_admin

fi

# Create symlinks to align Pi-hole admin and blocking page relative to webroot
Expand Down