Skip to content

Commit c5f6822

Browse files
committed
Update tor.md
Updated to consider more recent versions and features of the tor router (automatic hidden service creation/deletion).
1 parent b7d0ec7 commit c5f6822

File tree

1 file changed

+105
-99
lines changed

1 file changed

+105
-99
lines changed

doc/tor.md

Lines changed: 105 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1,126 +1,132 @@
1-
TOR SUPPORT IN PIVX
2-
=======================
1+
# TOR SUPPORT IN PIVX
32

4-
It is possible to run PIVX as a Tor hidden service, and connect to such services.
3+
It is possible to run PIVX Core as a Tor hidden service, and connect to such services.
54

6-
The following directions assume you have a Tor proxy running on port 9050. Many
7-
distributions default to having a SOCKS proxy listening on port 9050, but others
8-
may not. In particular, the Tor Browser Bundle defaults to listening on a random
9-
port. See [Tor Project FAQ:TBBSocksPort](https://www.torproject.org/docs/faq.html.en#TBBSocksPort)
10-
for how to properly configure Tor.
5+
The following directions assume you have a Tor proxy running on port 9050. Many distributions default to having a SOCKS proxy listening on port 9050, but others may not. In particular, the Tor Browser Bundle defaults to listening on port 9150. See [Tor Project FAQ:TBBSocksPort](https://www.torproject.org/docs/faq.html.en#TBBSocksPort) for how to properly
6+
configure Tor.
117

128

13-
Run PIVX behind a Tor proxy
9+
## 1. Run PIVX Core behind a Tor proxy
1410
----------------------------------
1511

16-
The first step is running PIVX behind a Tor proxy. This will already make all
17-
outgoing connections be anonymized, but more is possible.
18-
```
19-
-proxy=ip:port Set the proxy server. If SOCKS5 is selected (default), this proxy
20-
server will be used to try to reach .onion addresses as well.
12+
The first step is running PIVX behind a Tor proxy. This will already anonymize all
13+
outgoing connections, but more is possible.
2114

22-
-onion=ip:port Set the proxy server to use for tor hidden services. You do not
23-
need to set this if it's the same as -proxy. You can use -noonion
24-
to explicitly disable access to hidden service.
15+
-proxy=ip:port Set the proxy server. If SOCKS5 is selected (default), this proxy
16+
server will be used to try to reach .onion addresses as well.
2517

26-
-listen When using -proxy, listening is disabled by default. If you want
27-
to run a hidden service (see next section), you'll need to enable
28-
it explicitly.
18+
-onion=ip:port Set the proxy server to use for Tor hidden services. You do not
19+
need to set this if it's the same as -proxy. You can use -noonion
20+
to explicitly disable access to hidden services.
2921

30-
-connect=X When behind a Tor proxy, you can specify .onion addresses instead
31-
-addnode=X of IP addresses or hostnames in these parameters. It requires
32-
-seednode=X SOCKS5. In Tor mode, such addresses can also be exchanged with
33-
other P2P nodes.
22+
-listen When using -proxy, listening is disabled by default. If you want
23+
to run a hidden service (see next section), you'll need to enable
24+
it explicitly.
3425

35-
-onlynet=tor Only connect to .onion nodes and drop IPv4/6 connections.
36-
```
26+
-connect=X When behind a Tor proxy, you can specify .onion addresses instead
27+
-addnode=X of IP addresses or hostnames in these parameters. It requires
28+
-seednode=X SOCKS5. In Tor mode, such addresses can also be exchanged with
29+
other P2P nodes.
3730

38-
An example how to start the client if the Tor proxy is running on local host on
39-
port 9050 and only allows .onion nodes to connect:
40-
```
41-
./pivxd -onion=127.0.0.1:9050 -onlynet=tor -listen=0 -addnode=dnetzj6l4cvo2fxy.onion:989
42-
```
31+
-onlynet=onion Make outgoing connections only to .onion addresses. Incoming
32+
connections are not affected by this option. This option can be
33+
specified multiple times to allow multiple network types, e.g.
34+
ipv4, ipv6, or onion.
4335

4436
In a typical situation, this suffices to run behind a Tor proxy:
45-
```
46-
./pivxd -proxy=127.0.0.1:9050
47-
```
4837

49-
Run a PIVX hidden server
50-
-------------------------------
38+
./pivxd -proxy=127.0.0.1:9050
39+
40+
41+
## 2. Run a PIVX Core hidden server
5142

5243
If you configure your Tor system accordingly, it is possible to make your node also
5344
reachable from the Tor network. Add these lines to your /etc/tor/torrc (or equivalent
54-
config file):
55-
```
56-
ClientOnly 1
57-
SOCKSPort 9050
58-
SOCKSPolicy accept 127.0.0.1/8
59-
Log notice file /var/log/tor/notices.log
60-
ControlPort 9051
61-
HiddenServiceDir /var/lib/tor/dnet/
62-
HiddenServicePort 989 127.0.0.1:51472
63-
HiddenServiceStatistics 0
64-
ORPort 9001
65-
LongLivedPorts 989
66-
ExitPolicy reject *:*
67-
DisableDebuggerAttachment 0
68-
NumEntryGuards 8
69-
```
45+
config file): *Needed for Tor version 0.2.7.0 and older versions of Tor only. For newer
46+
versions of Tor see [Section 3](#3-automatically-listen-on-tor).*
47+
48+
HiddenServiceDir /var/lib/tor/pivx-service/
49+
HiddenServicePort 51472 127.0.0.1:51472
50+
HiddenServicePort 61472 127.0.0.1:61472
7051

7152
The directory can be different of course, but (both) port numbers should be equal to
7253
your pivxd's P2P listen port (51472 by default).
73-
```
74-
-externalip=X You can tell pivx about its publicly reachable address using
75-
this option, and this can be a .onion address. Given the above
76-
configuration, you can find your onion address in
77-
/var/lib/tor/pivx-service/hostname. Onion addresses are given
78-
preference for your node to advertize itself with, for connections
79-
coming from unroutable addresses (such as 127.0.0.1, where the
80-
Tor proxy typically runs).
81-
82-
-listen You'll need to enable listening for incoming connections, as this
83-
is off by default behind a proxy.
84-
85-
-discover When -externalip is specified, no attempt is made to discover local
86-
IPv4 or IPv6 addresses. If you want to run a dual stack, reachable
87-
from both Tor and IPv4 (or IPv6), you'll need to either pass your
88-
other addresses using -externalip, or explicitly enable -discover.
89-
Note that both addresses of a dual-stack system may be easily
90-
linkable using traffic analysis.
91-
```
54+
55+
-externalip=X You can tell pivx about its publicly reachable address using
56+
this option, and this can be a .onion address. Given the above
57+
configuration, you can find your .onion address in
58+
/var/lib/tor/pivx-service/hostname. For connections
59+
coming from unroutable addresses (such as 127.0.0.1, where the
60+
Tor proxy typically runs), .onion addresses are given
61+
preference for your node to advertise itself with.
62+
63+
-listen You'll need to enable listening for incoming connections, as this
64+
is off by default behind a proxy.
65+
66+
-discover When -externalip is specified, no attempt is made to discover local
67+
IPv4 or IPv6 addresses. If you want to run a dual stack, reachable
68+
from both Tor and IPv4 (or IPv6), you'll need to either pass your
69+
other addresses using -externalip, or explicitly enable -discover.
70+
Note that both addresses of a dual-stack system may be easily
71+
linkable using traffic analysis.
9272

9373
In a typical situation, where you're only reachable via Tor, this should suffice:
94-
```
95-
./pivxd -proxy=127.0.0.1:9050 -externalip=dnetzj6l4cvo2fxy.onion:989 -listen
96-
```
9774

98-
(obviously, replace the Onion address with your own). If you don't care too much
99-
about hiding your node, and want to be reachable on IPv4 as well, additionally
100-
specify:
101-
```
102-
./pivxd ... -discover
103-
```
75+
./pivxd -proxy=127.0.0.1:9050 -externalip=pivxzj6l4cvo2fxy.onion -listen
76+
77+
(obviously, replace the .onion address with your own). It should be noted that you still
78+
listen on all devices and another node could establish a clearnet connection, when knowing
79+
your address. To mitigate this, additionally bind the address of your Tor proxy:
80+
81+
./pivxd ... -bind=127.0.0.1
82+
83+
If you don't care too much about hiding your node, and want to be reachable on IPv4
84+
as well, use `discover` instead:
85+
86+
./pivxd ... -discover
10487

10588
and open port 51472 on your firewall (or use -upnp).
10689

107-
If you only want to use Tor to reach onion addresses, but not use it as a proxy
90+
If you only want to use Tor to reach .onion addresses, but not use it as a proxy
10891
for normal IPv4/IPv6 communication, use:
109-
```
110-
./pivxd -onion=127.0.0.1:9050 -externalip=dnetzj6l4cvo2fxy.onion:989 -discover
111-
```
112-
113-
List of known PIVX Tor relays
114-
------------------------------------
115-
```
116-
y5kcscnhpygvvnjn.onion:989
117-
5bmhtjvn2jvwpiej.onion:989
118-
pyfdxkazur3iib7y.onion:989
119-
ok3ym5zy6m5klimk.onion:989
120-
i6vpvzk2jxuqqs5f.onion:989
121-
bgdhpb76fkbw5fmg.onion:989
122-
gtlqzb5zbws5di7g.onion:989
123-
f7j2m26rptm5f7af.onion:989
124-
dnetzj6l4cvo2fxy.onion:989
125-
s3v3n7xhqafg6sb7.onion:989
126-
```
92+
93+
./pivxd -onion=127.0.0.1:9050 -externalip=pivxzj6l4cvo2fxy.onion -discover
94+
95+
## 3. Automatically listen on Tor
96+
97+
Starting with Tor version 0.2.7.1 it is possible, through Tor's control socket
98+
API, to create and destroy 'ephemeral' hidden services programmatically.
99+
PIVX Core has been updated to make use of this.
100+
101+
This means that if Tor is running (and proper authentication has been configured),
102+
PIVX Core automatically creates a hidden service to listen on. This will positively
103+
affect the number of available .onion nodes.
104+
105+
This new feature is enabled by default if PIVX Core is listening (`-listen`), and
106+
requires a Tor connection to work. It can be explicitly disabled with `-listenonion=0`
107+
and, if not disabled, configured using the `-torcontrol` and `-torpassword` settings.
108+
To show verbose debugging information, pass `-debug=tor`.
109+
110+
Connecting to Tor's control socket API requires one of two authentication methods to be
111+
configured. It also requires the control socket to be enabled, e.g. put `ControlPort 9051`
112+
in `torrc` config file. For cookie authentication the user running pivxd must have read
113+
access to the `CookieAuthFile` specified in Tor configuration. In some cases this is
114+
preconfigured and the creation of a hidden service is automatic. If permission problems
115+
are seen with `-debug=tor` they can be resolved by adding both the user running Tor and
116+
the user running pivxd to the same group and setting permissions appropriately. On
117+
Debian-based systems the user running pivxd can be added to the debian-tor group,
118+
which has the appropriate permissions.
119+
120+
An alternative authentication method is the use
121+
of the `-torpassword=password` option. The `password` is the clear text form that
122+
was used when generating the hashed password for the `HashedControlPassword` option
123+
in the tor configuration file. The hashed password can be obtained with the command
124+
`tor --hash-password password` (read the tor manual for more details).
125+
126+
## 4. Privacy recommendations
127+
128+
- Do not add anything but PIVX Core ports to the hidden service created in section 2.
129+
If you run a web service too, create a new hidden service for that.
130+
Otherwise it is trivial to link them, which may reduce privacy. Hidden
131+
services created automatically (as in section 3) always have only one port
132+
open.

0 commit comments

Comments
 (0)