Skip to content

Commit dcf0cb4

Browse files
committed
tor: make a TORv3 hidden service instead of TORv2
TORv2 is deprecated [1], thus whenever we create the hidden service ourselves create a TORv3 one instead. [1] https://blog.torproject.org/v2-deprecation-timeline
1 parent 353a3fd commit dcf0cb4

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

doc/files.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Subdirectory | File(s) | Description
5656
`./` | `fee_estimates.dat` | Stores statistics used to estimate minimum transaction fees and priorities required for confirmation
5757
`./` | `guisettings.ini.bak` | Backup of former [GUI settings](#gui-settings) after `-resetguisettings` option is used
5858
`./` | `mempool.dat` | Dump of the mempool's transactions
59-
`./` | `onion_private_key` | Cached Tor onion service private key for `-listenonion` option
59+
`./` | `onion_v3_private_key` | Cached Tor onion service private key for `-listenonion` option
6060
`./` | `peers.dat` | Peer IP address database (custom format)
6161
`./` | `settings.json` | Read-write settings set through GUI or RPC interfaces, augmenting manual settings from [bitcoin.conf](bitcoin-conf.md). File is created automatically if read-write settings storage is not disabled with `-nosettings` option. Path can be specified with `-settings` option
6262
`./` | `.cookie` | Session RPC authentication cookie; if used, created at start and deleted on shutdown; can be specified by `-rpccookiefile` option
@@ -98,6 +98,7 @@ Path | Description | Repository notes
9898
`blkindex.dat` | Blockchain index BDB database; replaced by {`chainstate/`, `blocks/index/`, `blocks/revNNNNN.dat`<sup>[\[2\]](#note2)</sup>} in 0.8.0 | [PR #1677](https://github.com/bitcoin/bitcoin/pull/1677)
9999
`blk000?.dat` | Block data (custom format, 2 GiB per file); replaced by `blocks/blkNNNNN.dat`<sup>[\[2\]](#note2)</sup> in 0.8.0 | [PR #1677](https://github.com/bitcoin/bitcoin/pull/1677)
100100
`addr.dat` | Peer IP address BDB database; replaced by `peers.dat` in [0.7.0](https://github.com/bitcoin/bitcoin/blob/master/doc/release-notes/release-notes-0.7.0.md) | [PR #1198](https://github.com/bitcoin/bitcoin/pull/1198), [`928d3a01`](https://github.com/bitcoin/bitcoin/commit/928d3a011cc66c7f907c4d053f674ea77dc611cc)
101+
`onion_private_key` | Cached Tor onion service private key for `-listenonion` option. Was used for Tor v2 services; replaced by `onion_v3_private_key` in [0.21.0](https://github.com/bitcoin/bitcoin/blob/master/doc/release-notes/release-notes-0.21.0.md) | [PR #19954](https://github.com/bitcoin/bitcoin/pull/19954)
101102

102103
## Notes
103104

doc/release-notes.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,17 @@ P2P and network changes
8282
node using P2P relay. This version reduces the initial broadcast guarantees
8383
for wallet transactions submitted via P2P to a node running the wallet. (#18038)
8484

85+
- The Tor onion service that is automatically created by setting the
86+
`-listenonion` configuration parameter will now be created as a Tor v3 service
87+
instead of Tor v2. The private key that was used for Tor v2 (if any) will be
88+
left untouched in the `onion_private_key` file in the data directory (see
89+
`-datadir`) and can be removed if not needed. Bitcoin Core will no longer
90+
attempt to read it. The private key for the Tor v3 service will be saved in a
91+
file named `onion_v3_private_key`. To use the deprecated Tor v2 service (not
92+
recommended), then `onion_private_key` can be copied over
93+
`onion_v3_private_key`, e.g.
94+
`cp -f onion_private_key onion_v3_private_key`. (#19954)
95+
8596
Updated RPCs
8697
------------
8798

src/torcontrol.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -532,8 +532,9 @@ void TorController::auth_cb(TorControlConnection& _conn, const TorControlReply&
532532
}
533533

534534
// Finally - now create the service
535-
if (private_key.empty()) // No private key, generate one
536-
private_key = "NEW:RSA1024"; // Explicitly request RSA1024 - see issue #9214
535+
if (private_key.empty()) { // No private key, generate one
536+
private_key = "NEW:ED25519-V3"; // Explicitly request key type - see issue #9214
537+
}
537538
// Request onion service, redirect port.
538539
// Note that the 'virtual' port is always the default port to avoid decloaking nodes using other ports.
539540
_conn.Command(strprintf("ADD_ONION %s Port=%i,127.0.0.1:%i", private_key, Params().GetDefaultPort(), GetListenPort()),
@@ -718,7 +719,7 @@ void TorController::Reconnect()
718719

719720
fs::path TorController::GetPrivateKeyFile()
720721
{
721-
return GetDataDir() / "onion_private_key";
722+
return GetDataDir() / "onion_v3_private_key";
722723
}
723724

724725
void TorController::reconnect_cb(evutil_socket_t fd, short what, void *arg)

0 commit comments

Comments
 (0)