mirror of
https://github.com/KeygraphHQ/shannon.git
synced 2026-04-30 16:17:50 +02:00
de8b7c368d
Use entrypoint-based UID remapping instead of --user flag so the container's pentest user matches the host UID/GID, keeping bind-mounted volumes writable. Git config moved to --system level to survive remapping.
19 lines
508 B
Bash
Executable File
19 lines
508 B
Bash
Executable File
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
TARGET_UID="${SHANNON_HOST_UID:-}"
|
|
TARGET_GID="${SHANNON_HOST_GID:-}"
|
|
CURRENT_UID=$(id -u pentest 2>/dev/null || echo "")
|
|
|
|
if [ -n "$TARGET_UID" ] && [ "$TARGET_UID" != "$CURRENT_UID" ]; then
|
|
deluser pentest 2>/dev/null || true
|
|
delgroup pentest 2>/dev/null || true
|
|
|
|
addgroup -g "$TARGET_GID" pentest
|
|
adduser -u "$TARGET_UID" -G pentest -s /bin/bash -D pentest
|
|
|
|
chown -R pentest:pentest /app/sessions /app/deliverables /app/workspaces
|
|
fi
|
|
|
|
exec su pentest -c "exec $*"
|