Skip to content

Commit 9220759

Browse files
committed
Refactor kubetap-entrypoint.sh to remove redundant directory permission settings and improve config file handling
1 parent c6febe4 commit 9220759

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

proxies/mitmproxy/Dockerfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ RUN apt-get update && \
66
apt-get install -y --no-install-recommends tmux && \
77
rm -rf /var/lib/apt/lists/*
88

9-
# HACK: the security context of the injected pod could be run as any user, therefore
10-
# all users must be able to write to the directory.
11-
# Ensure the directory exists and is world-writable
9+
# Ensure the directory exists and is world-writable BEFORE we switch users
1210
RUN mkdir -p /home/mitmproxy/.mitmproxy && \
13-
chmod -R 777 /home/mitmproxy/.mitmproxy/
11+
chmod 777 /home/mitmproxy && \
12+
chmod 777 /home/mitmproxy/.mitmproxy
1413

1514
# Hijack the mitmproxy entrypoint (docker-entrypoint.sh) so that
1615
# configuration can be built from within the container using the

proxies/mitmproxy/kubetap-entrypoint.sh

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,9 @@ set -o errexit
44
set -o pipefail
55
set -o nounset
66

7-
# Ensure the .mitmproxy directory exists with proper permissions
8-
mkdir -p /home/mitmproxy/.mitmproxy
9-
chmod 777 /home/mitmproxy/.mitmproxy
10-
117
# Copy the config file if it exists and is readable
128
if [ -f /home/mitmproxy/config/config.yaml ] && [ -r /home/mitmproxy/config/config.yaml ]; then
139
cp /home/mitmproxy/config/config.yaml /home/mitmproxy/.mitmproxy/config.yaml
14-
chmod 666 /home/mitmproxy/.mitmproxy/config.yaml
1510
echo "Config file copied to /home/mitmproxy/.mitmproxy/config.yaml" >&2
1611
else
1712
echo "Warning: Config file not found or not readable at /home/mitmproxy/config/config.yaml" >&2

0 commit comments

Comments
 (0)