Tor integration in Whonix Development Notes

From Whonix
< Dev
Jump to navigation Jump to search
Design Previous page: Dev/Default Application Policy Index page: Design Next page: Dev/setup-dist Tor integration in Whonix Development Notes

Tor Version, Package source (Debian, backports, Tor Project package repository), Config Files, Miscellaneous

Tor Version

[edit]

This section documents Tor version selection considerations for Whonix. It compares C Tor and Arti, explains why the latest stable Tor package from deb.torproject.org might not always match the stable Debian release used by Whonix, and summarizes the advantages and disadvantages of using Debian packages, the Tor Project repository, Debian backports, or versions migrated to deb.kicksecure.com.

There are two implementations of Tor.

  • C Tor - Originally called "Tor". This is the original implementation of Tor written in the C programming language.
  • Arti - New implementation of Tor based on Rust.

Both are developed by their upstream developer, The Tor Project (TPO).

According to the Tor release notesarchive.org iconarchive.today icon, there are usually several major versions of Tor supported by The Tor Project. However, because the Tor packager has limited time, only a few major versions are packaged and ready for use.

For example, in December 2017, five major versions of Tor were supported. Specifically:

  1. The Debian stretch repository contained an LTS version, which was version 0.2.9.
  2. deb.torproject.org, also known as the Tor, Tor Project or TPO repository, provided the latest stable Tor, which was version 0.3.1.9.

A major consideration in choosing the most suitable Tor version for Whonix is that the latest stable version found in the TPO repository may lead to network breakage. [1] The reason is that the "stable" tag indicates a stable version of Tor, which does not necessarily match the "stable" Debian version that Whonix uses. [2]

There are three primary Tor options for Whonix developers and each of them has pros and cons:

1. Use the Tor LTS version from the official Debian package repository: packages.debian.org

  • Advantages: Minimal effort is required in Whonix.
  • Disadvantages: Might miss the advantages of later versions (see below).
    • While this was true in the past, development of C Tor has slowed down because its replacement, Arti, is now the development focus of the Tor developers. [3]

2. Use the latest stable version in the TPO repository and allow testers to use the Tor nightly build in Whonix, with bug reporting to TPO

3. Versions are downloaded from deb.torproject.org, verified to work, and then migrated to deb.kicksecure.com

(Why deb.kicksecure.com? Because Kicksecurearchive.org iconarchive.today icon also uses the Tor package, and Whonix is Based on Kicksecure.)

  • Advantages: Flexibility in version selection, and a guaranteed way to confirm that only stable Tor versions which are functional in Whonix will be uploaded.
  • Disadvantages:
    • A few testers are needed, manual uploads are required, and Whonix touches Tor packaging.
    • Other issues from 2. above equally apply.

4. Versions are downloaded from Debian backports, verified to work, and then migrated to deb.kicksecure.com

Advantages:

Open Questions:

Scenario A)...

1. Newer Tor version downloaded from Debian backports.
2. Verified to work, and then migrated to deb.kicksecure.com.
3. Debian backports starts to provide an even newer Tor version.
4. TODO: Would it automatically get installed?

Scenario B)...

1. Newer Tor version downloaded from Debian backports.
2. Verified to work, and then migrated to deb.kicksecure.com.
3. Debian backports becomes outdated but the Tor Project repository provides a newer version.
4. Newer Tor version downloaded from TPO repository.
5. Migrated to deb.kicksecure.com.
6. TODO: Would the newer Tor version get installed or would the installed Tor version from Debian backports prevent this?

Current Choice

Whonix developers have chosen the third method for Whonix 16. [6] However, the comparison above suggests that the second option provides better security and compatibility. This approach, however, would require a lot of active testers who can use the Tor nightly build and report bugs to The Tor Project or Whonix, but these are currently unavailable.

Whonix developers have chosen the first method for Whonix 17 because development of C Tor has slowed down in favor of Arti as mentioned above.

Back to the third method: https://forums.whonix.org/t/tor-integration-in-whonix/10593/45archive.org iconarchive.today icon

Tor Config Files

[edit]

Rationale for Tor Drop-In Configuration Folder

[edit]

Having a Tor Configuration Drop-In Folder makes implementation of additional features that require additional Tor settings much easier. For example, it could improve usability to provide a whonix-gw-hidden-webserver package that automates the Whonix-Gateway specific instructions for Onion Services. Such a package could just drop the configuration snippet into that folder, and if the feature is disabled or the package is uninstalled, that configuration snippet gets purged. Adding additions to /etc/tor/torrc with a script is problematic, because those additions cannot be removed by a script if the user slightly modified those lines and because they can cause a dpkg interactive conflict resolution dialog.

Current Implementation

[edit]

The implementation is as follows.

Rejected Alternatives

[edit]

Only Two Config Files

[edit]
  • Using only /usr/share/tor/tor-service-defaults-torrc and /etc/tor/torrc, not using /etc/tor/torrc.examples.
  • Storing configuration examples (instructions) in /usr/share/tor/tor-service-defaults-torrc. Using a minimal /etc/tor/torrc to tell users to look into /usr/share/tor/tor-service-defaults-torrc for configuration examples.
  • This is a bad idea, because users are tempted to uncomment things in /usr/share/tor/tor-service-defaults-torrc.
  • If they do this, their settings would get lost and overwritten without asking next time they update anon-gw-anonymizer-configarchive.org iconarchive.today icon, because /usr/share/tor/tor-service-defaults-torrc is not a configuration file since it is in /usr, not /etc.

Only One Config File

[edit]
  • Using only /etc/tor/torrc, leaving /usr/share/tor/tor-service-defaults-torrc with defaults from Debian, not using /etc/tor/torrc.examples.
  • Using /etc/tor/torrc for user examples, users' own modifications, and Whonix Tor settings.
  • This is bad, because when users have edited /etc/tor/torrc and anon-gw-anonymizer-config gets updated, it will throw a dpkg interactive conflict resolution dialog. Users might decide to keep their old config file and then miss (security) improvements.

Tor Control

[edit]

See Talking to the real Tor Control Port.

Tor Readiness to Serve Connections API

[edit]

What API answers the question, "When is Tor ready to serve connections?"

The short answer is: none.

Unfortunately, there is no reliable API for that. There is the Tor control protocol status/circuit-established, which can return 1 (yes), but that does not mean a connection will succeed. The only way to test it would be to perform a connection test, such as using curl against some clearnet or onion domain(s). But which ones, without creating single points of failure?

Why Waste Network Bandwidth by Downloading Operating System Updates over Tor?

[edit]

The short answer is that this option was discussed with The Tor Project and Whonix was granted permission to do so.

Interested readers who want to learn more should review the following:

Forum Discussion

[edit]

Footnotes

[edit]
  1. The Debian target is usually the stable package, which is currently: trixie for Whonix.
  2. Patrick: "Historically when there was a botnet starting to use Tor, the LTS version barely connected while the latest stable had the ntor handshake which worked." See tor-weekly-news-september-4th-2013archive.org iconarchive.today icon.
  3. Package: tor-geoipdb Version: 0.4.5.8-1~d10.buster+1 is Architecture: all and Depends: tor (>= 0.4.5.8-1~d10.buster+1). Thereby for example ended up in Whonix repository for architecture ppc64el. This has not caused an issue yet.
  4. Related Whonix Forum discussion: https://forums.whonix.org/t/tor-releases-discussion/4578archive.org iconarchive.today icon
  5. Click herearchive.org iconarchive.today icon for an overview of all answers.

Design Previous page: Dev/Default Application Policy Index page: Design Next page: Dev/setup-dist

Notification image

We believe security software like Whonix needs to remain Open Source and independent. Would you help sustain and grow the project? Learn more about our 14 year success story and maybe DONATE!