mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 10:38:42 +01:00
net: Always default rpcbind to localhost, never "all interfaces"
We don't support binding to untrusted networks, so avoid a default where that is typical
This commit is contained in:
parent
d7b0258ff0
commit
3615003952
@ -300,9 +300,12 @@ static bool HTTPBindAddresses(struct evhttp* http)
|
||||
std::vector<std::pair<std::string, uint16_t> > endpoints;
|
||||
|
||||
// Determine what addresses to bind to
|
||||
if (!gArgs.IsArgSet("-rpcallowip")) { // Default to loopback if not allowing external IPs
|
||||
if (!(gArgs.IsArgSet("-rpcallowip") && gArgs.IsArgSet("-rpcbind"))) { // Default to loopback if not allowing external IPs
|
||||
endpoints.push_back(std::make_pair("::1", http_port));
|
||||
endpoints.push_back(std::make_pair("127.0.0.1", http_port));
|
||||
if (gArgs.IsArgSet("-rpcallowip")) {
|
||||
LogPrintf("WARNING: option -rpcallowip was specified without -rpcbind; this doesn't usually make sense\n");
|
||||
}
|
||||
if (gArgs.IsArgSet("-rpcbind")) {
|
||||
LogPrintf("WARNING: option -rpcbind was ignored because -rpcallowip was not specified, refusing to allow everyone to connect\n");
|
||||
}
|
||||
@ -313,9 +316,6 @@ static bool HTTPBindAddresses(struct evhttp* http)
|
||||
SplitHostPort(strRPCBind, port, host);
|
||||
endpoints.push_back(std::make_pair(host, port));
|
||||
}
|
||||
} else { // No specific bind address specified, bind to any
|
||||
endpoints.push_back(std::make_pair("::", http_port));
|
||||
endpoints.push_back(std::make_pair("0.0.0.0", http_port));
|
||||
}
|
||||
|
||||
// Bind addresses
|
||||
|
@ -500,7 +500,7 @@ void SetupServerArgs()
|
||||
gArgs.AddArg("-rest", strprintf("Accept public REST requests (default: %u)", DEFAULT_REST_ENABLE), false, OptionsCategory::RPC);
|
||||
gArgs.AddArg("-rpcallowip=<ip>", "Allow JSON-RPC connections from specified source. Valid for <ip> are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times", false, OptionsCategory::RPC);
|
||||
gArgs.AddArg("-rpcauth=<userpw>", "Username and hashed password for JSON-RPC connections. The field <userpw> comes in the format: <USERNAME>:<SALT>$<HASH>. A canonical python script is included in share/rpcauth. The client then connects normally using the rpcuser=<USERNAME>/rpcpassword=<PASSWORD> pair of arguments. This option can be specified multiple times", false, OptionsCategory::RPC);
|
||||
gArgs.AddArg("-rpcbind=<addr>[:port]", "Bind to given address to listen for JSON-RPC connections. This option is ignored unless -rpcallowip is also passed. Port is optional and overrides -rpcport. Use [host]:port notation for IPv6. This option can be specified multiple times (default: 127.0.0.1 and ::1 i.e., localhost, or if -rpcallowip has been specified, 0.0.0.0 and :: i.e., all addresses)", false, OptionsCategory::RPC);
|
||||
gArgs.AddArg("-rpcbind=<addr>[:port]", "Bind to given address to listen for JSON-RPC connections. This option is ignored unless -rpcallowip is also passed. Port is optional and overrides -rpcport. Use [host]:port notation for IPv6. This option can be specified multiple times (default: 127.0.0.1 and ::1 i.e., localhost)", false, OptionsCategory::RPC);
|
||||
gArgs.AddArg("-rpccookiefile=<loc>", "Location of the auth cookie. Relative paths will be prefixed by a net-specific datadir location. (default: data dir)", false, OptionsCategory::RPC);
|
||||
gArgs.AddArg("-rpcpassword=<pw>", "Password for JSON-RPC connections", false, OptionsCategory::RPC);
|
||||
gArgs.AddArg("-rpcport=<port>", strprintf("Listen for JSON-RPC connections on <port> (default: %u, testnet: %u, regtest: %u)", defaultBaseParams->RPCPort(), testnetBaseParams->RPCPort(), regtestBaseParams->RPCPort()), false, OptionsCategory::RPC);
|
||||
|
Loading…
Reference in New Issue
Block a user