properly assume Docker permissions, fix #5700 (#5702)

This commit is contained in:
Maximilian Hils 2022-10-31 18:16:00 +01:00 committed by GitHub
parent 464650e677
commit 597eaf4148
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 7 deletions

View file

@ -7,14 +7,17 @@ set -o nounset
MITMPROXY_PATH="/home/mitmproxy/.mitmproxy"
if [ -f "$MITMPROXY_PATH/mitmproxy-ca.pem" ]; then
f="$MITMPROXY_PATH/mitmproxy-ca.pem"
else
f="$MITMPROXY_PATH"
fi
usermod -o \
-u $(stat -c "%u" "$f") \
-g $(stat -c "%g" "$f") \
mitmproxy
if [[ "$1" = "mitmdump" || "$1" = "mitmproxy" || "$1" = "mitmweb" ]]; then
mkdir -p "$MITMPROXY_PATH"
if [ -f "$MITMPROXY_PATH/mitmproxy-ca.pem" ]; then
usermod -o \
-u $(stat -c "%u" "$MITMPROXY_PATH/mitmproxy-ca.pem") \
-g $(stat -c "%g" "$MITMPROXY_PATH/mitmproxy-ca.pem") \
mitmproxy
fi
gosu mitmproxy "$@"
else
exec "$@"