Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support cookie-based RPC authentication (Bitcoin Core) #10

Merged

Conversation

theStack
Copy link
Contributor

@theStack theStack commented Jan 16, 2021

This PR is a first step towards supporting cookie-based RPC authentication, as offered by Bitcoin Core since v0.12.

A constant RPC_CREDENTIALS is introduced that determines the RPC authentication method: if credentials are set (i.e. Some(user, pass)), user-pass-authentication is used, otherwise (i.e. None), authentication is cookie-based.

Note that by now the cookie-file is assumed to reside in ~/.bitcoin/regtest/.cookie and thus this authentication method will only work for Linux (also *BSD I guess?) and regtest network. Tested successfully with Debian 10 and Bitcoin Core 0.21.0.

If this PR gets accepted, there are a few possible follow-ups I could think of:

  • put RPC_CREDENTIALS (and probably other constants) in a separate source file to avoid conflicts during development if changes in main.rs are done and cookie-base auth is used (short-term)
  • support reading in a configuration file (long-term)
  • mention this authentication method in README.md
  • obviously: also make this work for other OSes and Bitcoin networks

A constant `RPC_CREDENTIALS` is introduced that determines the RPC
authentication method: if credentials are set (i.e. 'Some(user, pass)'),
user-pass-authentication is used, otherwise (i.e. 'None'),
authentication is cookie-based (available since Bitcoin Core v0.12).

Of course, in the future the constant will change to a variable that is
assigned by the return value of a function that reads a configuration
file.

Note that by now the cookie-file is assumed to reside in
~/.bitcoin/regtest/.cookie and thus this authentication method will only
work for Linux and regtest network by now.
@chris-belcher chris-belcher merged commit ebcba6c into bitcoin-teleport:master Jan 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants