Skip to content

Nix Dark Forest: make bitcoinix nodes harder to fingerprint - #229

Merged
seberm merged 5 commits into
bitcoinix:masterfrom
ostermayer:nix-dark-forest
Nov 8, 2026
Merged

seberm merged 5 commits into
bitcoinix:masterfrom
ostermayer:nix-dark-forest

Conversation

@ostermayer

Copy link
Copy Markdown
Collaborator

The idea is the "dark forest": a node is safer when an outside observer can't tell what it runs or link its onion side to its clearnet side. I probed a stock secure-node build from a second VM on my KVM host: every open port, banner, certificate and error page, over clearnet and at the onion ports. Clearnet shows almost nothing, which is good. The fingerprints are in the web apps behind the onions. These are small fixes for the ones bitcoinix controls.

  • mempool: NODE_ENV=production. A malformed API request returned an Express stack trace with /nix/store/<hash>-mempool-backend-3.3.2 paths. Now it returns the plain error page. Stock mempool doesn't set NODE_ENV either, so this mostly removes the store path.
  • mempool frontend: no ETag or Last-Modified. nixpkgs' nginx derives the ETag from the store hash, so anyone can compute which bitcoinix commit a node runs. The store's 1970 timestamp gave it away too. staticContent now sets etag off, an empty Last-Modified and if_modified_since off. Hashed assets keep their one-year cache. index.html and /resources are fetched again in full after expiry instead of getting a 304.
  • mempool backend-info: no hostname or kernel version. The endpoint and the WebSocket init data returned hostname and osVersion (Linux 6.18.60) to anyone who reached the onion. A small patch blanks both. Replication still skips the local server, through os.hostname() directly.
  • Self-signed certs: CN=localhost without the service name. O=lnd marked the nix-bitcoin family. The SAN is unchanged. Only new certs get the new subject. Existing certs stay as they are, because generating new ones would break pinned clients such as lndconnect URLs and Zeus.
  • Docs: the SSH onion and clearnet SSH are one sshd with the same host keys, so publishing both links them. The docs suggest keeping SSH off clearnet, or Tor client authorization for the onion.

Known leftovers:

  • An If-Unmodified-Since request can still tell the 1970 store timestamp apart, because nginx checks it before any config line runs. It only reveals "built with Nix".
  • mempool's gitCommit reads "?".
  • RTL serves its non-secret config to the login page without auth, which is upstream design.

Tested

On my KVM host, each new check failed on master for the reason above and passes with the fix, in default, netns, netnsRegtest, hardened and regtest. module-config, test-runner and the mdbook build pass too.

Opus 5.5 wrote this. Codex GPT-6 Astra and GPT-5.6 Sol found that blanking the hostname broke replication's self-skip and that the 1970 date still got a 304. Both are fixed. Claude Fable 5.1 and Astra then found nothing more apart from the leftover above.

Kimi K3.1 Pro and DeepSeek V4.1 Flash ran over 5149497, and Astra checked their report. Nothing came up in the files this PR touches.

@github-actions github-actions Bot added area: ci .github/, test/, dev/ area: docs docs/, README, examples/, SECURITY.md, book.toml, assets area: modules modules/ and pkgs/lib.nix area: packages pkgs/ and flake pins labels Nov 7, 2026

@seberm seberm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ostermayer Thanks!


no must-fix or should-fix items.

Nit (optional): in the SSH onion docs, say to switch the deploy target to the onion alias (step 4) and check it works before setting services.openssh.openFirewall = false, otherwise the next deploy over the IP address fails.

Tested: CI green on 5149497; default, netns and netnsRegtest ran the new mempool and lnd checks. Not re-run locally. I checked that makeCert only regenerates on a missing cert or changed alt-names, so existing pinned certs are kept.

Assisted-by: Claude Code (Claude Opus 5.5)

Without NODE_ENV, Express runs in development mode, so a malformed
request gets an error page with the full stack trace. The trace holds
the /nix/store path of the backend, which identifies the exact build.

Assisted-by: Claude Code (Claude Opus 5.5)
nginx on NixOS derives the ETag of a static file from its store path,
and Last-Modified shows the store's 1970 timestamp. Together they reveal
NixOS and the exact frontend build. Turn both off, and ignore
If-Modified-Since, which still answers a probe for the 1970 timestamp
with 304. Caching still works through the expires headers.

Assisted-by: Claude Code (Claude Opus 5.5)
The backend sends the system hostname and kernel release to every
client, in /api/v1/backend-info and in the WebSocket init data. The
hostname can link an onion to its operator, and the kernel release
dates the node's nixpkgs. Patch both fields to empty strings, and let
replication skip the local server by the real hostname as before.

Assisted-by: Claude Code (Claude Opus 5.5)
The lnd cert had the subject "CN=localhost, O=lnd", which marks a node
as nix-bitcoin or bitcoinix to anyone who reaches lnd's REST or gRPC
port. Use "CN=localhost" only. Existing certs stay as they are until
they are generated again.

Assisted-by: Claude Code (Claude Opus 5.5)
Anyone who learns the SSH onion address can look up its host key in
internet scan databases and find the node's IP address. Suggest keeping
SSH off the internet or using Tor client authorization for the onion.

Assisted-by: Claude Code (Claude Opus 5.5)
@seberm
seberm enabled auto-merge November 8, 2026 09:24
@seberm
seberm merged commit b4b8ec9 into bitcoinix:master Nov 8, 2026
18 checks passed
@seberm seberm added this to the v0.1.5 milestone Nov 8, 2026
@ostermayer
ostermayer deleted the nix-dark-forest branch November 8, 2026 22:18
@seberm seberm added the type: security Hardening or vulnerability (public-safe only) label Nov 9, 2026
unbeholdendev added a commit to unbeholdendev/infra that referenced this pull request Nov 10, 2026
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [bitcoinix/bitcoinix](https://github.com/bitcoinix/bitcoinix) | patch | `v0.1.4` → `v0.1.5` |

---

### Release Notes

<details>
<summary>bitcoinix/bitcoinix</summary>

### [`v0.1.5`](https://github.com/bitcoinix/bitcoinix/releases/tag/v0.1.5): bitcoinix 0.1.5

[Compare Source](bitcoinix/bitcoinix@v0.1.4...v0.1.5)

**Security release with breaking changes.** Updates BTCPay Server to 2.4.7 and Core Lightning to 26.06.10. All users should upgrade. If you run BTCPay Server with `services.backups`, start a backup right after upgrading. Evaluation fails with a message for each breaking change that affects your config; act on it, then set `nix-bitcoin.configVersion = "0.1.5";`.

#### Security

- **BTCPay Server [2.4.7](https://github.com/btcpayserver/btcpayserver/releases/tag/v2.4.7)** fixes 85 security findings (1 critical, 13 high). Upstream highly recommends it, especially for servers shared by multiple merchants. It was left out of 0.1.4 ([#&#8203;203](bitcoinix/bitcoinix#203)).
- **Core Lightning [26.06.10](https://github.com/ElementsProject/lightning/releases/tag/v26.06.10)** fixes vulnerabilities in dual funding, splicing, onchaind, gossip, connectd, runes and commando, among others. Upstream recommends reviewing your runes: bind runes used over commando to the app's node ID and blacklist any you can't account for ([#&#8203;226](bitcoinix/bitcoinix#226)).
- **Backups now include the NBXplorer database,** which holds the BTCPay hot-wallet keys. Backups made before this release lack them, so run `systemctl start duplicity` after upgrading, or make sure you have each hot wallet's recovery phrase ([#&#8203;223](bitcoinix/bitcoinix#223)).
- **Not included: database dump checks ([#&#8203;225](bitcoinix/bitcoinix#225 duplicity still succeeds when a database dump fails, and with `services.postgresqlBackup.compression` set to `"zstd"` or `"none"`, backups leave out the BTCPay and NBXplorer databases. Until the next release, keep the default `"gzip"` and check `journalctl -u postgresqlBackup-btcpaydb -u postgresqlBackup-nbxplorer` after a backup.
- **The mempool RPC password no longer ends up in the Nix store** when set through `services.mempool.settings.CORE_RPC.PASSWORD` ([#&#8203;216](bitcoinix/bitcoinix#216)).
- **Multipath TCP:** lnd now also runs with `GODEBUG=multipathtcp=0`, and `hardened-extended` sets `net.mptcp.enabled = 0` ([#&#8203;187](bitcoinix/bitcoinix#187)). That sysctl, like the one the 0.1.4 notes advised, covers only the host namespace: services that netns-isolation runs in their own namespace can still open MPTCP listeners (fix not included, [#&#8203;206](bitcoinix/bitcoinix#206)). The fix for CVE-2026-98432 is kernel 6.18.56 or later; check with `uname -r`.
- **Harder to fingerprint:** mempool no longer shows stack traces with store paths, store-derived ETags, the hostname or the kernel version, and new self-signed certs only carry `CN=localhost`. The SSH onion shares its host keys with clearnet SSH, so publishing both links them: keep SSH off clearnet or use Tor client authorization for the onion ([#&#8203;229](bitcoinix/bitcoinix#229)).
- `clightning-replication` warns when SSH host key checking is disabled ([#&#8203;222](bitcoinix/bitcoinix#222)).
- Core Lightning, clboss and Fulcrum still link brotli 1.2.0 from nixpkgs-unstable.

#### Breaking changes

- **mempool:** `services.mempool.settings.CORE_RPC.PASSWORD` now fails evaluation. Put the password in `<secretsDir>/bitcoin-rpcpassword-public`, and change it if untrusted users or services run on the node, since the old value stays in the store until garbage collection ([#&#8203;216](bitcoinix/bitcoinix#216)).
- **currencyrate:** the Python plugin is replaced by Core Lightning's Rust `cln-currencyrate`. Use `listcurrencyrates` instead of `currencyrates`; `add-source`/`disable-source` are now `currencyrate-add-source`/`currencyrate-disable-source` ([#&#8203;202](bitcoinix/bitcoinix#202)).
- **rebalance:** now routes with askrene. Drop `getroute_method` from `rebalance` calls and `rebalance-getroute`, `rebalance-maxhops`, `rebalance-msatfactor` from your config; `rebalancereport` loses the matching fields ([#&#8203;202](bitcoinix/bitcoinix#202), [#&#8203;207](bitcoinix/bitcoinix#207)).
- **clnrest:** the package moved from `nix-bitcoin.pkgs.clnrest` to `nix-bitcoin.pkgs.clightning-plugins.clnrest` ([#&#8203;202](bitcoinix/bitcoinix#202)).
- **Core Lightning 26.06.10, for scripts:** `bkpr-dumpincomecsv` only accepts a plain `.csv` filename and writes it to the network directory. Opens from peers with `dust_limit_satoshis` above 5000 sat are refused. See the [operator notes](https://github.com/ElementsProject/lightning/releases/tag/v26.06.10).
- **BTCPay Server 2.4.7, for integrators:** the legacy `/invoices/create` routes are removed (use `/stores/{storeId}/invoices/create`), and reading single invoices through the BitPay API requires authentication.

See [Upgrading to config version 0.1.5](https://docs.bitcoinix.net/upgrading.html#upgrading-to-config-version-015).

#### Updates

| Package             | 0.1.4                                                                       | 0.1.5                                                                                                             |
| ------------------- | --------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| BTCPay Server       | 2.4.6                                                                       | [2.4.7](https://github.com/btcpayserver/btcpayserver/releases/tag/v2.4.7)                                         |
| Core Lightning      | 26.06.9                                                                     | [26.06.10](https://github.com/ElementsProject/lightning/releases/tag/v26.06.10)                                   |
| currencyrate plugin | Python ([`c0ba9dc`](bitcoinix/bitcoinix@c0ba9dc)) | [cln-currencyrate 0.1.0](https://github.com/ElementsProject/lightning/tree/v26.06.10/plugins/currencyrate-plugin) |
| lightningd/plugins  | [`c0ba9dc`](bitcoinix/bitcoinix@c0ba9dc)          | [f0d33fd](https://github.com/lightningd/plugins/tree/f0d33fd)                                                     |

Also: the docs list the release and package versions ([#&#8203;205](bitcoinix/bitcoinix#205)); the services page is reworked ([#&#8203;201](bitcoinix/bitcoinix#201)).

Contributors: [@&#8203;ostermayer](https://github.com/ostermayer), [@&#8203;prusnak](https://github.com/prusnak), [@&#8203;seberm](https://github.com/seberm), [@&#8203;viberaven](https://github.com/viberaven).

Full changes: <bitcoinix/bitcoinix@v0.1.4...v0.1.5>

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4yMjIuMCIsInVwZGF0ZWRJblZlciI6IjQ0LjIyMi4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Co-authored-by: agent <[email protected]>
Reviewed-on: https://git.home.unbeholden.dev/unbeholden/infra/pulls/97
seberm added a commit that referenced this pull request Nov 12, 2026
The SSH onion docs told users to set
services.openssh.openFirewall = false to keep the onion address and the
node's IP address apart. Doing that while deploys still go to the IP
address makes the next deploy fail.

The section now lists the steps: move the deployment (and --build-host,
if it points to the node) to the onion alias first and check that a
deploy works, close the SSH port everywhere public but keep it open on a
VPN interface if needed, and keep a root session over the IP address
open until a new root login through the onion service works.

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

Labels

area: ci .github/, test/, dev/ area: docs docs/, README, examples/, SECURITY.md, book.toml, assets area: modules modules/ and pkgs/lib.nix area: packages pkgs/ and flake pins type: security Hardening or vulnerability (public-safe only)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants