From f61100769a3276183a0923252e4e66334fb7ef13 Mon Sep 17 00:00:00 2001 From: Paulo Date: Mon, 7 Sep 2026 18:38:50 +0200 Subject: [PATCH] Bind the proxy to SECRETS_PROXY_BIND_HOST The image's command fixed the listen host at 0.0.0.0, so a deployment on the host network restated the whole command to bind one interface. The bind host is now a variable with the same default. Verified with the built image: the variable binds 127.0.0.1:8880, its absence binds 0.0.0.0:8880. Co-Authored-By: Claude Fable 5.1 --- deploy/proxy/Dockerfile | 4 +++- docs/deploy.md | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/deploy/proxy/Dockerfile b/deploy/proxy/Dockerfile index d4af3f2..283c676 100644 --- a/deploy/proxy/Dockerfile +++ b/deploy/proxy/Dockerfile @@ -2,4 +2,6 @@ FROM mitmproxy/mitmproxy:12.2.3 COPY swap.py /addon/swap.py -CMD ["mitmdump", "--listen-host=0.0.0.0", "--listen-port=8880", "--set=flow_detail=1", "-s", "/addon/swap.py"] +# A host-networked deployment binds one interface. It sets the variable and +# keeps the command. +CMD ["sh", "-c", "exec mitmdump --listen-host=\"${SECRETS_PROXY_BIND_HOST:-0.0.0.0}\" --listen-port=8880 --set=flow_detail=1 -s /addon/swap.py"] diff --git a/docs/deploy.md b/docs/deploy.md index 9c9736d..b5afbfa 100644 --- a/docs/deploy.md +++ b/docs/deploy.md @@ -278,9 +278,11 @@ placeholder for the real credential on the way out. Two pieces run this: - **The proxy** is `ghcr.io/czpython/drukbox/proxy`: the official `mitmproxy/mitmproxy` image with the addon `deploy/proxy/swap.py` built in. - It listens on 8880 and reads the exchange address from - `SECRETS_EXCHANGE_URL`. A checkout can mount the addon into the official - image instead. It terminates TLS only for the hosts + It listens on 8880 at `SECRETS_PROXY_BIND_HOST`, `0.0.0.0` by default, and + reads the exchange address from `SECRETS_EXCHANGE_URL`. A deployment on the + host network sets the bind host to the one address its sandboxes dial. On a + public host an open listener is an open proxy. A checkout can mount the + addon into the official image instead. It terminates TLS only for the hosts that have a registered secret and tunnels every other host blind. It refuses a destination that resolves to a loopback, private, link-local, or metadata address. It makes its CA on first start and keeps it in a volume.