From e0fd8cb9645db7cf27990ab9b12d13d613219a94 Mon Sep 17 00:00:00 2001 From: TheSpad Date: Sun, 28 Aug 2022 16:07:23 +0100 Subject: [PATCH] Expand tamper check and enable custom files warning --- root/docker-mods | 28 +++++++++++++------ .../s6-overlay/s6-rc.d/init-custom-files/run | 10 ++++++- .../s6-overlay/s6-rc.d/init-script-check/run | 4 --- 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/root/docker-mods b/root/docker-mods index 9217c73..17aa908 100755 --- a/root/docker-mods +++ b/root/docker-mods @@ -9,21 +9,31 @@ set_legacy_executable_bits() { /etc/services.d/*/* 2>/dev/null || true } -# Tamper check legacy custom service locations +# Tamper check custom service locations tamper_check() { - if [[ -d "/config/custom-services.d" ]] && [[ -n "$(find /config/custom-services.d ! -user root)" ]]; then + SERVICES_DIR_OLD="/config/custom-services.d" + SERVICES_DIR="/custom-services.d" + if [[ -d "${SERVICES_DIR_OLD}" ]] && [[ -n "$(find ${SERVICES_DIR_OLD} ! -user root)" ]]; then echo "**** Potential tampering with custom scripts detected ****" randstr=$( tr /dev/null)" ]] && [[ -n "$(/bin/ls -A "/config/custom-services.d" 2>/dev/null)" ]]; then cat <<-EOF | tee /config/custom-cont-init.d/README.txt,/config/custom-services.d/README.txt 2>/dev/null