Tor network on Debian

Charles Vissol
5 min readSep 17, 2023

--

Tor network is based on onion routers. This technology has been developed by U.S. Naval Research Lab in the 1990s with the name of “The Onion Routing”.
The “onion” name gets its name from the onion-like layering technique that hides information about user activity and location.
Tor network is a solution among others to protect privacy issues such as VPNs and others.

Tor network organization

Tor network is composed by relays and bridges. In June 2023, Tor is composed by 2000 bridges and around 7000 relays:

  • bridges: server whose existence is non-public and maintained by volunteers. These servers allow users to access to Tor network even if they are blocked. Bridges are dedicated to pluggable transports (obfs4, meek, Snowflake). Bridges are registered in the bridge authority.
  • relays: public servers maintained by volunteers that forward traffic on behalf of clients to the Tor network. Relays are registered on directory authorities.

To follow the number of bridges and relays, go to https://metrics.torproject.org/networksize.html.

Navigating with Tor network

A client connecting to Tor network sends the traffic through 3 random servers (known as relays). The last relay in the circuit (the “exit relay”) then sends the traffic out onto public internet.

An important aspect of Tor network is that each time the packet cross a relay, it is wrapped into another packet like a nesting doll:

Routers doesn’t know the whole travel of the request, only the previous and the next relay.
At each stop, the node (relay) only knows the last place the packet was and the next place it will be. No node records the complete path of data.

Deep web

Tor offers a door to the deep web, a web that is not indexed by Search engines.
Tor provides specific mode of connection where clients and server does not need to know each other IP addresses. They use a 56-character code (onion address) that client enter instead of a traditional URL.

Tor limitations by Tor network

The Tor network is secure from traffic analysis, but not without risks because your Service Provider can know you are using Tor network. If you want to enforce your security and your privacy, you can subscribe to a VPN service.
The main side effect of Tor network is the slowness of the surf…

Tor limitations by Tor Browser

Despite the fact that Tor network is secure from traffic analysis, Tor is a modified version of Firefox and is vulnerable to attacks and exploits like any other browser.
There is no way to e completely secure on the internet but there is best practices to minimize the risks:

  • using Tor Browser, you can check TorCheck website to check that your connection to Tor is secure
  • you can get a VPN to provide additional security layer.

Tor doesn’t protect you if you choose to enter information into any form: use your common sense to avoid sharing personal information on the internet.

In terms of usage, you can adapt your settings to your usage with certain user experience limitation:

  • in Safer or Safest mode, you can disable some features, scripts, medias…
  • you can block dangerous downloads

Several ways to use Tor

Not exhaustive, but some technics…

It’s recommended that you should use NoScript before surfing the web with Tor. NoScript shall block JavaScript/Java/Flash scripts on websites to make sure they won’t reveal your real identify.

Tor browser

Tor Browser uses Tor network:

  • Your ISP (Internet Service Provider) and anyone watching your connection locally won’t be able to track your internet activity, including the name and address of the websites you visit
  • The operator of the websites and services that you use, and anyone watching them, will see a connection coming from the Tor network instead of your real IP address, and will not know who you are unless you explicitly identify yourself.

By default Tor Browser does not keep any browsing history. Cookies are only valid for a single session.

You can simply get the Tor browser by downloading the last version at https://www.torproject.org/download/.
Then, once downloaded, you obtain a tar.gz file you can unzip in any location you want. Once done, go inside the tor-browser folder and you can find a start-tor-browser.desktop shortcut.
Proceed to register Tor Browser as a desktop application:

./start-tor-browser.desktop --register-app

Launch the shortcut to start Tor browser.

Tips: automatic connection
If you want Tor browser to connect automatically to the Tor network, go to Settings > Connection > Quickstart, Check
Always connect automatically.

Tips: bypass blocking access
If you need to bypass some blocking access, you can add bridges by going to Settings > Connection > Add New Bridge.

Tips: Check your connection is secure
With Tor browser, go to
https://check.torproject.org/

Tips: Secure your surf
By default, Tor offers a
standard security level. You'd raiser turn to Safer security level

Tor network (Debian)

You could choose to user Tor relays:

  • in your Terminal
  • in your Web Browser (here Firefox)
    First you must install Tor on your system:
sudo apt install tor

Once done, a service is running (see systemctl status tor).
If you want to activate the Tor network in your terminal (means "torify" your terminal), run:

source torsocks on

To deactivate the Tor network:

source torsocks off

These torify terminal remains only during the session. So if you want to persist the usage of Tor relays, you must include the command in your home’s .bashrc profile:

echo ". torsocks on" >> ~/.bashrc

If you want to torify your Web Browser, you can set the Tor local proxy with 9050 port if your tor service is active (verify with ss -nlt) by listening locally on 9050 port.

For more details see https://linuxconfig.org/install-tor-proxy-on-ubuntu-20-04-linux

Tor network is configured in the /etc/tor/torrc file. If you want, you can configure your Tor connection using this configuration file.
Think to restart tor service after torrc modification:

systemctl restart tor

If you want to configure Tor, run man tor to get the details of the configuration.

Some interesting /etc/tor/torrc parameters are:

  • Sandbox 0|1: If set to 1, Tor will run securely through the use of a syscall sandbox. Otherwise the sandbox will be disabled. The option only works on Linux-based operating systems, and only when Tor has been built with the libseccomp library. Default is 0.
  • RunAsDaemon 0|1: If 1, Tor forks and daemonizes to the background. Can not be changed while tor is running. Default is 0

To remove any configuration and data of tor, run:

sudo apt-get -y purge tor

To remove tor configuration, data and all its dependencies, run:

sudo apt-get -y autoremove --purge tor

References

--

--