Skip to content

bitcoind: warn that a custom RPC user's passwordHMAC lands in the Nix store - #266

Merged
prusnak merged 1 commit into
bitcoinix:masterfrom
ostermayer:bitcoind-rpcauth-hmac-store-warning
Nov 18, 2026
Merged

prusnak merged 1 commit into
bitcoinix:masterfrom
ostermayer:bitcoind-rpcauth-hmac-store-warning

Conversation

@ostermayer

@ostermayer ostermayer commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #64.

bitcoin.conf is built with builtins.toFile. So the rpcauth=<name>:<salt>$<hmac> line of every custom RPC user in services.bitcoind.rpc.users ends up in the world-readable Nix store. Any local user can read the salt and HMAC and test password guesses offline. A long random password is safe. A weak one isn't. The passwordHMAC description didn't say so, and the docs didn't cover custom RPC users at all.

This PR documents the risk. It doesn't change behavior.

  • The passwordHMAC description now says that the value goes to the Nix store, and advises a long random password, like the one that Bitcoin Core's share/rpcauth/rpcauth.py generates when you don't pass a password.
  • The LAN RPC section of docs/configuration.md gets a short custom RPC user example with the same warning. It also covers rpcauth lines in extraConfig, which land in the store too. And it says to change a weak password, because the old HMAC stays in the store until it is garbage-collected.
  • A 0.2.0 release note points existing users to that section.

The built-in users privileged, public and btcpayserver read their HMAC from the secrets dir, so they aren't affected.

Keeping a custom user's HMAC out of the store is possible, with a public passwordHMACFromFile that declares a bitcoin-HMAC-<name> secret. But that's a new feature: secret generation doesn't create the file, and the docs need steps to provide it. I left it for a follow-up.

Testing

  • nix eval .#ciTestInfo: pass
  • nix build .#checks.x86_64-linux.module-config: pass
  • nix build .#checks.x86_64-linux.test-runner: pass
  • mdbook build: pass. The new text renders, and the release note link resolves to the allow-bitcoind-rpc-connections-from-lan heading.
  • The evaluated passwordHMAC description shows the new text.

No VM test, because nothing changes at runtime.

  • After the rebase onto master 0d12e6c, module-config, test-runner, ci-workflows and the mdBook build pass on the KVM host.

Models

Claude Opus 5.5 wrote the change. Codex GPT-5.6 Sol, Codex GPT-6 Astra (two passes), Kimi K3.1 Pro (two passes), DeepSeek V4.1 Flash 1017 and GLM 5.3 reviewed it. Claude Opus 5.5 rebased it onto #224.

@github-actions github-actions Bot added area: docs docs/, README, examples/, SECURITY.md, book.toml, assets area: modules modules/ and pkgs/lib.nix labels Nov 15, 2026

@viberaven viberaven 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.

Reviewed dcb634b393d1.

No actionable findings. The new warning matches the implementation: custom passwordHMAC values are interpolated into the store-backed configuration, while the built-in users load their HMACs from secret files at runtime. The example correctly limits RPC methods and warns about offline guessing and old store generations. Documentation-only behavior; the mdBook build passes.

Review performed with Codex (GPT-6 Astra).

@github-actions github-actions Bot added the status: rebase needed Merge conflicts need to be resolved label Nov 16, 2026
@seberm

seberm commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

LGTM, no must- or should-fix items. Checked against modules/bitcoind.nix: custom users' rpcauth lines (and extraConfig) go into the builtins.toFile config, the built-in users read their HMAC from the secrets dir at startup, and the "all methods without rpcwhitelist" note holds because the module sets rpcwhitelistdefault=0. Leaving passwordHMACFromFile for a follow-up makes sense.

Needs a rebase: docs/release-notes.md conflicts. The next release is v0.2.0, so the ## 0.1.7 entry moves into the existing ## 0.2.0 section. Nothing else changes.

Assisted-by: Claude Code (Claude Opus 5.5)

@seberm seberm added this to the v0.2.0 milestone Nov 17, 2026
@ostermayer
ostermayer force-pushed the bitcoind-rpcauth-hmac-store-warning branch from dcb634b to 85e625d Compare November 18, 2026 00:19
@github-actions github-actions Bot removed the status: rebase needed Merge conflicts need to be resolved label Nov 18, 2026
@prusnak
prusnak enabled auto-merge November 18, 2026 09:15
… store

bitcoin.conf is built with builtins.toFile, so the rpcauth line of every
custom RPC user ends up in the world-readable Nix store. Any local user can
read the salt and HMAC and test password guesses offline. The option
description didn't say so, and the docs didn't cover custom RPC users.

Say it in the passwordHMAC description, and add a short custom RPC user
example to the LAN RPC section of docs/configuration.md. Both advise a long
random password, like the one rpcauth.py generates. The docs also cover
rpcauth lines in extraConfig, which land in the store too, and say to change
a weak password, because the old HMAC stays in the store until it is
garbage-collected. A release note points existing users to that section.

Fixes bitcoinix#64.

Assisted-by: Claude Code (Claude Opus 5.5)
@prusnak
prusnak force-pushed the bitcoind-rpcauth-hmac-store-warning branch from 85e625d to 4eedfd8 Compare November 18, 2026 10:09
@prusnak
prusnak merged commit 30c3cc1 into bitcoinix:master Nov 18, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: docs docs/, README, examples/, SECURITY.md, book.toml, assets area: modules modules/ and pkgs/lib.nix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bitcoind: custom RPC users' passwordHMAC is written to the world-readable Nix store

4 participants