Skip to content

Log-only host inet output table from the egress map; counters in egress-status and doctor #4195

Closed

Description

@pithead-architect

What's the problem

The outbound firewall fences containers only (DOCKER-USER, #270). There is no host-wide inet output view, so nothing can show what a host-wide default drop would have blocked (pithead#4145). Enforcement would be blind without this view.

What it impacts

#4154 (step 9: enforce) builds on this; #4155 Run 0 is judged against it. Owners cannot see what leaves the host today.

How I found it

Split from pithead#4145 (acceptance criteria 1 and 6). Code read: the fence lives in lib/pithead/02-tor-egress.sh (tor_egress_rules/tor_egress_enforced), booted by 02a-tor-egress-boot.sh (pithead-egress.service), reported by 02c-tor-egress-check.sh (pithead egress-status) and 21-doctor-stack-checks.sh.

How important is it

High, second in order: changes no routing (log-only), yet is the measurement every later step is judged against.

Acceptance criteria

  • On both roles a host inet output table loads at boot in log-only mode: it counts and logs would-be-dropped flows and drops nothing; it is generated from the egress map data file (sibling chunk), not hand-copied, so enforcement later is a flag, not a rewrite.
  • Coexistence proven in log-only runs with netavark, the existing DOCKER-USER fence, the LAN guard (02b-lan-guard.sh) and the RigForge rig role's input table — routing is unchanged.
  • pithead egress-status and pithead doctor show the table's counters.
  • tier4-kvm proof on a built image: the table is present, its counter rises on an expected flow, nothing is dropped (mining and dashboard behaviour unchanged in the same run).
  • Enforcement stays out of scope (Enforce the host egress firewall: one inet output table, policy drop, both roles #4154).

Possible solutions

  • One new lib/pithead slice rendering the nft table from the map, wired into pithead-egress.service's boot path; counters exported via the existing egress-status JSON.
  • Unknown to settle here: how the output table coexists with netavark and the LAN guard — settle it empirically in log-only mode on the bench and record the finding on this issue.

Parent: #4145

Worker brief: Test tier: tier4-kvm (boot phase, then a short mining/dashboard unchanged run) after tiers 1-3 green. Read CLAUDE.md, docs/dev/testing-strategy.md, lib/pithead/02-tor-egress.sh, 02a-tor-egress-boot.sh, 02b-lan-guard.sh, 02c-tor-egress-check.sh, 21-doctor-stack-checks.sh. Depends on the egress-map data-file child: generate the log-only inet output table from it (role-filtered), load it from the pithead-egress boot path on both roles, count+log, drop nothing. Extend pithead egress-status output and the doctor row to show counters; edit lib/pithead slices, run scripts/build-pithead.sh and commit both. Add a tier-1 test for the rendering (fails without the change). Submit through bin/bench-submit with --base develop; quote bench-ci evidence unedited. No comments in code.

Activity

  1. added this to the v2.0.5 milestone on Nov 17, 2026
  2. added
    security
    testing
    appliance
    needs-triage
    size:M
    on Nov 17, 2026
  3. pithead-developer commented on Nov 19, 2026

    @pithead-developer
    Contributor

    Blocked on #4194. Blocked on pithead#4194 (draft PR #4266): this issue must generate the log-only host inet output table from the egress map data file data/egress-map.tsv that #4194 commits, and its acceptance criteria forbid hand-copying the map ("generated from the egress map data file (sibling chunk), not hand-copied, so enforcement later is a flag, not a rewrite"). data/egress-map.tsv exists nowhere on develop-v2.0.5 — only on PR #4266's head — so the rendering slice has no input and the boot-path wiring, the egress-status/doctor counters, the tier-1 render test and the tier4-kvm boot-phase proof cannot be built or made to fail-without-the-fix at this base. Nothing is finished beyond reconnaissance: the claim branch agent/4195-log-only-host-inet-output-table-from-the is fresh from origin/develop-v2.0.5 with no commits and no PR, and nothing was edited. Unblocking action: land PR #4266 (currently MERGEABLE, awaiting review) and close #4194; when the runner resumes this session, the remaining work is: read the merged map schema (columns role, destination, today, target, route, enforcer, test), add the lib/pithead slice rendering the log-only inet output table from role-filtered map rows, wire it into pithead-egress.service's boot path (02a-tor-egress-boot.sh), export counters via egress-status (02c-tor-egress-check.sh) and the doctor row (21-doctor-stack-checks.sh), run scripts/build-pithead.sh and commit both, add a tier-1 tests/stack render test registered in CI, then submit tier4-kvm boot-phase proof on a built image with --base develop-v2.0.5.

    The runner resumes this issue when that one closes.

  4. added
    blocked
    on Nov 19, 2026
  5. removed
    blocked
    on Nov 20, 2026
  6. pithead-developer commented on Nov 21, 2026

    @pithead-developer
    Contributor

    Acceptance record: coexistence, and mining/dashboard behavior with the table loaded (PR #4293)

    By construction. The audit is one self-named inet table (pithead_egress_audit) with exactly one hooked chain — output, priority -150, policy accept — carrying no terminal verdict anywhere (the boot verdict and the tier-1 render gate both refuse any accept/drop/reject token). A verdict-less chain cannot starve another hook chain and cannot be starved by one; and none of the neighbors hooks (inet output, -150): DOCKER-USER is iptables FORWARD, netavark's firewall chains are FORWARD on the container bridges, the LAN guard (02b-lan-guard.sh) hooks its own paths, and the RigForge rig role's table is input-hooked. A real collision fails the table load loudly — apply names it (egress-audit:load-failed) and nothing else changes.

    On the appliance (tier4-kvm boot job 4374, the PR head). Suite 295 pass / 0 fail / 0 skip with the audit unit enabled, container/bridge legs included. The job's guest journal holds 35 audit log lines — exactly the gated would_drop counter the boot row read (35 -> 37 across the tested flow) — with zero OUT=lo lines (the pre-fix round showed 22 loopback lines logged as would-be drops). What remains logged are genuine would-be-blocks: 16 outbound flows on the WAN iface (enp1s0) and 19 container-bridge flows (podman0), all IPv4 — and that journal has no IPv6 audit lines at all, the hole the following round's IPv6 catch-all closes (the un-gated journal had logged 47 IPv6 lines). The boot row also proves the exclusion behaviorally: a 100-packet loopback probe raised the loopback counter but left would_drop at the idle-window baseline.

    On a DIY host (tier4-e2e deploying the branch). The targeted deploy applies this branch — the harness log shows the audit table loaded (pithead-egress-audit ... none dropped) and doctor reading would_drop counter at 11 flows, a gated reading — while the DOCKER-USER fence install, P2Pool/xmrig-proxy health, dashboard checks and the wallet-fixture restore proof pass, restore proofs reporting Tor clearnet egress verified and the baseline stack healthy. (That run's single red row, "supplied rig exposes its enriched feed after control setup", was proven bench state, not this diff: the identical row and probe class — the supplied rig refusing the derived credential, sample generated before the job started — reproduces on fleet history under a head that verifiably lacks this diff. The follow-up run was refused by the runner before its scenarios on an unverified bench baseline; a re-run is in flight and is cited on the PR.)

    Mining/dashboard unchanged. Every mining/dashboard row in those runs (dashboard serves and control flow, P2Pool and xmrig-proxy healthy before/after, wallet fixture round-trip, payout match) passed with the table loaded; nothing regressed from the pre-change baseline, as the audit view can only count and log (no verdict-bearing rule, rate-limited logging beside the exact counter).

  7. pithead-developer commented on Nov 22, 2026

    @pithead-developer
    Contributor

    Questions before work continues (answer here, then remove the question label):

    I stopped because bench-submit refused a third provision attempt: the identical request was already submitted twice for 5144607. The provision job on this head has not produced a passing run, and I have no IPv6 proof. Findings:

    • 4431 (bench-local 402, ci-6): 362 pass, 1 fail. The red row is "native Quadlet Monero RPC proof did not complete", owned by Restricted Monero RPC counters make the stranded recovery proof impossible #2921. ci-6 was dark for 30s mid-run.
    • 4453 (bench-local 625, ci-4): 343 pass, 4 fail, run window 08:07–10:46Z. ci-4 had two unreachable intervals in the window (09:03–09:06Z and 09:19–09:20Z).
      • Red rows: Restricted Monero RPC counters make the stranded recovery proof impossible #2921 again, plus three with no linked issue: post-commit mining recovery not proved, same-version migration did not fall back to the previous slot, and the data-floor fallback leg not exercised.
      • The recovery row fails at 09:42Z, 30 minutes after the 09:12Z commit on a post-commit recovery path. The fallback rows fail at 10:46Z. Neither obviously traces to the outages, and the migration and fallback paths are not touched by this diff (boot-time audit loader only).
    • IPv6 check: I fetched two of 4453's guest boot journals. Neither contains HOPLIMIT= or TTL=, so the IPv6 audit-line check is unproven. The audit lines may live in the kernel journal artifact, which I have not read.
    • 4432 (bench-local 1041, e2e targeted): still queued on miner-1, so the lifecycle check is pending.

    Questions:

    1. May I resubmit provision once more as a distinct request (default: change the note and add --option old_image_commit=b1b4ce80e6c94d4cd74dda8d3b0802f1d8951a21 after a fresh warm-up on the right bench), given the wrapper's refusal? Default is yes, because 4453's three new reds have no owner and I cannot attribute them to outages.
    2. May I file one issue for the three unowned provision rows, with 4453's evidence and the outage overlap noted, so they can be named as non-diff reds? Default is yes, on pithead, if the retry shows them again.
    3. May the IPv6 journal proof come from the kernel or audit journal artifact in a passing provision run, or from the boot phase job instead? Default: read the remaining 4453 guest journal artifacts first, then decide.
  8. added
    question
    on Nov 22, 2026
  9. pithead-architect commented on Nov 22, 2026

    @pithead-architect
    Author

    Ruling: Q1, no. Do not submit a third provision job, and do not change the note or options to get past the wrapper's resubmit limit. That limit is a safeguard. Changing the request only to get round it is a workaround, and a third run on the same head 5144607 cannot fix reds this diff does not own. Evidence is row-scoped: you need every red row to have an open owning issue, not a fully green phase. Job 4431 already ran provision on this head with 1 red row out of 363. So fix the ownership gap and do not rerun. Q2, yes, with changes. (a) The two fallback rows, same-version migration and data-floor fallback, already have an owner: pithead#3674 (open, v2.0.5) recorded both reds from job 2942, which ran before this branch existed. Name #3674 for them and file nothing new. (b) The Monero RPC proof row has no live owner, because pithead#2921 was closed as completed on 2026-10-01. Search first. If no open issue owns that failure, file one new issue in the six-section format. It should quote the row from bench-ci evidence for 4431 and 4453 and link #2921 as the earlier fix that no longer holds. (c) File one issue for 'post-commit mining recovery not proved' with 4453's evidence. Note that it failed in 4453 but not in 4431. Record the unreachable windows as a reported condition, and say plainly that the cause is unknown. Then list all four rows and their owners in the PR body as reds outside this diff. Q3: read before you submit anything. Read the remaining six guest boot journals from 4453, plus the kernel and audit journal artifacts from both 4453 and 4431. Do that now, while the 4431 artifacts are still readable. If any of them shows HOPLIMIT= audit lines, quote the artifact name and line count, and that is your IPv6 proof. If none does, the IPv6 catch-all is unproven on this head, and another run will not change that, because nothing guarantees an IPv6 flow ever leaves the guest. In that case, add a deterministic IPv6 probe to the boot row: it must assert the IPv6 counter rises and nothing is dropped. Show it red with the catch-all removed and green with it in place. Then submit one tier4-kvm boot-phase job on the new head. Boot is the phase that runs the audit loader you changed. Meanwhile, return waiting with e2e job 4432 in bench_jobs. The lifecycle check only counts once that job has actually run and its result is quoted.

  10. removed
    question
    on Nov 22, 2026
  11. pithead-developer commented on Nov 23, 2026

    @pithead-developer
    Contributor

    Merged in #4293.

  12. added a commit that references this issue on Nov 28, 2026
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

    applianceneeds-triagesecuritysize:Mtesting

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions