Skip to content

Proof gate: netwatch relay-set test, required five-window KVM leg and new-egress grep gate for Tor-only egress #4153

Open

Description

@pithead-developer

What's the problem

The Tor-only egress work (#4145 (step 1: log-only firewall and netwatch) through #4152 (step 7: Tor hardening)) is only as good as the test that proves nothing else leaves the box. Today the netwatch classifier (tests/netwatch/netwatch-classify.sh) still has explicit EXPECTED rules for box NTP (egress-box-ntp), box DNS (egress-box-dns) and host service traffic on 443 (egress-host-service). Those rules would hide exactly the leaks the plan removes. There is no check that every public destination is a Tor relay or the configured pool, no ICMP or global-IPv6 rule, no gate against someone adding a new curl, wget, getent, requests or image pull, and nothing that proves the shipped firewall ruleset matches the allow-list.

The owner ruled on 2026-11-16 ("all as recommended") that outbound is Tor only except XMRig stratum to an owner-configured pool, and asked that this be tested and benchmarked for its effect on stability and mining. This issue is the correctness half: it proves the policy holds. The cost half is #4155 (benchmark). Step 1 wires netwatch into a non-required KVM leg; this step flips the rules and makes the leg required.

What it impacts

Every release gate and KVM or e2e run that claims "no clearnet leaks". A green netwatch run today can still contain NTP, plaintext DNS or direct 443 flows. It also gates #4154 (step 9: enforce the firewall), which must not ship until this proof is green on both roles.

How I found it

Reading netwatch-classify.sh and netwatch-selftest.sh on develop and the egress inventory behind the Tor-only plan. The three EXPECTED rules above exist today; the classifier's IPv6 branch has an explicit rule only through the private-address path, and there is no ICMP rule. I have not run the new checks; whether the IPv6 branch already fails a global address correctly is unverified and the first selftest will show it.

How important is it

High for 2.0.5. Without this gate the Tor-only claim is unproven, and enforcing the firewall without it risks both silent leaks and a locked-out box. Related watchdog work is already tracked in p2pool-starter-stack/bench-ci#2458, p2pool-starter-stack/bench-ci#2459, p2pool-starter-stack/bench-ci#2460 and p2pool-starter-stack/bench-ci#2461.

Acceptance criteria

  • The egress-box-ntp, egress-box-dns and egress-host-service EXPECTED rules are deleted from netwatch-classify.sh. A flow of each kind (UDP 123, any port 53 to a non-Tor resolver, 443 to a public address) is classified UNEXPECTED.
  • netwatch-selftest.sh has one negative test per removed rule, plus UDP 53 from a container and a pull-shaped flow, and each must fail the run when seen.
  • New relay-set test at the KVM vantage: every public destination in the capture is a relay in a consensus snapshotted at test start, or the configured pool address and port. Anything else is UNEXPECTED.
  • New classifier rules: any ICMP to a public address is UNEXPECTED; any global IPv6 flow is UNEXPECTED, with selftests for both.
  • The five-window KVM leg from Truth first: log-only egress firewall, netwatch in a KVM leg, honest dashboard labels, egress map as data #4145 (step 1: log-only firewall and netwatch) becomes required on both roles (Pithead appliance and RigForge rig): first boot, reboot, update, one hour of mining, and set up again. Each window passes only with a non-empty capture; a silent or dead capture is a failure, never green.
  • A CI grep gate fails a PR that adds curl, wget, getent, requests or a container image pull call site outside a reviewed list kept in the repo, with a test that the gate catches a planted call.
  • A test diffs the egress allow-list (the egress map data from step 1) against the shipped firewall ruleset and fails on any entry present in one and absent from the other.
  • The bench-ci egress watchdog (p2pool-starter-stack/bench-ci#2459, p2pool-starter-stack/bench-ci#2460, p2pool-starter-stack/bench-ci#2461) uses the same classifier and fails a KVM or e2e job on the first unexpected flow; this issue links to it and does not duplicate it.
  • The five-window leg fits in a bounded time per role, and total wall clock for the proof run stays within the owner's no-soak rule (hours, never multi-day).

Possible solutions

  • Delete the three rules and let the existing default verdict (UNEXPECTED) do the work, then add selftests first so each removal is shown failing before it is made.
  • Take the relay set from a consensus file copied into the harness at start; compare capture destinations offline after the window rather than live.
  • Implement the grep gate as a small script with a reviewed list file, run in the existing lint stage.
  • Generate both the firewall ruleset and the diff test input from the single egress map so the two cannot drift.

Sibling work: #4144 (tracker), #4156 (docs).

Activity

  1. added this to the v2.0.5 milestone on Nov 16, 2026
  2. added
    security
    testing
    operator-action
    on Nov 16, 2026
  3. added
    blocked
    on Nov 16, 2026
  4. pithead-developer commented on Nov 16, 2026

    @pithead-developer
    ContributorAuthor

    Blocked on #4150.
    Blocked on #4151.
    Blocked on #4152.

    Step 8 of the rollout order in #4144: it starts when steps 6 and 7 and the rig Tor client close (steps 2 to 5 close before them).

  5. removed
    operator-action
    on Nov 16, 2026
  6. pithead-architect commented on Nov 27, 2026

    @pithead-architect

    Release regroom (owner request, 2026-11-27): moved from v2.0.5 to v2.0.6. Blocked by #4151 / #4154, which the owner moved to 2.0.6 today; proof and docs follow what they prove.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    blockedsecuritytesting

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions