mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-03-03 23:38:29 +00:00
Do not overwrite TLS cert/key mode (#5998)
This commit is contained in:
commit
c5d66c2162
2 changed files with 9 additions and 18 deletions
|
@ -10,22 +10,17 @@ utilsfile="${PI_HOLE_SCRIPT_DIR}/utils.sh"
|
|||
FTL_PID_FILE="$(getFTLConfigValue files.pid)"
|
||||
|
||||
# Ensure that permissions are set so that pihole-FTL can edit all necessary files
|
||||
# shellcheck disable=SC2174
|
||||
mkdir -pm 0640 /var/log/pihole
|
||||
mkdir -p /var/log/pihole
|
||||
chown -R pihole:pihole /etc/pihole /var/log/pihole
|
||||
chmod -R 0640 /var/log/pihole
|
||||
chmod -R 0660 /etc/pihole
|
||||
|
||||
# Logrotate config file need to be owned by root and must not be writable by group and others
|
||||
chown root:root /etc/pihole/logrotate
|
||||
chmod 0644 /etc/pihole/logrotate
|
||||
|
||||
# allow all users to enter the directories
|
||||
chmod 0755 /etc/pihole /var/log/pihole
|
||||
|
||||
# allow pihole to access subdirs in /etc/pihole (sets execution bit on dirs)
|
||||
# credits https://stackoverflow.com/a/11512211
|
||||
find /etc/pihole/ -type d -exec chmod 0755 {} \;
|
||||
find /etc/pihole/ /var/log/pihole/ -type d -exec chmod 0755 {} +
|
||||
# Set all files (except TLS-related ones) to u+rw g+r
|
||||
find /etc/pihole/ /var/log/pihole/ -type f ! \( -name '*.pem' -o -name '*.crt' \) -exec chmod 0640 {} +
|
||||
# Set TLS-related files to a more restrictive u+rw *only* (they may contain private keys)
|
||||
find /etc/pihole/ /var/log/pihole/ -type f -name '*.pem' -o -name '*.crt' -exec chmod 0600 {} +
|
||||
|
||||
# Logrotate config file need to be owned by root
|
||||
chown root:root /etc/pihole/logrotate
|
||||
|
||||
# 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}"
|
||||
|
|
|
@ -127,10 +127,6 @@ def test_installPihole_fresh_install_readableFiles(host):
|
|||
check_localversion = test_cmd.format("r", "/etc/pihole/versions", piholeuser)
|
||||
actual_rc = host.run(check_localversion).rc
|
||||
assert exit_status_success == actual_rc
|
||||
# readable logrotate
|
||||
check_logrotate = test_cmd.format("r", "/etc/pihole/logrotate", piholeuser)
|
||||
actual_rc = host.run(check_logrotate).rc
|
||||
assert exit_status_success == actual_rc
|
||||
# readable macvendor.db
|
||||
check_macvendor = test_cmd.format("r", "/etc/pihole/macvendor.db", piholeuser)
|
||||
actual_rc = host.run(check_macvendor).rc
|
||||
|
|
Loading…
Add table
Reference in a new issue