Repository navigation
config: support reading bitcoin rpc password from a file - #253
Merged
Merged
Conversation
Add a --bitcoin.passwordfile flag as an alternative to --bitcoin.password, so operators can avoid putting the bitcoind/btcd RPC password in plaintext on the command line or in shell history. Fixes lightninglabs#252.
An empty or whitespace-only password file previously fell through to the generic 'rpc user and password required' error, which is misleading when the operator did pass --bitcoin.passwordfile. Fail with a message pointing at the file instead. Also document that surrounding whitespace and the trailing newline are stripped from the file's contents.
|
@Roasbeef I wished I'd get that for LND too. Because LND didn't handle change of cookie value at run time, I needed to configure a fixed password. I will handle that in our |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
--bitcoin.passwordfileconfig option as an alternative to--bitcoin.password, so operators can point faraday at a filecontaining the bitcoind/btcd RPC password instead of putting it in
plaintext on the command line or in a docker-compose manifest.
chain.BitcoinConfiggains aPasswordFilefield(
--bitcoin.passwordfile).ValidateConfigresolves the password from the file when--bitcoin.passwordfileis set, trimming surrounding whitespace andthe trailing newline, and rejects the config if both
--bitcoin.passwordand--bitcoin.passwordfileare set, if thefile can't be read, or if it's empty.
Closes #252.
Test plan
go build ./...go vet ./...go test -race .(newTestValidateConfigBitcoinPasswordcoversthe plaintext flag, the file flag, a missing file, an empty
file, and the mutually-exclusive-flags case)
go test ./...(itest failures are pre-existing/unrelated —that suite requires a live bitcoind/lnd docker environment)