Repository navigation
Description
What's the problem
The Tor container's config is permissive.
SocksPort 0.0.0.0:9050listens on every interface, with noSocksPolicy. Tor accepts any client that can reach it. Only the network layout limits who can.SafeSocksis off, so Tor accepts SOCKS requests where the client resolved the name itself, which is a DNS leak outside Tor.- All callers share one SOCKS port, and the time and DNS tracks will need their own.
ControlPortalso listens on the bridge address (port 9051), not only on loopback. The one in-repo user found, the bootstrap healthcheck and the signal scripts, uses127.0.0.1.ClientUseIPv6is not set, so IPv6 depends on Tor's default.- The Tor version comes from
apk add toron an Alpine base, so it moves with the base image (see build/tor: the apk-installed tor version is unpinned, so Alpine's 0.4.9 bump silently changed state-write semantics and broke the #3118 live proof #4125).
What it impacts
Pithead appliance and DIY owners. Any container on the bridge, or anything that gets routed to it, can use the box's Tor and its exit circuits. A client that resolves locally leaks the name. A control listener on the bridge is a larger surface than the stack needs. These are the Tor half of the Tor-only egress plan, so they decide how well the rest holds.
How I found it
Read build/tor/torrc.template and build/tor/Dockerfile on origin/develop, then grepped for 9051 across lib, os, dashboard, build and compose: the only users are the container's own healthcheck, control-signal.sh and recovery-diagnose.sh, all on 127.0.0.1. The Tor manual (older mirror, to re-check against the current one) says: no SocksPolicy means accept all, SafeSocks defaults to 0, ClientUseIPv6 defaults to 0. The coordinator's DataDirectory is already a persistent volume, so guards and the cached consensus already survive restarts. Whether a host-side caller reaches the control port by the bridge address is not proven.
How important is it
Medium to high for 2.0.5. The owner approved the full plan on 2026-11-16. This is step 7, after the clients, DNS and time are in place, and it must be proven on the canary bench before the proof gate (#4153 (step 8: proof gate)) and the firewall enforces, because a wrong SocksPolicy would cut off the dashboard, Tari or P2Pool. It is not urgent on its own because the bridge is private, but it is cheap and it closes a real gap.
Acceptance criteria
SocksPolicyaccepts only the stack subnet, the host address and loopback, and ends with a reject-all. A test connects from an address outside the accepted ranges and is refused.SafeSocks 1is set. A SOCKS request with a locally resolved name is rejected, and a test proves it.- Dedicated
SocksPortentries exist for the time and probe tracks (the per-caller usernames come from Fail-closed outbound clients: refuse to connect without Tor, in the dashboard and in the OS update verbs #4146 (step 2: fail-closed clients)). A test shows the tracks get different circuits. - The bridge
ControlPortlistener is removed unless a named caller needs it. If one does, the issue records the caller and the reason. The loopback listener still serves the healthcheck and the CLOCK_SKEW watch in Get the clock through Tor onion services and remove NTP and the clearnet htpdate fallback #4149 (step 5: time through Tor). ClientUseIPv6is set explicitly. Its value matches the IPv6-off ruling for the uplink (Remove the clearnet switches, accept only private IP literals for remote nodes, and turn IPv6 off on the uplink #4147 (step 3: remove clearnet switches)).- The Tor version is pinned and the pin is the one tracked in build/tor: the apk-installed tor version is unpinned, so Alpine's 0.4.9 bump silently changed state-write semantics and broke the #3118 live proof #4125.
pithead doctorreports the Tor version, and the SBOM records it. - The
DataDirectoryis not wiped by an update or a re-setup. A test restarts and updates the box and shows the same guards and consensus afterward. - A
tor.bridgesconfig key is reserved and rejected as unsupported for now, so adding bridges later is a labelled opt-in. Bridges themselves are deferred. - Verified on the canary bench after merge, with the result recorded on the PR. Through [benchmark] Stability and mining impact of Tor-only egress #4155 (benchmark), Tor bootstrap time, circuit build failure rate and dashboard, Tari and P2Pool connectivity are unchanged compared with the control arm (hours per arm, at most 24 h per run).
Possible solutions
- Edit
build/tor/torrc.templatein place: addSocksPolicy acceptlines (the entrypoint already substitutes the subnet prefix), a finalSocksPolicy reject *,SafeSocks 1, dedicatedSocksPortlines, andClientUseIPv6 0. - Verify first that host-side callers (the update verbs and the doctor) come from an address inside the accepted range. If they reach Tor through the bridge address, the host's bridge address needs its own accept line.
- Drop the bridge
ControlPortline after a grep and a canary run show nothing else needs it. Keep the cookie-auth setting on loopback. - Pin Tor either by an exact apk version or by baking the image with a fixed version. Take the choice from build/tor: the apk-installed tor version is unpinned, so Alpine's 0.4.9 bump silently changed state-write semantics and broke the #3118 live proof #4125 rather than deciding here.
- Optional: try
Sandbox 1on the canary only, and keep it only if it is stable. - Unknown: the Tor version the Alpine base ships, and whether the option defaults match the current manual. Check both on the built image.
Activity
pithead-developer commentedon Nov 16, 2026
Blocked on #4148.
Blocked on #4149.
Step 7 of the rollout order in #4144: it starts when steps 4 and 5 close, and is still proven on the canary bench.