mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
Merge #15651: torcontrol: Use the default/standard network port for Tor hidden services, even if the internal port is set differently
8a2656702b4b5d53d1b8343c3215302e4305a038 torcontrol: Use the default/standard network port for Tor hidden services, even if the internal port is set differently (Luke Dashjr) Pull request description: Currently, the hidden service is published on the same port as the public listening port. But if a non-standard port is configured, this can be used to guess (pretty reliably) that the public IP and the hidden service are the same node. ACKs for top commit: practicalswift: utACK 8a2656702b4b5d53d1b8343c3215302e4305a038 naumenkogs: utACK 8a26567 laanwj: utACK 8a2656702b4b5d53d1b8343c3215302e4305a038 Tree-SHA512: 737c8da4f7c3f0bb22a338647d357987f5808156e3f38864168d0d8c2e2b171160812f7da4de11eef602902b304e357d76052950b72d7b3b83535b0fdd05fadc
This commit is contained in:
parent
2a425933d7
commit
7f012a777b
@ -3,6 +3,7 @@
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <chainparams.h>
|
||||
#include <torcontrol.h>
|
||||
#include <utilstrencodings.h>
|
||||
#include <netbase.h>
|
||||
@ -502,7 +503,7 @@ void TorController::add_onion_cb(TorControlConnection& _conn, const TorControlRe
|
||||
}
|
||||
return;
|
||||
}
|
||||
service = LookupNumeric(std::string(service_id+".onion").c_str(), GetListenPort());
|
||||
service = LookupNumeric(std::string(service_id+".onion").c_str(), Params().GetDefaultPort());
|
||||
LogPrintf("tor: Got service ID %s, advertising service %s\n", service_id, service.ToString());
|
||||
if (WriteBinaryFile(GetPrivateKeyFile(), private_key)) {
|
||||
LogPrint(BCLog::TOR, "tor: Cached service private key to %s\n", GetPrivateKeyFile().string());
|
||||
@ -537,9 +538,8 @@ void TorController::auth_cb(TorControlConnection& _conn, const TorControlReply&
|
||||
private_key = "NEW:ED25519-V3"; // Explicitly request key type - see issue #9214
|
||||
}
|
||||
// Request hidden service, redirect port.
|
||||
// Note that the 'virtual' port doesn't have to be the same as our internal port, but this is just a convenient
|
||||
// choice. TODO; refactor the shutdown sequence some day.
|
||||
_conn.Command(strprintf("ADD_ONION %s Port=%i,127.0.0.1:%i", private_key, GetListenPort(), GetListenPort()),
|
||||
// Note that the 'virtual' port is always the default port to avoid decloaking nodes using other ports.
|
||||
_conn.Command(strprintf("ADD_ONION %s Port=%i,127.0.0.1:%i", private_key, Params().GetDefaultPort(), GetListenPort()),
|
||||
boost::bind(&TorController::add_onion_cb, this, _1, _2));
|
||||
} else {
|
||||
LogPrintf("tor: Authentication failed\n");
|
||||
|
Loading…
Reference in New Issue
Block a user