Skip to content

Commit 6e8fe13

Browse files
committed
set SU_EXEC var to prevent running as 5050:0 when someone uses the Docker --user flag
1 parent e540336 commit 6e8fe13

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

pkg/docker/entrypoint.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ if [ "$(id -u)" = "0" ]; then
1111
# Reassign the pgadmin user to the desired UID/GID
1212
usermod -o -u "$PUID" -g "$PGID" pgadmin 2>/dev/null || true
1313

14+
# Compose su-exec command
15+
SU_EXEC="su-exec $PUID:$PGID"
1416
echo "pgAdmin will run as UID=$PUID, GID=$PGID"
17+
else
18+
SU_EXEC=""
1519
fi
1620

1721
# Fixup the passwd file, in case we're on OpenShift
@@ -210,7 +214,7 @@ else
210214
fi
211215

212216
if [ -n "${PGADMIN_ENABLE_TLS}" ]; then
213-
exec su-exec "$PUID:$PGID" /venv/bin/gunicorn --limit-request-line "${GUNICORN_LIMIT_REQUEST_LINE:-8190}" --timeout "${TIMEOUT}" --bind "${BIND_ADDRESS}" -w 1 --threads "${GUNICORN_THREADS:-25}" --access-logfile "${GUNICORN_ACCESS_LOGFILE:--}" --keyfile /certs/server.key --certfile /certs/server.cert -c gunicorn_config.py run_pgadmin:app
217+
exec $SU_EXEC /venv/bin/gunicorn --limit-request-line "${GUNICORN_LIMIT_REQUEST_LINE:-8190}" --timeout "${TIMEOUT}" --bind "${BIND_ADDRESS}" -w 1 --threads "${GUNICORN_THREADS:-25}" --access-logfile "${GUNICORN_ACCESS_LOGFILE:--}" --keyfile /certs/server.key --certfile /certs/server.cert -c gunicorn_config.py run_pgadmin:app
214218
else
215-
exec su-exec "$PUID:$PGID" /venv/bin/gunicorn --limit-request-line "${GUNICORN_LIMIT_REQUEST_LINE:-8190}" --limit-request-fields "${GUNICORN_LIMIT_REQUEST_FIELDS:-100}" --limit-request-field_size "${GUNICORN_LIMIT_REQUEST_FIELD_SIZE:-8190}" --timeout "${TIMEOUT}" --bind "${BIND_ADDRESS}" -w 1 --threads "${GUNICORN_THREADS:-25}" --access-logfile "${GUNICORN_ACCESS_LOGFILE:--}" -c gunicorn_config.py run_pgadmin:app
219+
exec $SU_EXEC /venv/bin/gunicorn --limit-request-line "${GUNICORN_LIMIT_REQUEST_LINE:-8190}" --limit-request-fields "${GUNICORN_LIMIT_REQUEST_FIELDS:-100}" --limit-request-field_size "${GUNICORN_LIMIT_REQUEST_FIELD_SIZE:-8190}" --timeout "${TIMEOUT}" --bind "${BIND_ADDRESS}" -w 1 --threads "${GUNICORN_THREADS:-25}" --access-logfile "${GUNICORN_ACCESS_LOGFILE:--}" -c gunicorn_config.py run_pgadmin:app
216220
fi

0 commit comments

Comments
 (0)