From a9960c8d6a89b3dd315da397f4c7f4140bc18f2b Mon Sep 17 00:00:00 2001 From: Zoey Date: Mon, 8 May 2023 22:59:47 +0200 Subject: [PATCH 1/2] add root user check for mastercontainer Signed-off-by: Zoey --- Containers/mastercontainer/start.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Containers/mastercontainer/start.sh b/Containers/mastercontainer/start.sh index 96b64cbc..e54debc2 100644 --- a/Containers/mastercontainer/start.sh +++ b/Containers/mastercontainer/start.sh @@ -20,6 +20,11 @@ case "${1}" in esac } +if [ "$(whoami)" != "root" ] || [ "$(id -u)" != "0" ] || [ "$(id -g)" != "0" ]; then + print_red "Container does not run as root. Cannot continue." + exit 1 +fi + # Check if socket is available and readable if ! [ -a "/var/run/docker.sock" ]; then print_red "Docker socket is not available. Cannot continue." From 40c3a24b8bc7ab1a564ea4b619244f21ad284e3c Mon Sep 17 00:00:00 2001 From: Zoey Date: Tue, 9 May 2023 11:17:39 +0200 Subject: [PATCH 2/2] Update Containers/mastercontainer/start.sh Co-authored-by: Simon L. Signed-off-by: Zoey --- Containers/mastercontainer/start.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Containers/mastercontainer/start.sh b/Containers/mastercontainer/start.sh index e54debc2..10c3befa 100644 --- a/Containers/mastercontainer/start.sh +++ b/Containers/mastercontainer/start.sh @@ -20,8 +20,9 @@ case "${1}" in esac } -if [ "$(whoami)" != "root" ] || [ "$(id -u)" != "0" ] || [ "$(id -g)" != "0" ]; then - print_red "Container does not run as root. Cannot continue." +# Check if running as root user +if [ "$EUID" != "0" ]; then + print_red "Container does not run as root user. This is not supported." exit 1 fi