Compare commits
3 Commits
v6.2.2
..
527895a377
| Author | SHA1 | Date | |
|---|---|---|---|
| 527895a377 | |||
| 11344c39f5 | |||
| b2e56662c0 |
@@ -29,12 +29,12 @@ jobs:
|
|||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
-
|
-
|
||||||
name: Initialize CodeQL
|
name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@4e94bd11f71e507f7f87df81788dff88d1dacbfb #v4.31.0
|
uses: github/codeql-action/init@16140ae1a102900babc80a33c44059580f687047 #v4.30.9
|
||||||
with:
|
with:
|
||||||
languages: 'python'
|
languages: 'python'
|
||||||
-
|
-
|
||||||
name: Autobuild
|
name: Autobuild
|
||||||
uses: github/codeql-action/autobuild@4e94bd11f71e507f7f87df81788dff88d1dacbfb #v4.31.0
|
uses: github/codeql-action/autobuild@16140ae1a102900babc80a33c44059580f687047 #v4.30.9
|
||||||
-
|
-
|
||||||
name: Perform CodeQL Analysis
|
name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@4e94bd11f71e507f7f87df81788dff88d1dacbfb #v4.31.0
|
uses: github/codeql-action/analyze@16140ae1a102900babc80a33c44059580f687047 #v4.30.9
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ jobs:
|
|||||||
ignore_words_file: .codespellignore
|
ignore_words_file: .codespellignore
|
||||||
|
|
||||||
- name: Get editorconfig-checker
|
- name: Get editorconfig-checker
|
||||||
uses: editorconfig-checker/action-editorconfig-checker@4b6cd6190d435e7e084fb35e36a096e98506f7b9 #v2.1.0
|
uses: editorconfig-checker/action-editorconfig-checker@5ecdd656fe347c26f76b1b435b90e1d74fb5e787 # tag v2. is really out of date
|
||||||
|
|
||||||
- name: Run editorconfig-checker
|
- name: Run editorconfig-checker
|
||||||
run: editorconfig-checker
|
run: editorconfig-checker
|
||||||
|
|||||||
@@ -8,20 +8,12 @@ utilsfile="${PI_HOLE_SCRIPT_DIR}/utils.sh"
|
|||||||
|
|
||||||
# Get file paths
|
# Get file paths
|
||||||
FTL_PID_FILE="$(getFTLConfigValue files.pid)"
|
FTL_PID_FILE="$(getFTLConfigValue files.pid)"
|
||||||
FTL_LOG_FILE="$(getFTLConfigValue files.log.ftl)"
|
|
||||||
PIHOLE_LOG_FILE="$(getFTLConfigValue files.log.dnsmasq)"
|
|
||||||
WEBSERVER_LOG_FILE="$(getFTLConfigValue files.log.webserver)"
|
|
||||||
FTL_PID_FILE="${FTL_PID_FILE:-/run/pihole-FTL.pid}"
|
|
||||||
FTL_LOG_FILE="${FTL_LOG_FILE:-/var/log/pihole/FTL.log}"
|
|
||||||
PIHOLE_LOG_FILE="${PIHOLE_LOG_FILE:-/var/log/pihole/pihole.log}"
|
|
||||||
WEBSERVER_LOG_FILE="${WEBSERVER_LOG_FILE:-/var/log/pihole/webserver.log}"
|
|
||||||
|
|
||||||
# Ensure that permissions are set so that pihole-FTL can edit all necessary files
|
# Ensure that permissions are set so that pihole-FTL can edit all necessary files
|
||||||
mkdir -p /var/log/pihole
|
mkdir -p /var/log/pihole
|
||||||
chown -R pihole:pihole /etc/pihole/ /var/log/pihole/
|
chown -R pihole:pihole /etc/pihole/ /var/log/pihole/
|
||||||
|
|
||||||
# allow all users read version file (and use pihole -v)
|
# allow all users read version file (and use pihole -v)
|
||||||
touch /etc/pihole/versions
|
|
||||||
chmod 0644 /etc/pihole/versions
|
chmod 0644 /etc/pihole/versions
|
||||||
|
|
||||||
# allow pihole to access subdirs in /etc/pihole (sets execution bit on dirs)
|
# allow pihole to access subdirs in /etc/pihole (sets execution bit on dirs)
|
||||||
@@ -36,7 +28,7 @@ chown root:root /etc/pihole/logrotate
|
|||||||
|
|
||||||
# Touch files to ensure they exist (create if non-existing, preserve if existing)
|
# Touch files to ensure they exist (create if non-existing, preserve if existing)
|
||||||
[ -f "${FTL_PID_FILE}" ] || install -D -m 644 -o pihole -g pihole /dev/null "${FTL_PID_FILE}"
|
[ -f "${FTL_PID_FILE}" ] || install -D -m 644 -o pihole -g pihole /dev/null "${FTL_PID_FILE}"
|
||||||
[ -f "${FTL_LOG_FILE}" ] || install -m 640 -o pihole -g pihole /dev/null "${FTL_LOG_FILE}"
|
[ -f /var/log/pihole/FTL.log ] || install -m 640 -o pihole -g pihole /dev/null /var/log/pihole/FTL.log
|
||||||
[ -f "${PIHOLE_LOG_FILE}" ] || install -m 640 -o pihole -g pihole /dev/null "${PIHOLE_LOG_FILE}"
|
[ -f /var/log/pihole/pihole.log ] || install -m 640 -o pihole -g pihole /dev/null /var/log/pihole/pihole.log
|
||||||
[ -f "${WEBSERVER_LOG_FILE}" ] || install -m 640 -o pihole -g pihole /dev/null "${WEBSERVER_LOG_FILE}"
|
[ -f /var/log/pihole/webserver.log ] || install -m 640 -o pihole -g pihole /dev/null /var/log/pihole/webserver.log
|
||||||
[ -f /etc/pihole/dhcp.leases ] || install -m 644 -o pihole -g pihole /dev/null /etc/pihole/dhcp.leases
|
[ -f /etc/pihole/dhcp.leases ] || install -m 644 -o pihole -g pihole /dev/null /etc/pihole/dhcp.leases
|
||||||
|
|||||||
@@ -116,11 +116,11 @@ c=70
|
|||||||
PIHOLE_META_PACKAGE_CONTROL_APT=$(
|
PIHOLE_META_PACKAGE_CONTROL_APT=$(
|
||||||
cat <<EOM
|
cat <<EOM
|
||||||
Package: pihole-meta
|
Package: pihole-meta
|
||||||
Version: 0.6
|
Version: 0.5
|
||||||
Maintainer: Pi-hole team <adblock@pi-hole.net>
|
Maintainer: Pi-hole team <adblock@pi-hole.net>
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Description: Pi-hole dependency meta package
|
Description: Pi-hole dependency meta package
|
||||||
Depends: awk,bash-completion,binutils,ca-certificates,cron|cron-daemon,curl,dialog,bind9-dnsutils|dnsutils,dns-root-data,git,grep,iproute2,iputils-ping,jq,libcap2,libcap2-bin,lshw,procps,psmisc,sudo,unzip
|
Depends: awk,bash-completion,binutils,ca-certificates,cron|cron-daemon,curl,dialog,dnsutils,dns-root-data,git,grep,iproute2,iputils-ping,jq,libcap2,libcap2-bin,lshw,procps,psmisc,sudo,unzip
|
||||||
Section: contrib/metapackages
|
Section: contrib/metapackages
|
||||||
Priority: optional
|
Priority: optional
|
||||||
EOM
|
EOM
|
||||||
@@ -694,11 +694,10 @@ chooseInterface() {
|
|||||||
status="OFF"
|
status="OFF"
|
||||||
done
|
done
|
||||||
# Disable check for double quote here as we are passing a string with spaces
|
# Disable check for double quote here as we are passing a string with spaces
|
||||||
# shellcheck disable=SC2086
|
|
||||||
PIHOLE_INTERFACE=$(dialog --no-shadow --keep-tite --output-fd 1 \
|
PIHOLE_INTERFACE=$(dialog --no-shadow --keep-tite --output-fd 1 \
|
||||||
--cancel-label "Exit" --ok-label "Select" \
|
--cancel-label "Exit" --ok-label "Select" \
|
||||||
--radiolist "Choose An Interface (press space to toggle selection)" \
|
--radiolist "Choose An Interface (press space to toggle selection)" \
|
||||||
${r} ${c} "${interfaceCount}" ${interfacesList})
|
${r} ${c} "${interfaceCount}" "${interfacesList}")
|
||||||
|
|
||||||
result=$?
|
result=$?
|
||||||
case ${result} in
|
case ${result} in
|
||||||
|
|||||||
+32
-21
@@ -612,7 +612,7 @@ compareLists() {
|
|||||||
gravity_DownloadBlocklistFromUrl() {
|
gravity_DownloadBlocklistFromUrl() {
|
||||||
local url="${1}" adlistID="${2}" saveLocation="${3}" compression="${4}" gravity_type="${5}" domain="${6}"
|
local url="${1}" adlistID="${2}" saveLocation="${3}" compression="${4}" gravity_type="${5}" domain="${6}"
|
||||||
local listCurlBuffer str httpCode success="" ip customUpstreamResolver=""
|
local listCurlBuffer str httpCode success="" ip customUpstreamResolver=""
|
||||||
local file_path permissions ip_addr port blocked=false download=true
|
local file_path ip_addr port blocked=false download=true
|
||||||
# modifiedOptions is an array to store all the options used to check if the adlist has been changed upstream
|
# modifiedOptions is an array to store all the options used to check if the adlist has been changed upstream
|
||||||
local modifiedOptions=()
|
local modifiedOptions=()
|
||||||
|
|
||||||
@@ -721,29 +721,40 @@ gravity_DownloadBlocklistFromUrl() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If we are going to "download" a local file, we first check if the target
|
# If we "download" a local file (file://), verify read access before using it.
|
||||||
# file has a+r permission. We explicitly check for all+read because we want
|
# When running as root (e.g., via pihole -g), check that the 'pihole' user can read the file
|
||||||
# to make sure that the file is readable by everyone and not just the user
|
# to match the effective runtime user of FTL; otherwise, check the current user's read access
|
||||||
# running the script.
|
# (e.g., in Docker or when invoked by a non-root user). The target must
|
||||||
if [[ $url == "file://"* ]]; then
|
# resolve to a regular file and be readable by the evaluated user.
|
||||||
|
if [[ "${url}" == "file:/"* ]]; then
|
||||||
# Get the file path
|
# Get the file path
|
||||||
file_path=$(echo "$url" | cut -d'/' -f3-)
|
file_path=$(echo "${url}" | cut -d'/' -f3-)
|
||||||
# Check if the file exists and is a regular file (i.e. not a socket, fifo, tty, block). Might still be a symlink.
|
# Check if the file exists and is a regular file (i.e. not a socket, fifo, tty, block). Might still be a symlink.
|
||||||
if [[ ! -f $file_path ]]; then
|
if [[ ! -f ${file_path} ]]; then
|
||||||
# Output that the file does not exist
|
# Output that the file does not exist
|
||||||
echo -e "${OVER} ${CROSS} ${file_path} does not exist"
|
echo -e "${OVER} ${CROSS} ${file_path} does not exist"
|
||||||
download=false
|
|
||||||
else
|
|
||||||
# Check if the file or a file referenced by the symlink has a+r permissions
|
|
||||||
permissions=$(stat -L -c "%a" "$file_path")
|
|
||||||
if [[ $permissions == *4 || $permissions == *5 || $permissions == *6 || $permissions == *7 ]]; then
|
|
||||||
# Output that we are using the local file
|
|
||||||
echo -e "${OVER} ${INFO} Using local file ${file_path}"
|
|
||||||
else
|
|
||||||
# Output that the file does not have the correct permissions
|
|
||||||
echo -e "${OVER} ${CROSS} Cannot read file (file needs to have a+r permission)"
|
|
||||||
download=false
|
download=false
|
||||||
fi
|
else
|
||||||
|
if [ "$(id -un)" == "root" ]; then
|
||||||
|
# If we are root, we need to check if the pihole user has read permission
|
||||||
|
# otherwise, we might read files that the pihole user should not be able to read
|
||||||
|
if sudo -u pihole test -r "${file_path}"; then
|
||||||
|
echo -e "${OVER} ${INFO} Using local file ${file_path}"
|
||||||
|
else
|
||||||
|
echo -e "${OVER} ${CROSS} Cannot read file (user 'pihole' lacks read permission)"
|
||||||
|
download=false
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# If we are not root, we just check if the current user has read permission
|
||||||
|
if [[ -r "${file_path}" ]]; then
|
||||||
|
# Output that we are using the local file
|
||||||
|
echo -e "${OVER} ${INFO} Using local file ${file_path}"
|
||||||
|
else
|
||||||
|
# Output that the file is not readable by the current user
|
||||||
|
echo -e "${OVER} ${CROSS} Cannot read file (current user '$(id -un)' lacks read permission)"
|
||||||
|
download=false
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -2,5 +2,5 @@ pyyaml == 6.0.3
|
|||||||
pytest == 8.4.2
|
pytest == 8.4.2
|
||||||
pytest-xdist == 3.8.0
|
pytest-xdist == 3.8.0
|
||||||
pytest-testinfra == 10.2.2
|
pytest-testinfra == 10.2.2
|
||||||
tox == 4.32.0
|
tox == 4.31.0
|
||||||
pytest-clarity == 1.0.1
|
pytest-clarity == 1.0.1
|
||||||
|
|||||||
Reference in New Issue
Block a user