You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge bitcoin/bitcoin#32423: rpc: Undeprecate rpcuser/rpcpassword, store all credentials hashed in memory
e49a727 rpc: Avoid join-split roundtrip for user:pass for auth credentials (Vasil Dimov)
98ff38a rpc: Perform HTTP user:pass split once in `RPCAuthorized` (laanwj)
879a17b rpc: Store all credentials hashed in memory (laanwj)
4ab9bed rpc: Undeprecate rpcuser/rpcpassword, change message to security warning (laanwj)
Pull request description:
This PR does two things:
### Undeprecate rpcuser/rpcpassword, change message to security warning
Back in 2015, in bitcoin/bitcoin#7044, we added configuration option `rpcauth` for multiple RPC users. At the same time the old settings for single-user configuration `rpcuser` and `rpcpassword` were "soon" to be deprecated.
The main reason for this deprecation is that while `rpcpassword` stores the password in plain text, `rpcauth` stores a hash, so it doesn't appear in the configuration in plain text.
As the options are still in active use, actually removing them is expected to be a hassle to many, and it's not clear that is worth it. As for the security risk, in many kinds of setups (no wallet, containerized, single-user-single-application, local-only, etc) it is an unlikely point of escalation.
In the end, it is good to encourage secure practices, but it is the responsibility of the user. Log a clear warning but remove the deprecation notice (this is also the only place where the options appear as deprecated, they were never marked as such in the -help output).
<hr>
### Store all credentials hashed in memory
This gets rid of the special-casing of `strRPCUserColonPass` by hashing cookies as well as manually provided `-rpcuser`/`-rpcpassword` with a random salt before storing them.
Also take the opportunity to modernize the surrounding code a bit. There should be no end-user visible differences in behavior.
<hr>
Closes #29240.
ACKs for top commit:
1440000bytes:
utACK bitcoin/bitcoin@e49a727
janb84:
reACK bitcoin/bitcoin@e49a727
vasild:
ACK e49a727
Tree-SHA512: 7162848ada4545bc07b5843d1ab6fb7e31fb26de8d6385464b7c166491cd122eac2ec5e70887c414fc136600482df8277dc0cc0541d7b7cf62c4f72e25bb6145
LogInfo("RPC authentication cookie file generation is disabled.");
313
-
} else {
302
+
break;
303
+
case GenerateAuthCookieResult::OK:
314
304
LogInfo("Using random cookie authentication.");
305
+
break;
315
306
}
316
307
} else {
317
-
LogPrintf("Config options rpcuser and rpcpassword will soon be deprecated. Locally-run instances may remove rpcuser to use cookie-based auth, or may be replaced with rpcauth. Please see share/rpcauth for rpcauth auth generation.\n");
LogWarning("The use of rpcuser/rpcpassword is less secure, because credentials are configured in plain text. It is recommended that locally-run instances switch to cookie-based auth, or otherwise to use hashed rpcauth credentials. See share/rpcauth in the source directory for more information.");
310
+
user = gArgs.GetArg("-rpcuser", "");
311
+
pass = gArgs.GetArg("-rpcpassword", "");
312
+
}
313
+
314
+
// If there is a plaintext credential, hash it with a random salt before storage.
0 commit comments