Install Tor
Install Tor and Enable Tor Networking for the Zend Daemon
- Install Tor From the Official Repository
- Create and Execute Tor Script
- Restart Zend and Check Network Configuration
- Optional - Add Tor Nodes into zen.conf
Description | Command | |
---|---|---|
Install Tor From the Official Repository | ||
1 | Add the Tor repository to your package sources | sudo su -c "echo 'deb https://deb.torproject.org/torproject.org '$(lsb_release -c | cut -f2)' main' > /etc/apt/sources.list.d/torproject.list" |
2 | Pull the gpg key used to sign the tor packages | Pulling the gpg key may take some time, if it times out, run it again until it has been imported curl https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc | gpg --import |
3 | Export the key and add to apt, this enables package verification | gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add - |
4 | Update the package cache with tor repositories added as sources | sudo apt-get update |
5 | Install tor | sudo apt-get install tor deb.torproject.org-keyring -y |
6 | Add your current user to the debian-tor group to be able to use cookie authentication | sudo usermod -a -G debian-tor $USER |
7 | Run the sg command with bash to start a new shell, this is required for bash to identify the non-root user being added to the debian-tor group (it prevents having to exit and login) | sg debian-tor -c "bash" |
Create and Execute Tor Script | ||
8 | Update the torrc file to make tor work with the zen daemon
| The following block of text is meant to be copied and pasted in its entirety cat <<EOF > ~/tor.sh #!/bin/bash sudo sed -i 's/#ControlPort 9051/ControlPort 9051/g' /etc/tor/torrc sudo sed -i 's/#CookieAuthentication 1/CookieAuthentication 1/g' /etc/tor/torrc sudo su -c "echo 'CookieAuthFileGroupReadable 1' >> /etc/tor/torrc" sudo su -c "echo 'LongLivedPorts 9033' >> /etc/tor/torrc" sudo systemctl restart tor.service EOF chmod u+x ~/tor.sh sudo ~/tor.sh |
Restart Zend and Check Network Configuration | ||
9 | Stop zend and the tracker using systemd or with pm2 & monit and apply ownership to the non-root user of all files created since step 7, to enable tor in the zend daemon | For installations using systemd sudo systemctl stop zend zentracker && sleep 30 && chown -R $USER:$USER ~/ && sudo systemctl start zend zentracker For installations using monit (zend) and pm2 (tracker) sudo monit stop zend && pm2 stop 0 && sleep 30 && chown -R $USER:$USER ~/ && sudo monit start zend && sleep 8 && pm2 start 0 |
10 | Verify that tor is enabled in zend by checking the network info
| zen-cli getnetworkinfo Example Output { |
Optional - Add Nodes | ||
11 | Use nano and append tor nodes to the bottom of your zen.conf
NOTE: You will need to restart zend for changes to take effect | nano ~/.zen/zen.conf Example Output rpcuser=XXXXXXXXXXXXXXXX |