Skip to content

Open the egress firewall for a clearnet project donation route only when chosen #3703

Done

Description

@pithead-developer

What's the problem

Part of #2476. Owner priority (2026-10-27): build the opt-in donation feature now, shipping dark. The Tor-only egress firewall drops a direct dial from xmrig-proxy unless a chosen exception is installed. Today the only exception for xmrig-proxy is the XvB one: tor_egress_sync_ips adds the proxy's address only when XVB_ENABLED=true and XVB_TOR_ENABLED=false (lib/pithead/02b-tor-egress-apply.sh:18-19), tor_egress_choice_active knows only the p2pool and xvb choices (:24-31), and the boot-time choice markers are armed and pruned in two loops over p2pool xvb (:39, :52). With donation.tor false and the firewall on, the project route would be dropped without any exception, so the slice would silently end in the fail-open fallback.

Add donation as a third choice:

  • tor_egress_sync_ips adds the proxy's address when DONATION_ENABLED=true and DONATION_TOR_ENABLED=false; tor_egress_choice_active and both marker loops handle donation.
  • lib/pithead/39b-describe-change-exposure.sh: egress_firewall_exempts (:14-20) returns true for xmrig-proxy when the donation choice is active, and a DONATION_TOR_ENABLED row follows the XVB_TOR_ENABLED row (:33-43) with plain sentences for both directions.
  • docs/privacy.md where it lists the chosen exceptions (the paragraph that says a P2Pool or XvB exception refuses startup on refresh failure) gains the donation choice.

The exception is per container address, not per destination, so it also opens whatever else xmrig-proxy dials directly; the XvB choice has the same property (docs/configuration.md:258: only xmrig-proxy gets an IPv4 firewall exception). The PR states this in the privacy text.

What it impacts

Hosts with donation.tor false and the egress firewall on; no effect with Tor on (the default) or the feature off. Boot ordering: the choice marker is what lets the exception exist before containers start, so it must be right on reboot.

How I found it

Read-only scan of origin/develop-v2.1.0 at 02852bd on 2026-10-27 from the paths above and tests/stack/firewall/choice-startup.sh:10-42 (the marker lifecycle tests). Nothing was executed. Unknown: whether the exception can be narrowed to the project endpoint address instead of the container (a clearnet endpoint has a fixed address, an onion has none and is never exempted); and whether the owner will allow a clearnet route at all (owner decision: onion only, or clearnet with a pinned TLS fingerprint). This issue is only needed if a clearnet route is allowed.

How important is it

Medium, security-sensitive: it widens the egress firewall for an opt-in path, and the boot-time marker logic is subtle. Needed before the privacy profile's Performance setting can mean "no Tor on anything" for the donation.

Acceptance criteria

  • New cases in tests/stack/firewall/ (pattern choice-startup.sh:31-42): with DONATION_ENABLED=true and DONATION_TOR_ENABLED=false the proxy address is in the exception list and the donation marker is armed before Compose; with Tor on or the feature off it is absent; a failed refresh removes only the disabled donation marker; removal clears the marker.
  • XvB and P2Pool choice behavior is unchanged: the existing cases in choice-startup.sh pass untouched.
  • A preview test in tests/stack/control/ (pattern control-sensitive-preview.sh:77-86): donation.tor false with the firewall on names the exposure of this host's IP to the project endpoint; with the firewall off it says the same without claiming a scoped exception; turning Tor back on names the restored posture.
  • docs/privacy.md lists the donation choice and states the per-container scope.
  • The PR changes shell under lib/pithead/ only (no os/, build/ or compose path), so no tier4 job is required to merge. It cites the stack firewall tests; a bench run of the --hardening phase before go-live is advised.
  • make test, make lint-sh, make lint-pithead-build and make lint-file-budget pass. No new explanatory code comments.

Possible solutions

  • A third choice name through the existing machinery (recommended: reuses the tested marker lifecycle).
  • Restrict the donation route to Tor and drop donation.tor as a user key: removes this whole child, and means Performance cannot reach the project without Tor. Needs the owner's routing ruling.
  • Narrow the exception to the endpoint address with a destination rule: smaller exposure, a larger firewall change.

Part of #2476. Depends on {{A1}}.

Activity

  1. added this to the v2.1.0 milestone on Oct 27, 2026
  2. added
    enhancement
    security
    on Oct 27, 2026
  3. added
    blocked
    on Oct 27, 2026
  4. removed
    blocked
    on Nov 10, 2026
  5. pithead-developer commented on Nov 22, 2026

    @pithead-developer
    ContributorAuthor

    Blocked on #4309. I made no edits and opened no PR. This issue's prerequisite config keys are not on develop. #3703 depends on the donation config keys (#3693, closed). Those landed only on develop-v2.1.0, and their forward-port to develop is still open as pithead#4309. On develop, DONATION_ENABLED, DONATION_TOR_ENABLED and donation.tor do not exist in config.reference.json, 33-render-env.sh, compose or any test (the only DONATION hit in lib is XVB_DONATION_LEVEL). The firewall change (02b-tor-egress-apply.sh, 39b-describe-change-exposure.sh) would therefore read env keys nothing sets, and the preview's config_bool '.donation.tor' would have no schema behind it, so I could not write meaningful failing-without-fix tests or preview text against develop. Unblocked by: #4309 merging. I will then resume and add the third donation choice (the .xx proxy address in tor_egress_sync_ips, tor_egress_choice_active, both marker loops), the preview row after XVB_TOR_ENABLED, tests in tests/stack/firewall and tests/stack/control, and docs/privacy.md with the per-container scope. Note for the owner: the issue says it is needed only if a clearnet donation route is allowed, and that ruling (onion only versus clearnet with a pinned TLS fingerprint) is not recorded on the issue. Default if no ruling comes: build it, since the issue's own acceptance criteria assume the clearnet choice exists and it ships dark.

    The runner resumes this issue when that one closes.

  6. added
    blocked
    and removed
    blocked
    on Nov 22, 2026
  7. pithead-developer commented on Nov 24, 2026

    @pithead-developer
    ContributorAuthor

    Merged in #4412.

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

    enhancementsecurity

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions