From c180732af3f539a80e0161be6038ae09e475baea Mon Sep 17 00:00:00 2001 From: t3chn0m4g3 Date: Mon, 12 May 2025 11:48:47 +0200 Subject: [PATCH] Adjust genuser.sh - add more logging - retrieve docker repo and version tag from .env - only use specified repo / version for download image - allow for user interrupt --- docker/tpotinit/dist/bin/genuser.sh | 3 +++ genuser.sh | 13 ++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/docker/tpotinit/dist/bin/genuser.sh b/docker/tpotinit/dist/bin/genuser.sh index ed392f70..fef0f480 100755 --- a/docker/tpotinit/dist/bin/genuser.sh +++ b/docker/tpotinit/dist/bin/genuser.sh @@ -13,6 +13,9 @@ __ __ _ _ _ [ T-Pot ] EOF ) +# Add trap to ensure SIGINT, SIGTERM works +trap 'echo; echo; echo "# User interrupt. Exiting."; exit 1' SIGINT + # Generate T-Pot WebUser echo "$myPW" echo diff --git a/genuser.sh b/genuser.sh index 4973609b..293ca5c1 100755 --- a/genuser.sh +++ b/genuser.sh @@ -1,2 +1,13 @@ #!/usr/bin/env bash -docker run -v $HOME/tpotce:/data --entrypoint bash -it -u $(id -u):$(id -g) dtagdevsec/tpotinit:24.04.1 "/opt/tpot/bin/genuser.sh" +TPOT_REPO=$(grep -E "^TPOT_REPO" .env | cut -d "=" -f2-) +TPOT_VERSION=$(grep -E "^TPOT_VERSION" .env | cut -d "=" -f2-) +USER=$(id -u) +USERNAME=$(id -un) +GROUP=$(id -g) +echo "### Repository: ${TPOT_REPO}" +echo "### Version Tag: ${TPOT_VERSION}" +echo "### Your User Name: ${USERNAME}" +echo "### Your User ID: ${USER}" +echo "### Your Group ID: ${GROUP}" +echo +docker run -v $HOME/tpotce:/data --entrypoint "bash" -it -u "${USER}":"${GROUP}" "${TPOT_REPO}"/tpotinit:"${TPOT_VERSION}" "/opt/tpot/bin/genuser.sh"