Allow PHP to edit the regex file if installed

Fixes permissions error on the web interface when modifying the regex.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
This commit is contained in:
Mcat12 2018-07-28 21:56:18 -04:00
parent 1844bf17a7
commit 1a8d5fb4a9
No known key found for this signature in database
GPG key ID: ABB8FC9789AF524D
2 changed files with 9 additions and 5 deletions

View file

@ -50,6 +50,7 @@ PI_HOLE_INSTALL_DIR="/opt/pihole"
useUpdateVars=false useUpdateVars=false
adlistFile="/etc/pihole/adlists.list" adlistFile="/etc/pihole/adlists.list"
regexFile="/etc/pihole/regex.list"
# Pi-hole needs an IP address; to begin, these variables are empty since we don't know what the IP is until # Pi-hole needs an IP address; to begin, these variables are empty since we don't know what the IP is until
# this script can run # this script can run
IPV4_ADDRESS="" IPV4_ADDRESS=""
@ -1235,6 +1236,11 @@ installConfigs() {
# Make sure Pi-hole's config files are in place # Make sure Pi-hole's config files are in place
version_check_dnsmasq version_check_dnsmasq
# Install an empty regex file
touch "${regexFile}"
chown pihole:pihole "${regexFile}"
chmod 664 "${regexFile}"
# If the user chose to install the dashboard, # If the user chose to install the dashboard,
if [[ "${INSTALL_WEB_SERVER}" == true ]]; then if [[ "${INSTALL_WEB_SERVER}" == true ]]; then
# and if the Web server conf directory does not exist, # and if the Web server conf directory does not exist,
@ -1261,6 +1267,9 @@ installConfigs() {
chown ${LIGHTTPD_USER}:${LIGHTTPD_GROUP} /var/cache/lighttpd/compress chown ${LIGHTTPD_USER}:${LIGHTTPD_GROUP} /var/cache/lighttpd/compress
mkdir -p /var/cache/lighttpd/uploads mkdir -p /var/cache/lighttpd/uploads
chown ${LIGHTTPD_USER}:${LIGHTTPD_GROUP} /var/cache/lighttpd/uploads chown ${LIGHTTPD_USER}:${LIGHTTPD_GROUP} /var/cache/lighttpd/uploads
# Let PHP edit the regex file
chown pihole:${LIGHTTPD_GROUP} "${regexFile}"
fi fi
} }

View file

@ -643,11 +643,6 @@ if [[ "${skipDownload}" == false ]] || [[ "${listType}" == "whitelist" ]]; then
gravity_Whitelist gravity_Whitelist
fi fi
# Set proper permissions on the regex file
touch "${regexFile}"
chown pihole:www-data "${regexFile}"
chmod 664 "${regexFile}"
convert_wildcard_to_regex convert_wildcard_to_regex
gravity_ShowBlockCount gravity_ShowBlockCount