Skip to content

Security: p2pool-starter-stack/rigforge

SECURITY.md

Security Policy

RigForge compiles XMRig from upstream source and applies privileged system tuning. It runs as root, configures kernel HugePages and MSR access, and installs a systemd service. Given that footprint, we take security reports seriously and appreciate responsible disclosure.

What RigForge exposes (and what it doesn't)

No telemetry, ever. RigForge never phones home. There is no analytics, no version ping, and no usage beacon. (upgrade --check queries the GitHub releases API, but only when you run it — nothing is scheduled and nothing else calls it.) The only outbound connections it makes are to your pool, to the pinned XMRig source on GitHub (a shallow clone whose commit is verified against a hardcoded hash before it's built), to RigForge's own origin on GitHub (the git fetch of an opted-in remote upgrade, control_upgrade), and to your distro's package mirrors. Set tor_socks5 in config.json to send upgrade --check, the XMRig clone and the remote-upgrade fetch through one SOCKS5 proxy (such as a local Tor client) with remote name resolution and no direct fallback. Package-manager installs (apt, dnf, pacman, brew, and the jq bootstrap) are not covered: routing them is the operator's job, and without that they reveal the rig's address to the mirrors. The XMRig developer donation defaults to 0% and is opt-in through DONATION in config.json. Donations go to the XMRig project's address; RigForge substitutes no wallet of its own into the mining path. Existing builds rebuild once on upgrade to install a zero minimum; later donation reductions take effect with apply without rebuilding.

The worker stats API (:8080). Each worker runs XMRig's HTTP API so a Pithead dashboard can read per-rig stats over the LAN. Know exactly what it is:

  • Read-only. It's configured restricted: true, so the API can be read but never used to control the miner (no remote pause, config change, or shutdown).
  • Open by default. Reads need no token out of the box, matching Pithead's stock no-auth probe. Set ACCESS_TOKEN in config.json to require a Bearer token on every read instead.
  • LAN-bound by default. It binds 0.0.0.0:8080 because the Pithead dashboard polls each worker from the stack host. The data it can return is mining stats: hashrate, the configured pool URL, the worker label, and the CPU model.

The optional sister API (:8081, "api": "enabled" — off by default) follows the same posture: read-only by construction (GET only, fixed routes, nothing from a request is executed or logged). When ACCESS_TOKEN is set it accepts the exact bearer and a read-only HMAC-derived bearer; the writable :8082 endpoint rejects the derived value and still requires the exact token. It uses a single persistent python3-stdlib process that only ships pre-computed files (ProtectSystem=strict, NoNewPrivileges, lowest CPU priority — it can never compete with the miner, and a config it cannot parse is fatal at startup rather than silently dropping the token). The probe pass that produces those files runs from a separate idle-priority timer. It additionally serves RigForge's tune/health/power data — still stats, never a control surface.

The derived bearer is available only when ACCESS_TOKEN is at least 32 ASCII characters and must be generated randomly (openssl rand -hex 16). A deterministic derivation is an offline verifier, so a short or human-chosen token is unsafe for this split; it remains raw-client compatible but gets no derived bearer.

The optional writable control path (:8082, "control": "enabled" — off by default, #236) is the one endpoint that accepts writes, and it is fail-closed by construction. Enabling it requires both a Bearer ACCESS_TOKEN and an api_allow_from source pin, or setup refuses to start it — the stack host is the only trusted writer, so the miner never accepts a config from a miner-advertised or arbitrary host. The network receiver is unprivileged (DynamicUser) and only stages a change; a separate root oneshot re-validates it against RigForge's key allowlist (only operationally-mutable keys — never ACCESS_TOKEN, miner_user, HOME_DIR, or the API/control keys themselves), writes it durably, and rolls back anything that doesn't come back live. Config is written by jq (values quoted structurally) and the old config is snapshotted to config-backups/ first, so a bad or hostile change cannot inject a command, corrupt config.json, or lose the previous config. See ADR 0001.

The control token is write-capable and travels in cleartext (#256). The Authorization: Bearer header rides plain HTTP — the sister and control APIs are python3-stdlib HTTPServer with no TLS — and with the control path enabled that token now grants writes (redirect a rig's pools, change its thermal settings). api_allow_from scopes who may connect (source IP); it does not encrypt the token in flight, so a same-subnet passive sniffer or an ARP-spoof MITM that captures the header could replay it. The mining LAN is the trust boundary: isolate it from untrusted devices, treat ACCESS_TOKEN as a secret, and don't enable the control path on a shared or hostile network. TLS on the LAN API is intentionally not shipped — it adds cert-management burden for a LAN appliance whose threat model is already "trusted mining subnet," and LAN isolation is the supported posture; if your environment needs encryption, terminate TLS at a reverse proxy in front of :8082/:8081.

The control path is a tuning channel, not a safety-removal one (#257). A remote POST /apply that would strip a rig's thermal protection — disabling the watchdog, or unsetting / setting an out-of-band max_temp_c — is refused with 400; only a local rigforge.sh apply on the box (the operator is physically present) can remove thermal protection. Any change that touches watchdog/max_temp_c is flagged in :8082/status warnings[] so the dashboard can force an extra confirmation. So a fat-finger or a captured token cannot silently leave a rig without its thermal cutoff.

Not running Pithead? Nothing else needs the port; tune and doctor read the API over 127.0.0.1. So if you mine solo or to a public pool, you can firewall :8080 off entirely without losing anything:

sudo ufw deny 8080/tcp          # block it outright …
sudo ufw allow from <DASHBOARD_IP> to any port 8080 proto tcp   # … or scope it to one host

Supply chain & secret scanning

RigForge is built to be reproducible and tamper-evident:

  • Pinned, verified inputs. XMRig is cloned at a pinned commit and verified against a hardcoded hash before it builds; GitHub Actions are SHA-pinned; CI tool installs (shellcheck, shfmt, gitleaks) are version- and checksum-verified. Dependabot keeps the action pins current and flags advisories, and a daily workflow watches upstream XMRig releases — a new version arrives as a bot-opened, build-verified PR (never fetched-and-run; a human merges, the normal gates apply). When a release's notes mention CVEs or security fixes, the bump PR also carries the security label and the run opens a tracking issue. Unpinned distro packages (apt, dnf, pacman) take their advisories and fixes from the distro's own security updates.
  • Secret scanning. gitleaks scans the full git history on every push and PR, and runs as a pre-commit hook, so credentials can't slip into the repo. Historical fixture false positives use exact commit/file/rule/line fingerprints in .gitleaksignore; the donation fixture's empty ACCESS_TOKEN followed by RIGFORGE_APPLIANCE is one such match. These entries do not exclude future findings in the same file.
  • Workflow auditing. zizmor static-audits the CI workflows for template injection, over-broad token scopes, and credential persistence; jobs run with a least-privilege, read-only GITHUB_TOKEN by default.
  • Static analysis. CodeQL analyzes the Python servers (util/control-server.py, util/api-server.py) and the workflows (Analyze (python), Analyze (actions)) on pushes to main and develop, on pull requests and weekly. Shell has no CodeQL support, so rigforge.sh and the other Bash files stay ShellCheck-only. The repository ruleset's code_scanning rule is a GitHub setting an owner enables once both analyses have reported.

Bug reports: rigforge.sh support-bundle produces a redacted tarball (token and pool password structurally removed via jq, wallet masked). Redaction covers RigForge's own fields — review the extracted bundle before posting it anywhere public; a secret pasted into a custom field is yours to catch.

The sister API server itself runs unprivileged (DynamicUser=), reads the config through a systemd credential rather than owning the 0600 file, compares tokens in constant time, and caps request-arrival time so a held-open connection can't wedge it. doctor calls out the fully-open posture (no token, no api_allow_from) so it can't leave a trusted LAN unnoticed.

Release integrity

Releases ship a SHA256SUMS file generated by the release workflow. Verifying it proves the bundle you downloaded is byte-identical to what CI built from the tagged commit:

sha256sum -c SHA256SUMS --ignore-missing

What it does not prove is origin: checksums and bundles live in the same place, so an attacker who fully controls the GitHub account could regenerate both. Release signing (minisign) existed briefly for that gap and was removed by decision on 2026-07-11: its protection only materializes for users who pin the public key somewhere outside this repo, and the key-custody burden wasn't worth it for this project's users, who deploy from git tags. The trade changed on 2026-11-20 for one channel: an apt upgrade re-runs maintainer scripts as root with no human eyeballing a download, so the .deb feed is signed (below) and release bundles still ship checksums only. The old minisign machinery lives in the git history of .github/workflows/release.yml (#137, #205).

That no-signing posture governs the git route and the checksums-only release assets. It is qualified by ADR 0003: the apt feed added by the DIY install-routes epic (#778) is the one place this project does sign — every feed publish is signed with a dedicated OpenPGP key whose 40-hex fingerprint is pinned in this repo, because an apt feed is fetched automatically by every apt upgrade. Until that feed ships (the owner steps are recorded in the ADR), nothing is signed yet. Tarballs and SHA256SUMS stay checksums-only, and the remote-upgrade git path below stays unsigned by the same ADR.

The same trust boundary governs the remote-upgrade path (control-upgrade, #308 — opt-in, off by default, ADR 0002). There a rig fetches a release and runs it as root unattended — but not via the release bundles or SHA256SUMS at all: the fetch is a git checkout of the release tag over TLS to GitHub, gated on the tag's commit being reachable from origin/main and on GitHub's immutable releases locking the tag→commit binding. Checksums play no role on that path (ADR 0002 D5). It removes the human who would otherwise eyeball a bad release, so it inherits the origin gap above as a deliberately accepted risk: a full GitHub-account compromise could push malicious root code across a fleet. We accept that rather than plan around a compromise of GitHub itself — the proportionate mitigation is hardening the account (hardware-key 2FA, tight release and branch-protection permissions), not re-adding bundle signing.

For the strongest guarantee available today, deploy from a git checkout at the release tag — the commit hash is the integrity anchor, and the XMRig source it builds is itself pinned and commit-verified.

The apt feed is signed

The project's apt feed (install route in the README) is a flat repository whose every index ships a clear-signed InRelease and a detached Release.gpg, produced in the release pipeline by the Publish APT feed workflow and published only to Pages after the signing job's own gpg --verify check passes against the fingerprint pinned in this repo. apt refuses to install from an index that lacks a valid signature from the key in your keyring, so a tampered package or index cannot be installed without also stealing that key. The trust anchor is the pinned fingerprint — packaging/apt/fingerprint on main — which the README tells you to compare when you install the keyring; a signature you never pinned proves as much as the channel that handed you the key.

Key custody (owner ruling, 2026-11-20): the armored private key lives only as the APT_SIGNING_KEY repository secret scoped to the protected github-pages environment, whose required reviewer is the owner — the signing job waits for that approval, imports the key into a throwaway keyring, and deletes that keyring in a cleanup step that runs even when an earlier step fails (the hosted runner is ephemeral in any case). The key holds no other trust (it signs only the feed), and two passphrase-protected backups of it are stored offline by the owner, one on the owner's machine and one on the project NAS. Rotation: generate a new key, commit its fingerprint and public key under packaging/apt/ to main, move the secret and the APT_SIGNING_FINGERPRINT variable, keep the backup discipline of two passphrase-protected offline copies, and approve one signing run; users pick the new key up by re-running the README keyring step. Recovery after loss or exposure: publish a revocation note as a regular release, rotate as above with the new key, and have users re-pin the fingerprint — the apt trust boundary never silently follows a new key, and old feeds stay verifiable by users who still hold the old one.

Supported versions

Only the latest main is supported. Please reproduce against current main before reporting.

Version Supported
main (latest) ✅
older commits ❌

Reporting a vulnerability

Please do not open a public issue for security problems.

Instead, use GitHub's private vulnerability reporting on this repository:

  1. Go to the Security tab.
  2. Click Report a vulnerability (under Security Advisories).
  3. Describe the issue, the affected version/commit, and steps to reproduce.

We'll acknowledge your report, investigate, and keep you updated on a fix and disclosure timeline. Thanks for helping keep RigForge users safe.

There aren't any published security advisories