docker-images/images/gossa/run.sh
Starbeamrainbowlabs 81d025dc2a
gossa/run.sh: --init-groups → --clear groups
--init-groups requires a user that can be found on the system.
2021-02-04 23:16:11 +00:00

24 lines
743 B
Bash
Executable file

#!/usr/bin/env bash
if [[ -z "${GOSSA_UID}" ]]; then
echo "Error: No target uid specified in the GOSSA_UID environment variable.";
exit 1;
fi
if [[ -z "${GOSSA_GID}" ]]; then
echo "Error: No target gid specified in the GOSSA_GID environment variable.";
exit 1;
fi
if [[ -z "${NOMAD_PORT_GOSSA}" ]]; then
echo "Error: No port number specified in the NOMAD_PORT_GOSSA environment variable.";
exit 1;
fi
echo "[core] Starting";
echo "[core] Running as uid = ${GOSSA_UID} gid = ${GOSSA_GID} port = ${NOMAD_PORT_GOSSA}";
cd "/mnt" || { echo "Failed to cd into /mnt"; exit 1; };
setpriv --inh-caps=-all --reuid "${GOSSA_UID}" --clear-groups --regid "${GOSSA_GID}" /usr/local/bin/gossa -p "${NOMAD_PORT_GOSSA}" /mnt;
echo "[core] Ending";