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
This commit is contained in:
t3chn0m4g3
2025-05-12 11:48:47 +02:00
parent cc9c1d95ce
commit c180732af3
2 changed files with 15 additions and 1 deletions

View File

@ -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

View File

@ -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"