Configuring TheOnionBox Web Interface to Monitor Tor Relay Nodes

  • Tutorial

The Onion Box is an open source web interface for monitoring relay nodes written in python.


He is able to display disk, memory, network load indicators, as well as node statistics, including those obtained through Onionoo (a protocol for monitoring status on the Tor network), and build beautiful graphs.


It looks something like this:


pic-1


Under cat description of the setting.


A couple more examples of the interface

pic-2
pic-3


Comparing the Tor node and the I2P node ( i2pd ), in my friendliness to an inexperienced user, in my opinion, Tor loses, at least in terms of quick start. I2pd has a minimal interface for monitoring and executing the simplest commands, while the Tor node has no interface (I know about Arm , but it is a console interface and only for Linux).


In light of recent events, holding an exit node can be fraught with, but if you want to help the Tor network become faster, better, safer, without risking anything and with a minimum of effort, then the relay node is for you! You can read more about the configuration here . In this article, I will assume that a relay node has already been configured on your Tor machine.


Tor setup


All that is needed is to enable node management by specifying a management port. It is also better to add a password to this admin panel (optional, however).


To set a password, get its hash. Go to the folder with the Tor binary, open cmd and execute:


tor --hash-password SUPER-PASSWORD > hash.txt

The hast.txt file should appear in the same folder with approximately the following contents:


Jun 21 18:26:33.023 [notice] Tor v0.2.4.24 (git-a8a38e5dd1fbb67a) running on Windows 7 with Libevent 2.0.21-stable and OpenSSL 1.0.1i.
Jun 21 18:26:33.025 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://www.torproject.org/download/download#warning
16:5DC1FEEC60D990AB6081B9319FD29D850CBE07545B94055C1B5490EA80

From this, we need the last line, which is a hash of our password: 16:5DC1FEEC60D990AB6081B9319FD29D850CBE07545B94055C1B5490EA80.


Then open the torrc-file (usually it lies in /usr/local/etc/torrcor %appData%\Roaming\tor\torrc) and add the following lines:


СontrolPort 9051
HashedControlPassword 16:5DC1FEEC60D990AB6081B9319FD29D850CBE07545B94055C1B5490EA80
CookieAuthentication 1

And restart the node to apply the config.


Install and configure OnionBox


Python installation

To start OnionBox, you need python. Any version (works with both 2.7 and 3.x).
Under Linux, everything is trivial, but under Windows, after installation, you need to do logoff-login (or execute a script ) so that the PATH changes are applied.


Check that the python is ready, open cmd and write: The python -V
installed version should be displayed.


If this does not work, you need to add to PATH the path where the python is installed, for example, C:\Python3.6and C:\Python3.6\Scripts.


Download the latest release from the github , at the time of writing this article is 3.2.1. Unpack it into a folder, for example C:\Tor\UI.


If you installed a different control port (not 9051) in the Tor node config , open the config ( config\theonionbox.cfg), find the line there tor_control_port = 9051and write the same port as in the Tor config.


After that, you need to install the necessary dependencies for OnionBox.


We open cmd and first of all put pip (the package manager for python), if it is not already installed.


Pip installation

Next, put the necessary modules:


pip install psutil stem bottle apscheduler requests

For Python 2.7, you need to add an additional module configparser.


And start the service itself:


python theonionbox.py

If everything is in order, you can open the admin panel in the browser ( http://127.0.0.1:8080 ) and enjoy.


Tips & Tricks


Also, for convenience, you can demonize this service. Under Windows, in particular, this can be done through NSSM . To do this, go to the folder with the nssm binary, run cmd, execute:


nssm install TorUI "path-to-python\python.exe" "path-to-onionbox\theonionbox.py"

We start the service and you're done!


References


Habrastatya on setting up relay nodes
Tor’s official man
TheOnionBox on the github


Also popular now: