1.6 Privacy (Tor)¶
Monero hides amounts, senders and receivers on the blockchain, but your IP address can still leak, for example when your node broadcasts a transaction. Tor hides it. With the system configured and locked down, set it up now, before any Monero software. In this step you:
- Install Tor from Ubuntu
- Switch Tor itself to the Tor Project's own repository
Later, 2.2 Anonymous networking connects monerod to Tor too.
Install Tor¶
Install Tor from Ubuntu's archive, together with two tools used below:
What goes over Tor, and what doesn't
In this guide, Tor is only used to broadcast your own transactions (2.2), and to reach your node from anywhere: your wallets syncing with it (2.2), and the bonus guides' SSH, light wallet server and block explorer. Downloads never go through Tor: Ubuntu's and the Tor Project's packages, Monero releases, signing keys and source code all come directly over the clearnet, with plain apt, wget, curl and git. That only shows which public software you install, like millions of other machines, and every download is checked against a signature.
Check that Tor runs and has connected to the Tor network:
systemctl is-active tor@default
sudo journalctl -u tor@default --no-pager | grep Bootstrapped | tail -1
If it says less than 100%, wait a minute and check again. Then test that traffic really goes through Tor:
Get Tor from the Tor Project¶
Ubuntu's Tor package is often older than the Tor Project's own. Switch to the Tor Project's repository.
Download the Tor Project's signing key:
curl -fsS https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc \
| gpg --dearmor | sudo tee /usr/share/keyrings/deb.torproject.org-keyring.gpg >/dev/null
gpg --show-keys /usr/share/keyrings/deb.torproject.org-keyring.gpg | head -2
The fingerprint must be A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.
Add the repository. The codename (resolute) is read from /etc/os-release:
sudo tee /etc/apt/sources.list.d/tor.sources >/dev/null <<EOF
Types: deb
URIs: https://deb.torproject.org/torproject.org
Suites: $(. /etc/os-release && echo "$VERSION_CODENAME")
Components: main
Signed-By: /usr/share/keyrings/deb.torproject.org-keyring.gpg
EOF
cat /etc/apt/sources.list.d/tor.sources
Check that Suites: says resolute, then upgrade Tor to the Tor Project's version, and install the package that keeps its signing key up to date:
A version ending in ~resolute+1 comes from the Tor Project.
Validation¶
Tor's updates now come from the Tor Project's repository, directly. Ubuntu's sources in ubuntu.sources stay unchanged.
Extras (optional)¶
SSH into your node over Tor, from anywhere
Log in from outside your home without opening any router port: see the SSH over Tor bonus guide.
Get a new onion address
If an onion address leaks, delete its service folder and reload Tor. A fresh address is created, and the old one stops working forever:
sudo rm -rf /var/lib/tor/SERVICE_NAME
sudo systemctl reload tor
sudo cat /var/lib/tor/SERVICE_NAME/hostname
SERVICE_NAME with the folder name from torrc, for example monero-rpc. Update every wallet that used the old address.
Upgrade¶
Tor comes from an apt repository, so it updates with the rest of the system: sudo apt update && sudo apt upgrade. Restart it after an upgrade:
Uninstall¶
Remove the Tor Project's repository first:
sudo rm /etc/apt/sources.list.d/tor.sources
sudo apt purge -y tor deb.torproject.org-keyring
sudo rm /usr/share/keyrings/deb.torproject.org-keyring.gpg
sudo rm -rf /var/lib/tor # deletes all onion service keys
Troubleshooting¶
Tor is stuck at Bootstrapped 5% (or another low number)
- Check the clock. Tor refuses to work when the system time is far off.
timedatectlmust showSystem clock synchronized: yes. - Your network may block Tor. Some ISPs, workplaces and countries do. Tor bridges get around this. See the Tor Project's bridges documentation.
apt: The following signatures couldn't be verified … NO_PUBKEY
The Tor Project's signing key has changed, or the keyring file is broken. Download the key again with the curl command in Get Tor from the Tor Project, then run sudo apt update. The deb.torproject.org-keyring package keeps it current after that.
curl: (97) Can't complete SOCKS5 connection
This happens in the Tor test (curl --socks5-hostname …) when Tor isn't fully started yet. Watch sudo journalctl -fu tor@default until it reaches Bootstrapped 100%, then try again.
Port reference¶
| Port | Protocol | Use |
|---|---|---|
| 9050 | TCP | Tor SOCKS proxy (localhost only) |
| 9051 | TCP | Tor control port (localhost only, if enabled) |