web interface apparently wont need sudo any longer

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
This commit is contained in:
Adam Warner
2021-03-02 18:21:00 +00:00
parent f87ac2a61d
commit 54b8dad8f4

View File

@@ -1686,25 +1686,25 @@ installPiholeWeb() {
# printf " No default index.lighttpd.html file found... not backing up\\n" # printf " No default index.lighttpd.html file found... not backing up\\n"
# fi # fi
# Install Sudoers file # # Install Sudoers file
local str="Installing sudoer file" # local str="Installing sudoer file"
printf "\\n %b %s..." "${INFO}" "${str}" # printf "\\n %b %s..." "${INFO}" "${str}"
# Make the .d directory if it doesn't exist # # Make the .d directory if it doesn't exist
install -d -m 755 /etc/sudoers.d/ # install -d -m 755 /etc/sudoers.d/
# and copy in the pihole sudoers file # # and copy in the pihole sudoers file
install -m 0640 ${PI_HOLE_LOCAL_REPO}/advanced/Templates/pihole.sudo /etc/sudoers.d/pihole # install -m 0640 ${PI_HOLE_LOCAL_REPO}/advanced/Templates/pihole.sudo /etc/sudoers.d/pihole
# Add lighttpd user (OS dependent) to sudoers file # # Add lighttpd user (OS dependent) to sudoers file
echo "${LIGHTTPD_USER} ALL=NOPASSWD: ${PI_HOLE_BIN_DIR}/pihole" >> /etc/sudoers.d/pihole # echo "${LIGHTTPD_USER} ALL=NOPASSWD: ${PI_HOLE_BIN_DIR}/pihole" >> /etc/sudoers.d/pihole
# If the Web server user is lighttpd, # # If the Web server user is lighttpd,
if [[ "$LIGHTTPD_USER" == "lighttpd" ]]; then # if [[ "$LIGHTTPD_USER" == "lighttpd" ]]; then
# Allow executing pihole via sudo with Fedora # # Allow executing pihole via sudo with Fedora
# Usually /usr/local/bin ${PI_HOLE_BIN_DIR} is not permitted as directory for sudoable programs # # Usually /usr/local/bin ${PI_HOLE_BIN_DIR} is not permitted as directory for sudoable programs
echo "Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:${PI_HOLE_BIN_DIR}" >> /etc/sudoers.d/pihole # echo "Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:${PI_HOLE_BIN_DIR}" >> /etc/sudoers.d/pihole
fi # fi
# Set the strict permissions on the file # # Set the strict permissions on the file
chmod 0440 /etc/sudoers.d/pihole # chmod 0440 /etc/sudoers.d/pihole
printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}" # printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}"
} }
# Installs a cron file # Installs a cron file