pbr: document Tor, and link to the full reference - #27
Conversation
1f5a730 to
a526050
Compare
|
All four done in 1. Provenance — shortened in the doc, full text moved to this PRYou were right, and this was flagged as an open question when the file went up. The published doc now carries two lines:
The full version — including which conclusions were proposed and disproved along the way, and which facts were verified directly rather than inferred — is now in the PR description under Provenance (maintainer-facing). That seemed worth keeping somewhere: three plausible-sounding causes were wrong before the real one surfaced, and knowing which parts rest on evidence versus inference is useful if any of this ever needs revisiting. 2. Mode A promotedIt was buried under "The practical rule" after the whole mode B discussion. Now a callout immediately after the two modes are introduced, before either is explained:
Tradeoff kept prominent, as you asked. 3a. Filled nftset exampleAdded right after the Followed by: public addresses (40.x, 140.x, 185.x…) mean something other than Tor answered; no 3b. Post-upgrade check in the quick reference| How do I check Worth having there: the 4. Wording suggestionsI don't see the inline suggestions on this PR — possibly not submitted with the review. Happy to take them if you post them. |
a526050 to
f94375d
Compare
|
Second one applied in 1.
|
|
Co-pilot final review:
|
Tor had exactly one line in the docs -- "Tor tunnels supported in nft mode only (interface name must match tor)" -- repeated verbatim in every version. Everything a user needs in order to set it up, or to work out why it is not working, was undocumented. Adds a Tor section to pbr/1.2.3/README.md, between DNS Policies and Custom User Files, and links the existing Gateways/Tunnels bullet to it. Scoped to what a casual OpenWrt user needs: - What Tor is here: not a routed interface but a dstnat redirect, with no routing table, mark or gateway of its own. - That only ports 53, 80 and 443 are redirected, so a Tor policy is not a kill switch. - That dest_port, proto and chain are ignored on a Tor policy and src_port produces an invalid rule; match on source address instead. - A minimal working torrc, why AutomapHostsOnResolve is mandatory, and the IPv6 listeners. - That the service reads /etc/tor/torrc only, so ports in /etc/tor/custom -- where OpenWrt's own Tor client guide puts them -- are not seen. - A source-matched example policy, and the tradeoff that it sends all of that client's DNS through Tor. - Why .onion does not resolve on a stock OpenWrt: rfc6761.conf carries an addressless server=/onion/ that overrides any server=/onion/127.0.0.1#9053, with the logread check that confirms it. The full mechanism, the complete set of silent failure modes and the step-by-step diagnostics live in docs/tor.md in the pbr repository, which this section links to rather than restating. Keeping the depth in one place stops the two copies drifting, and keeps this page suited to its audience. The reference torrc uses VirtualAddrNetworkIPv4 172.16.0.0/12 rather than Tor's own default, to match what OpenWrt's Tor client guide sets, so a reader following both does not hit a mismatch. Scoped to 1.2.3 only. The top-level pbr/README.md and the older versioned copies (1.1.x, 1.2.0, 1.2.2) are left alone. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: Erik Conijn <egc112@msn.com>
What
Tor had exactly one line in the docs, repeated verbatim in every version:
Everything a user needs in order to set Tor up, or to work out why it isn't working, was undocumented.
Two files:
pbr/1.2.3/README.md— a### Torsection between DNS Policies and Custom User Files, with the existing Gateways/Tunnels bullet linked to it.pbr/tor/README.md— the deep-dive reference it links out to, version-independent, published athttps://docs.mossdef.org/pbr/tor/.Scope
Deliberately kept to what a casual OpenWrt user needs for a working setup:
dest_port,protoandchainare ignored on a Tor policy andsrc_portproduces an invalid rule — match on source address instead.AutomapHostsOnResolveis mandatory, and the IPv6 listeners./etc/tor/torrconly, so ports in/etc/tor/custom— where OpenWrt's own Tor client guide puts them — are never seen..oniondoes not resolve on a stock OpenWrt:/usr/share/dnsmasq/rfc6761.confcarries an addresslessserver=/onion/that overrides anyserver=/onion/127.0.0.1#9053, with the one-linelogreadcheck that confirms it.Depth lives elsewhere
The full mechanism, the complete set of silent failure modes, and step-by-step diagnostics live in
pbr/tor/README.md, which the README section links to rather than restating. That keeps the version README suited to its audience and stops two copies of the fiddly parts drifting apart.Both files are in this PR, so there is no cross-repo merge dependency and no window where the link is broken. (An earlier draft put this file in the
pbrrepository — mossdef-org/pbr#151, now closed in favour of this.)Laid out as
<dir>/README.mdand linked with an absolute URL, matching how every other page in this repo is structured and linked — all 33 pages are directory READMEs, and every cross-page link is a fullhttps://docs.mossdef.org/...URL.Details
The reference torrc uses
VirtualAddrNetworkIPv4 172.16.0.0/12rather than Tor's own default of127.192.0.0/10, to match what OpenWrt's Tor client guide sets — so a reader following both doesn't hit a mismatch.Scoped to 1.2.3 only — the top-level
pbr/README.mdand the older versioned copies (1.1.x, 1.2.0, 1.2.2) are left alone.Provenance (maintainer-facing)
Moved here out of the published doc, which now carries only a two-line note.
Written by Claude (Anthropic) on 2026-08-12/13 while working a pbr support thread: reading the pbr source and its git history, the dnsmasq and Tor manuals, and running tests against a live OpenWrt router. Most of it is verified against those sources or reproduced experimentally, but some is inference.
Worth recording that several confident-sounding conclusions were proposed and then disproved during that investigation before the real cause surfaced — dnsmasq rebind protection,
all-serversracing the upstreams, and ".onioncannot be forwarded at all". Each was plausible from the configuration alone and each was killed by evidence rather than argument. The two things that actually moved it forward were the reporter'slogqueriesoutput and agrepof OpenWrt's dnsmasq init script.Facts verified directly rather than inferred: the five rules and their gating (source),
TransPortbeing TCP-only andDNSPortUDP-only (Tor manual),all-serversdistributing only within the servers matched for a domain (dnsmasq man page and Simon Kelley on dnsmasq-discuss),rfc6761.confcontents and itsbogusprivgating (the file and the init script, reproduced with a throwaway dnsmasq on a spare port), and the Tor path being unchanged 1.1.6 → 1.2.3 (git history).🤖 Generated with Claude Code