Actions

Connecting to Tor before a Proxy

From Whonix

< Tunnels



Balloon-936780640.jpg

UserTorProxyInternet

Introduction[edit]

Ambox warning pn.svg.png Before combining Tor with other tunnels, be sure to read and understand the risks!

Ambox notice.png Advertisement:
Too difficult to set up? Provider specific automation can be created for you by the lead developer of Whonix ™. Send reasonable price suggestions. Get in contact.

Proxy Warning[edit]

Whonix ™ first time users warning Warning! Take careful note of the following issues when using standard, common http(s)/SOCKS4(a)/5 proxies -- anonymizers that only use http(s)/SOCKS4(a)/5 as an interface [1] are exempt.

  • Most problems with these proxies are not caused by Whonix ™.
  • Tor exit relays and their ISPs can still monitor your connection to its destination.
  • Be especially careful with http(s) proxies. Some of them send the X-Forwarded-For header which discloses the IP address. http(s) proxies that do not send this header are sometimes called "elite" or "anonymous" proxies.
  • When using X-Forwarded-For http(s) proxies, destination servers can determine the IP of your Tor exit relay.

For further detailed information on proxies, see: Tor vs. Proxies, Proxy Chains and VPNs.

Generally[edit]

There are three different methods to connect to Tor before a proxy.

Table: Post-Tor Proxy Connection Methods

Proxy Settings Method Proxifier Method Transparent Proxying Method
Application requires no support for proxy settings No Yes Yes
Likelihood of leaks [2] going user → Tor → Internet Depends [3] Depends [4] Lower [5]
DNS can be resolved by the same proxy Yes Yes Needs extra DNS resolver [6]
Per application configuration required Yes Yes No
System wide configuration No No Yes
Proxy chains possible No Yes, but see footnote

[7]

No [8]
Setup difficulty Different per application Always very similar Initial setup difficult

Proxy Settings Method[edit]

Introduction[edit]

You could use an application's native proxy settings to configure applications in Whonix ™ to use an extra proxy. This of course supposes, that the application has proxy settings. After understanding Whonix ™ default stream isolation configuration, there is no difference from using proxy settings in an ordinary way, other than that it is running inside Whonix-Workstation ™. If proxy settings are honored by an application or not is another question and out of scope, see TorifyHOWTO [archive]. There is a list of applications that come pre-configured with Whonix ™ for Stream Isolation. If you plan on changing the proxy settings of any of those, you must read the notes below.

Ambox warning pn.svg.png

  • Apply the following steps to avoid unexpected results such as broken connectivity and/or traffic bypassing the tunnel-link and only going through Tor.
  • Qubes-Whonix ™ exception: There is one tunnel configuration where Qubes-Whonix ™ users are better placed. When a separate tunnel-link VM is used between anon-whonix and sys-whonix (anon-whonixTunnel-linksys-whonix), these connections will fail without the following modifications.

Tor Browser Notes[edit]

Complete the following steps inside Whonix-Workstation ™ (anon-whonix).

1. Launch Tor Browser.

2. And enter about:config into the URL bar and press enter.

3. Change the following settings.

4. Set extensions.torbutton.use_nontor_proxy to true.

5. Set network.proxy.no_proxies_on to 0.

6. Proxy specific settings.

Depending on using a HTTP, HTTPS or SOCKS proxy.

A) HTTP proxy

If a HTTP proxy is being used, modify address and port number to the following strings.

  • network.proxy.http
  • network.proxy.http_port

B) HTTPS proxy

If a HTTPS proxy is being used, modify the following strings instead.

  • network.proxy.ssl
  • network.proxy.ssl_port

C) SOCKS proxy

This process can be repeated with socks proxies, but it is redundant and does not provide any advantage over the former types. The reason is because only Tor Browser is modified and no other programs are being tunneled through it.

  • Set network.proxy.socks to the IP of proxy server.
  • Set network.proxy.socks_port to the port number of the proxy server.
  • Set network.proxy.socks_remote_dns to
    • false - if the proxy server does not support resolving DNS. In this case, DNS will go through Tor exit nodes thanks to Whonix ™, or
    • true - if the proxy server does resolving DNS which is better.
  • Set network.proxy.socks_version to either 4 or 5 depending on the version of the proxy server.

7. Done.

Tor Browser proxy configuration has been completed.

Misc Application Notes[edit]

On the Stream Isolation page, there is a list of applications that are pre-configured to use socks proxy settings via application configuration files. To disable this the Whonix ™ system default must be removed from the application's settings.

TODO: document and expand.

Remove proxy settings for APT repository files.

1. If you previously onionized any repositories, that has to be undone; see Onionizing Repositories.

2. Remove any mention of tor+ in file /etc/apt/sources.list (if it was previously configured; that file is empty by default in Whonix ™ / Kicksecure) or any file in folder /etc/apt/sources.list.d.

3. Open file /etc/apt/sources.list /etc/apt/sources.list.d/* in an editor with root rights.

This box uses sudoedit for better security [archive]. This is an example and other tools can also achieve the same goal. If this example does not work for you or if you are not using Whonix ™, please refer to this link.

sudoedit /etc/apt/sources.list /etc/apt/sources.list.d/*

4. Remove any mention of tor+.

The process of removing proxy settings from APT repository files is now complete.

Remove proxy settings for Tor Browser Downloader by Whonix ™.

Open file /etc/torbrowser.d/50_user.conf in an editor with root rights.

This box uses sudoedit for better security [archive]. This is an example and other tools can also achieve the same goal. If this example does not work for you or if you are not using Whonix ™, please refer to this link.

sudoedit /etc/torbrowser.d/50_user.conf

Paste. [9] [10]

TB_NO_TOR_CON_CHECK=1
CURL_PROXY="--fail"

Save.

For some applications, this is impossible:

These applications can only talk to Tor Onion Services directly and cannot be configured to use the system default. Therefore you can only deactivate sdwdate and/or not use applications like OnionShare and Ricochet IM.

uwt wrapped application notes[edit]

Whonix ™ ships a list of applications pre-configured for using uwt wrappers by default. If the application you want to tunnel through the extra tunnel-link is on that list, it would conflict with your custom proxy settings. In that case, you need to disable that uwt wrapper first.

On the Stream Isolation page, there is a list of applications that are pre-configured to use uwt wrappers. Follow the instructions below in order to disable this.

The following instructions permanently deactivate all uwt wrappers and remove stream isolation for uwt-wrapped applications system-wide. Consequently, all uwt-wrapped applications revert to the default system networking configuration.

For more granular control of uwt wrapper deactivation, see: Deactivate uwt Stream Isolation Wrapper.

Open file /etc/uwt.d/50_user.conf in an editor with root rights.

This box uses sudoedit for better security [archive]. This is an example and other tools can also achieve the same goal. If this example does not work for you or if you are not using Whonix ™, please refer to this link.

sudoedit /etc/uwt.d/50_user.conf

Add.

uwtwrapper_global="0"

Save and exit.


Proxyfier Method[edit]

General[edit]

After understanding Whonix ™ default stream isolation configuration, there is no difference from using a Proxyfier in an ordinary way, other than that it is running inside Whonix-Workstation ™. There is a list of applications that come pre-configured with Whonix ™ for Stream Isolation. If you plan on changing the proxy settings of any of those, you must read the notes below.

If the Proxifier is leak free or in worst case leaks through Tor alone (thanks to Whonix ™), is another question and not in Whonix ™ power, see TorifyHOWTO [archive].

Ambox warning pn.svg.png

  • Apply the following steps to avoid unexpected results such as broken connectivity and/or traffic bypassing the tunnel-link and only going through Tor.
  • Qubes-Whonix ™ exception: There is one tunnel configuration where Qubes-Whonix ™ users are better placed. When a separate tunnel-link VM is used between anon-whonix and sys-whonix (anon-whonixTunnel-linksys-whonix), these connections will fail without the following modifications.

Tor Browser Notes[edit]

Ambox warning pn.svg.png There is currently no tested, known to work solution for using Tor Browser with the #Proxyfier Method. This is not a Whonix ™ issue but rather an issue with socksifier software and Tor Browser. This would also happen if Whonix ™ was not involved. (For a basic architectural explanation, see Free Support Principle.) Figuring this out is up to you. Please contribute. Alternatively try #Proxy Settings Method.

Introduction

This configuration results in Tor Browser no longer using proxy settings. With no proxy set, Tor Browser uses the (VM) system's default networking. This is identical to any other application inside Whonix-Workstation ™ that has not been explicitly configured to use Tor via socks proxy settings or a socksifier. This setting is also called transparent torification. [11] [12]

Note: This action will break both Stream Isolation for Tor Browser and Tor Browser's tab isolation by socks user name [archive]. This worsens the web fingerprint and leads to pseudonymous (not anonymous) connections. To mitigate these risks, consider using More than one Tor Browser in Whonix ™, or preferably Multiple Whonix-Workstation ™.

To enable transparent torification (no proxy setting), set the TOR_TRANSPROXY=1 environment variable. There are several methods, but the simplest is the /etc/environment Method.

Note: Choose only one method to enable transparent torification.

For other methods with finer granulated settings, please press on Expand on the right.

Command Line Method

Navigate to the Tor Browser folder.

cd ~/tor-browser_en-US

Every time Tor Browser is started, run the following command to set the TOR_TRANSPROXY=1 environment variable.

TOR_TRANSPROXY=1 ./start-tor-browser.desktop

start-tor-browser Method

This only applies to a single instance of the Tor Browser folder that is configured. This method may not persist when Tor Browser is updated.

Find and open start-tor-browser in the Tor Browser folder with an editor.

This is most likely found in ~/tor-browser_en-US/Browser/start-tor-browser below #!/usr/bin/env bash.

Set.

export TOR_TRANSPROXY=1

/etc/environment Method

This will apply to the whole environment, including any possible custom locations of Tor Browser installation folders. [13]

Open file /etc/environment in an editor with root rights.

This box uses sudoedit for better security [archive]. This is an example and other tools can also achieve the same goal. If this example does not work for you or if you are not using Whonix ™, please refer to this link.

sudoedit /etc/environment

Add the following line.

TOR_TRANSPROXY=1
## newline at the end

Save and reboot.

Tor Browser Settings Changes

This step is required since Tor Browser 10. [14]

1. Tor Browser → URL bar → Type: about:config → Press Enter key. → search for and modify

2. network.dns.disabled → set to false

3. extensions.torbutton.launch_warning → set to false

Undo

Reverting this change is undocumented. Simply unsetting that environment variable will not work due to Tor Browser limitations. The easiest way to undo this setting is to install a fresh instance of Tor Browser (please contribute to these instructions)!

Ignore Tor Button's Open Network Settings
Whonix ™ has disabled the Open Network Settings... menu option in Tor Button. Read the footnote for further information. [15]

Misc Application Notes[edit]

On the Stream Isolation page, there is a list of applications that are pre-configured to use socks proxy settings via application configuration files. To disable this the Whonix ™ system default must be removed from the application's settings.

TODO: document and expand.

Remove proxy settings for APT repository files.

1. If you previously onionized any repositories, that has to be undone; see Onionizing Repositories.

2. Remove any mention of tor+ in file /etc/apt/sources.list (if it was previously configured; that file is empty by default in Whonix ™ / Kicksecure) or any file in folder /etc/apt/sources.list.d.

3. Open file /etc/apt/sources.list /etc/apt/sources.list.d/* in an editor with root rights.

This box uses sudoedit for better security [archive]. This is an example and other tools can also achieve the same goal. If this example does not work for you or if you are not using Whonix ™, please refer to this link.

sudoedit /etc/apt/sources.list /etc/apt/sources.list.d/*

4. Remove any mention of tor+.

The process of removing proxy settings from APT repository files is now complete.

Remove proxy settings for Tor Browser Downloader by Whonix ™.

Open file /etc/torbrowser.d/50_user.conf in an editor with root rights.

This box uses sudoedit for better security [archive]. This is an example and other tools can also achieve the same goal. If this example does not work for you or if you are not using Whonix ™, please refer to this link.

sudoedit /etc/torbrowser.d/50_user.conf

Paste. [16] [17]

TB_NO_TOR_CON_CHECK=1
CURL_PROXY="--fail"

Save.

For some applications, this is impossible:

These applications can only talk to Tor Onion Services directly and cannot be configured to use the system default. Therefore you can only deactivate sdwdate and/or not use applications like OnionShare and Ricochet IM.

uwt wrapped application notes[edit]

Whonix ™ ships a list of applications pre-configured for using uwt wrappers by default. If the application you want to tunnel through the extra tunnel-link is on that list, it would conflict with your custom proxy settings. In that case, you need to disable that uwt wrapper first.

On the Stream Isolation page, there is a list of applications that are pre-configured to use uwt wrappers. Follow the instructions below in order to disable this.

The following instructions permanently deactivate all uwt wrappers and remove stream isolation for uwt-wrapped applications system-wide. Consequently, all uwt-wrapped applications revert to the default system networking configuration.

For more granular control of uwt wrapper deactivation, see: Deactivate uwt Stream Isolation Wrapper.

Open file /etc/uwt.d/50_user.conf in an editor with root rights.

This box uses sudoedit for better security [archive]. This is an example and other tools can also achieve the same goal. If this example does not work for you or if you are not using Whonix ™, please refer to this link.

sudoedit /etc/uwt.d/50_user.conf

Add.

uwtwrapper_global="0"

Save and exit.

uwt[edit]

Introduction[edit]

uwt uses torsocks. While the name torsocks implies it is Tor specific, it is not. You can point it to any socks proxy.

uwt wrapped application example[edit]

uwt -t 5 -i 10.152.152.10 -p 9153 /usr/bin/wget.anondist-orig -c https://check.torproject.org

regular application example[edit]

Requires deactivated wget uwt wrapper!

uwt -t 5 -i 10.152.152.10 -p 9156 /usr/bin/wget -c https://check.torproject.org

[18] [19] [20]

Tor Browser Example[edit]

(Untested! Please leave feedback if it worked for you!)

First, you must remove Tor Browser proxy settings before you can combine it with a proxifier.

Introduction

This configuration results in Tor Browser no longer using proxy settings. With no proxy set, Tor Browser uses the (VM) system's default networking. This is identical to any other application inside Whonix-Workstation ™ that has not been explicitly configured to use Tor via socks proxy settings or a socksifier. This setting is also called transparent torification. [21] [22]

Note: This action will break both Stream Isolation for Tor Browser and Tor Browser's tab isolation by socks user name [archive]. This worsens the web fingerprint and leads to pseudonymous (not anonymous) connections. To mitigate these risks, consider using More than one Tor Browser in Whonix ™, or preferably Multiple Whonix-Workstation ™.

To enable transparent torification (no proxy setting), set the TOR_TRANSPROXY=1 environment variable. There are several methods, but the simplest is the /etc/environment Method.

Note: Choose only one method to enable transparent torification.

For other methods with finer granulated settings, please press on Expand on the right.

Command Line Method

Navigate to the Tor Browser folder.

cd ~/tor-browser_en-US

Every time Tor Browser is started, run the following command to set the TOR_TRANSPROXY=1 environment variable.

TOR_TRANSPROXY=1 ./start-tor-browser.desktop

start-tor-browser Method

This only applies to a single instance of the Tor Browser folder that is configured. This method may not persist when Tor Browser is updated.

Find and open start-tor-browser in the Tor Browser folder with an editor.

This is most likely found in ~/tor-browser_en-US/Browser/start-tor-browser below #!/usr/bin/env bash.

Set.

export TOR_TRANSPROXY=1

/etc/environment Method

This will apply to the whole environment, including any possible custom locations of Tor Browser installation folders. [23]

Open file /etc/environment in an editor with root rights.

This box uses sudoedit for better security [archive]. This is an example and other tools can also achieve the same goal. If this example does not work for you or if you are not using Whonix ™, please refer to this link.

sudoedit /etc/environment

Add the following line.

TOR_TRANSPROXY=1
## newline at the end

Save and reboot.

Tor Browser Settings Changes

This step is required since Tor Browser 10. [24]

1. Tor Browser → URL bar → Type: about:config → Press Enter key. → search for and modify

2. network.dns.disabled → set to false

3. extensions.torbutton.launch_warning → set to false

Undo

Reverting this change is undocumented. Simply unsetting that environment variable will not work due to Tor Browser limitations. The easiest way to undo this setting is to install a fresh instance of Tor Browser (please contribute to these instructions)!

Ignore Tor Button's Open Network Settings
Whonix ™ has disabled the Open Network Settings... menu option in Tor Button. Read the footnote for further information. [25]

Then try this command. (Untested! Please leave feedback if it worked for you!)

uwt -t 5 -i 10.152.152.10 -p 9153 ~/tor-browser_en-US/App/Firefox/firefox --profile ~/tor-browser_en-US/Data/profile

[26]

proxychains[edit]

Warnings[edit]

  • We don't know how well proxychains works. For example torsocks has a IPv6 leak bug[27]. We don't know if proxychains forces everything through the proxies. Whonix ™ only ensures, should their be leaks, they go only through Tor.
  • There are at least three different versions of proxychains. The old/original/unmaintained version on sourceforge.net and two forks on github. We don't know about that status of any of them and haven't heard of anyone looking if they do really work as expected. The two authors argue with each other and we weren't motivated to understand the conflict and to determine which version is better. However, any leaks not going through the proxy(chain) will go through Tor.

Setup[edit]

Install proxychains.

sudo apt install proxychains

Open proxychains configuration file.

Open file /etc/proxychains.conf in an editor with root rights.

This box uses sudoedit for better security [archive]. This is an example and other tools can also achieve the same goal. If this example does not work for you or if you are not using Whonix ™, please refer to this link.

sudoedit /etc/proxychains.conf

Go to the bottom of the settings file. Comment out "socks4 127.0.0.1 9050" and add for example "socks5 10.152.152.10 9152" (for Tor stream isolation) or "socks5 ip port" with an IP and port of your choice to set the proxy settings.

[ProxyList]
## add proxy here ...
## meanwhile
## defaults set to "tor"
#socks4 127.0.0.1 9050
socks5 10.152.152.10 9152
# socks5 x.x.x.x xxxx

[28]

Save the configuration file. Test afterwards.

example uwt wrapped application[edit]

proxychains /usr/bin/wget.anondist-orig https://check.torproject.org

[29]

example regular application[edit]

Requires deactivated wget uwt wrapper!

proxychains /usr/bin/wget https://check.torproject.org

Tor Browser example[edit]

The combination of proxychains and Tor Browser does currently not work. Someone needs to Contribute by figuring this out. Otherwise this will not be possible for a very long time. See forum discussion [archive].

First, you must remove Tor Browser proxy settings before you can combine it with a proxifier.

Introduction

This configuration results in Tor Browser no longer using proxy settings. With no proxy set, Tor Browser uses the (VM) system's default networking. This is identical to any other application inside Whonix-Workstation ™ that has not been explicitly configured to use Tor via socks proxy settings or a socksifier. This setting is also called transparent torification. [30] [31]

Note: This action will break both Stream Isolation for Tor Browser and Tor Browser's tab isolation by socks user name [archive]. This worsens the web fingerprint and leads to pseudonymous (not anonymous) connections. To mitigate these risks, consider using More than one Tor Browser in Whonix ™, or preferably Multiple Whonix-Workstation ™.

To enable transparent torification (no proxy setting), set the TOR_TRANSPROXY=1 environment variable. There are several methods, but the simplest is the /etc/environment Method.

Note: Choose only one method to enable transparent torification.

For other methods with finer granulated settings, please press on Expand on the right.

Command Line Method

Navigate to the Tor Browser folder.

cd ~/tor-browser_en-US

Every time Tor Browser is started, run the following command to set the TOR_TRANSPROXY=1 environment variable.

TOR_TRANSPROXY=1 ./start-tor-browser.desktop

start-tor-browser Method

This only applies to a single instance of the Tor Browser folder that is configured. This method may not persist when Tor Browser is updated.

Find and open start-tor-browser in the Tor Browser folder with an editor.

This is most likely found in ~/tor-browser_en-US/Browser/start-tor-browser below #!/usr/bin/env bash.

Set.

export TOR_TRANSPROXY=1

/etc/environment Method

This will apply to the whole environment, including any possible custom locations of Tor Browser installation folders. [32]

Open file /etc/environment in an editor with root rights.

This box uses sudoedit for better security [archive]. This is an example and other tools can also achieve the same goal. If this example does not work for you or if you are not using Whonix ™, please refer to this link.

sudoedit /etc/environment

Add the following line.

TOR_TRANSPROXY=1
## newline at the end

Save and reboot.

Tor Browser Settings Changes

This step is required since Tor Browser 10. [33]

1. Tor Browser → URL bar → Type: about:config → Press Enter key. → search for and modify

2. network.dns.disabled → set to false

3. extensions.torbutton.launch_warning → set to false

Undo

Reverting this change is undocumented. Simply unsetting that environment variable will not work due to Tor Browser limitations. The easiest way to undo this setting is to install a fresh instance of Tor Browser (please contribute to these instructions)!

Ignore Tor Button's Open Network Settings
Whonix ™ has disabled the Open Network Settings... menu option in Tor Button. Read the footnote for further information. [34]

Then try this command.

proxychains ~/tor-browser_en-US/start-tor-browser

Might be also interesting:


Transparent Proxying Method[edit]

Introduction[edit]

Advanced users only!

To make clear, what this is about. Whonix-Gateway ™ is already serving as a Transparent Proxy [35], which means, that all applications not explicitly configured [36] to use a SocksPort, can connect through Tor without any settings. This section is about configuring Whonix-Workstation ™ also to act as a Transparent Proxy [37]. Use case: a user wants to ensure all traffic goes through Tor (by using Whonix-Gateway ™) and want to additionally ensure, all traffic goes through a proxy choosen by the user after the Tor link, i.e. user → Tor → proxy → internet.

[38]

You always have to keep in mind, which kind of data and which kind of proxy you are using. There are CGIproxies, http(s) proxies and socks4/4a/5 proxies.

In case you redirect the network layer directly with iptables, you need a TransPort. Unfortunately very few applications, do offer a TransPort. For example, Tor supports a TransPort. In most other cases, you need to translate the different kinds of data.

Due to the nature of Transparent Proxying, we need to redirect with iptables and end up with a "Trans data stream". Because most proxies are either http or socks we need to translate this. Below we discuss a few tools which help here, not all are required, depending on what you want to do.

Required reading:

Tools[edit]

Tor is a socks proxy and also has a TransPort. Unfortunately, Tor can not be directly used as a http proxy. You must also keep in mind, that Tor does not support UDP, although it offers a DnsPort.

redsocks [archive] can also accept "Trans data streams" and can forward them to https, socks4 and socks5 proxies. If you were to use a http proxy (no https, without connect-method, see proxy article), you could access only http sites, no https sites. Rather redsocks can convert UDP DNS queries to TCP DNS queries.

DNS resolution[edit]

The complication (and also advantage/feature) with transparent proxying is, that the internet application (browser, etc.) is not aware of the proxy. Therefore the internet application will attempt to do the DNS resolution itself using the system, not using the proxy. The DNS requests also must be considered. Since Tor does not support UDP, we have to transmit DNS queries via TCP.

It is impossible to resolve DNS directly on the proxy, when using the proxy as a transparent proxy, see Transparent Proxying Method for explanation. You need an extra DNS server, which answers over TCP.

You have several options to resolve DNS.

Either leave the setup as it is, Tor's DnsPort and therefore the Tor exit relays will still do the DNS requests. (See DNS rule #1.) This is probably not what you want, since you wanted to cloak your identity with an additional proxy after Tor.

Alternatively you can use a public DNS resolver. The instructions for Secondary DNS Resolver#DNSCrypt by OpenDNS should work out of the box (tested). (See DNS rule #2.)

All DNS resolvers [39] should work, as long TCP is supported and as long you are querying a TCP enabled DNS server. [40] [41] [42] [43]

Read the DNS related warnings.

Prevent Bypassing the Tunnel-Link[edit]

Ambox warning pn.svg.png

  • Apply the following steps to avoid unexpected results such as broken connectivity and/or traffic bypassing the tunnel-link and only going through Tor.
  • Qubes-Whonix ™ exception: There is one tunnel configuration where Qubes-Whonix ™ users are better placed. When a separate tunnel-link VM is used between anon-whonix and sys-whonix (anon-whonixTunnel-linksys-whonix), these connections will fail without the following modifications.

Introduction
Disabling stream isolation will prevent bypassing of the tunnel-link. By default, many pre-installed applications are configured for Stream Isolation in Whonix ™. These specific applications are configured to use Tor SocksPorts, instead of Tor's TransPort.

All applications which are configured to use Tor SocksPorts are not tunneled through the tunnel-link, but instead they are only tunneled through Tor. The reason is the following configuration does not touch local connections to 10.152.152.10, which is the Whonix-Gateway ™. Therefore, all Tor Browser proxy settings must be removed if attempting to tunnel Tor Browser via the route UserTorTunnel-linkInternet (or similar); see below for instructions.

Deactivate uwt Wrappers

The following instructions permanently deactivate all uwt wrappers and remove stream isolation for uwt-wrapped applications system-wide. Consequently, all uwt-wrapped applications revert to the default system networking configuration.

For more granular control of uwt wrapper deactivation, see: Deactivate uwt Stream Isolation Wrapper.

Open file /etc/uwt.d/50_user.conf in an editor with root rights.

This box uses sudoedit for better security [archive]. This is an example and other tools can also achieve the same goal. If this example does not work for you or if you are not using Whonix ™, please refer to this link.

sudoedit /etc/uwt.d/50_user.conf

Add.

uwtwrapper_global="0"

Save and exit.


Tor Browser Remove Proxy Settings

Introduction

This configuration results in Tor Browser no longer using proxy settings. With no proxy set, Tor Browser uses the (VM) system's default networking. This is identical to any other application inside Whonix-Workstation ™ that has not been explicitly configured to use Tor via socks proxy settings or a socksifier. This setting is also called transparent torification. [44] [45]

Note: This action will break both Stream Isolation for Tor Browser and Tor Browser's tab isolation by socks user name [archive]. This worsens the web fingerprint and leads to pseudonymous (not anonymous) connections. To mitigate these risks, consider using More than one Tor Browser in Whonix ™, or preferably Multiple Whonix-Workstation ™.

To enable transparent torification (no proxy setting), set the TOR_TRANSPROXY=1 environment variable. There are several methods, but the simplest is the /etc/environment Method.

Note: Choose only one method to enable transparent torification.

For other methods with finer granulated settings, please press on Expand on the right.

Command Line Method

Navigate to the Tor Browser folder.

cd ~/tor-browser_en-US

Every time Tor Browser is started, run the following command to set the TOR_TRANSPROXY=1 environment variable.

TOR_TRANSPROXY=1 ./start-tor-browser.desktop

start-tor-browser Method

This only applies to a single instance of the Tor Browser folder that is configured. This method may not persist when Tor Browser is updated.

Find and open start-tor-browser in the Tor Browser folder with an editor.

This is most likely found in ~/tor-browser_en-US/Browser/start-tor-browser below #!/usr/bin/env bash.

Set.

export TOR_TRANSPROXY=1

/etc/environment Method

This will apply to the whole environment, including any possible custom locations of Tor Browser installation folders. [46]

Open file /etc/environment in an editor with root rights.

This box uses sudoedit for better security [archive]. This is an example and other tools can also achieve the same goal. If this example does not work for you or if you are not using Whonix ™, please refer to this link.

sudoedit /etc/environment

Add the following line.

TOR_TRANSPROXY=1
## newline at the end

Save and reboot.

Tor Browser Settings Changes

This step is required since Tor Browser 10. [47]

1. Tor Browser → URL bar → Type: about:config → Press Enter key. → search for and modify

2. network.dns.disabled → set to false

3. extensions.torbutton.launch_warning → set to false

Undo

Reverting this change is undocumented. Simply unsetting that environment variable will not work due to Tor Browser limitations. The easiest way to undo this setting is to install a fresh instance of Tor Browser (please contribute to these instructions)!

Ignore Tor Button's Open Network Settings
Whonix ™ has disabled the Open Network Settings... menu option in Tor Button. Read the footnote for further information. [48]


Deactivate Miscellaneous Proxy Settings

On the Stream Isolation page, there is a list of applications that are pre-configured to use socks proxy settings via application configuration files. To disable this the Whonix ™ system default must be removed from the application's settings.

TODO: document and expand.

Remove proxy settings for APT repository files.

1. If you previously onionized any repositories, that has to be undone; see Onionizing Repositories.

2. Remove any mention of tor+ in file /etc/apt/sources.list (if it was previously configured; that file is empty by default in Whonix ™ / Kicksecure) or any file in folder /etc/apt/sources.list.d.

3. Open file /etc/apt/sources.list /etc/apt/sources.list.d/* in an editor with root rights.

This box uses sudoedit for better security [archive]. This is an example and other tools can also achieve the same goal. If this example does not work for you or if you are not using Whonix ™, please refer to this link.

sudoedit /etc/apt/sources.list /etc/apt/sources.list.d/*

4. Remove any mention of tor+.

The process of removing proxy settings from APT repository files is now complete.

Remove proxy settings for Tor Browser Downloader by Whonix ™.

Open file /etc/torbrowser.d/50_user.conf in an editor with root rights.

This box uses sudoedit for better security [archive]. This is an example and other tools can also achieve the same goal. If this example does not work for you or if you are not using Whonix ™, please refer to this link.

sudoedit /etc/torbrowser.d/50_user.conf

Paste. [49] [50]

TB_NO_TOR_CON_CHECK=1
CURL_PROXY="--fail"

Save.

For some applications, this is impossible:

These applications can only talk to Tor Onion Services directly and cannot be configured to use the system default. Therefore you can only deactivate sdwdate and/or not use applications like OnionShare and Ricochet IM.

How to setup proxy tunnel-link after Tor (User→Tor→Proxy→Internet)[edit]

Unfinished!
Advanced users only!

Everything on Whonix-Workstation ™.

Get a working proxy and test (with any of the above methods) if it works reliable.

Install redsocks.

sudo apt install redsocks

Enable redsocks autostart.

Open file /etc/default/redsocks in an editor with root rights.

This box uses sudoedit for better security [archive]. This is an example and other tools can also achieve the same goal. If this example does not work for you or if you are not using Whonix ™, please refer to this link.

sudoedit /etc/default/redsocks

Look for.

START=no

And replace it with.

START=yes

Configure redsocks by editing /etc/redsocks.conf to your needs.

Open file /etc/redsocks.conf in an editor with root rights.

This box uses sudoedit for better security [archive]. This is an example and other tools can also achieve the same goal. If this example does not work for you or if you are not using Whonix ™, please refer to this link.

sudoedit /etc/redsocks.conf

Under.

redsocks {

You have to edit.

        ip = 127.0.0.1;
        port = 1080;
        type = socks5

To your needs.

Start redsocks.

sudo service redsocks start

Create a file fw.bsh.

And use the following firewall rules.

#!/bin/bash
## These iptables rules redirect the traffic for all users,
## including root, with the exception of the user redsocks,
## through the proxy.

## TODO: these iptables rules need review.
## TODO: use iptables default policy drop.

## Choose either DNS rule #1 or DNS rule #2.

## For debugging/testing use this command in console.
## tail -f /var/log/syslog

## Flush old rules.
iptables -F
iptables -t nat -F
iptables -X

## Allow unlimited traffic on the loopback interface.
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
iptables -A OUTPUT --dst 127.0.0.1 -j ACCEPT

## Established incoming connections are accepted.
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT

## Established outgoing connections are accepted.
iptables -A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT

## DNS rule #1.
## Allow DNS directly through {{gateway_product_name}}.
#iptables -A OUTPUT --dst 10.152.152.10 -p udp --dport 53 -j ACCEPT

## DNS rule #2.
## For DNSCrypt set /etc/resolv.conf to
## nameserver 127.0.0.1
##
## sudo dnscrypt-proxy --tcp-only --user=user
##
## DNSCrypt listening on port 53
iptables -t nat -A OUTPUT --dst 127.0.0.1 -p udp --dport 53 -j ACCEPT
iptables -t nat -A OUTPUT --dst 127.0.0.1 -p tcp --dport 53 -j ACCEPT

## redsocks must be allowed to establish direct connections.
iptables -A OUTPUT -j ACCEPT -m owner --uid-owner redsocks
iptables -t nat -A OUTPUT -j ACCEPT -m owner --uid-owner redsocks

## Redirect remaining traffic to redsocks.
iptables -t nat -A OUTPUT -p tcp -j REDIRECT --to-port 12345

## TODO: UDP rule untested.
#iptables -t nat -A OUTPUT -p udp -j REDIRECT --to-port 10053

## Log blocked traffic for debugging.
iptables -A OUTPUT -j LOG --log-level 4 --log-prefix "iptables: "

## Reject all other traffic.
iptables -A OUTPUT -j REJECT

Make the firewall script executable.

sudo chmod +x fw.bsh

Apply the firewall rules.

sudo fw.bsh


Footnotes[edit]

  1. Like the Tor, JonDonym or I2P software.
  2. TCP or DNS
  3. Depends if the application has any proxy bypass bugs.
  4. Depends on how bug free the socksifier is.
  5. Because redirection happens at the iptables level, not at the application level.
  6. See #DNS_resolution.
  7. Questionable if that adds anything. See: Aren't 10 proxies (proxychains) better than Tor with only 3 hops? - proxychains vs Tor
  8. Would require adding such a feature to redsocks.
  9. TB_NO_TOR_CON_CHECK=1 needs to be set because there is no filtered Tor ControlPort access when Whonix ™ tunnel firewall is enabled, which would break tb-updater's Tor connectivity check.
  10. By tb-updater default, if unset, variable CURL_PROXY will be dynamically set to a Tor SocksPort on Whonix-Gateway ™. For example to CURL_PROXY="--proxy socks5h://user:password@10.137.6.1:9115".
    By utilizing a curl parameter we are using anyhow -- CURL_PROXY="--fail" -- the environment variable can be disabled even if it is technically still set. This will result in downloading via the system's default networking.
  11. This term was coined in context of a Tor Transparent Proxy [archive] (.onion [archive]). It acts as a simple gateway that routes all connections through Tor, but does not provide Stream Isolation.
  12. If these settings are changed, Tor Button would previously show a red sign and state "Tor Disabled" when a mouse was hovered over it.
  13. Unless this environment variable is manually unset before starting Tor Browser.
  14. The regular Tor Browser Bundle from The Tor Project (without Whonix ™) allows networking settings to changed inside Tor via the Open Network Settings menu option. It has the same effect as editing Tor's config file torrc. In Whonix ™, the environment variable export TOR_NO_DISPLAY_NETWORK_SETTINGS=1 has been set [archive] to disable the Tor BrowserOpen Network Settings... menu item. It is not useful and confusing to have in the Whonix-Workstation ™ because:
    • In Whonix ™, there is only limited access to Tor's control port (see Dev/CPFP for more information).
    • For security reasons, Tor must be manually configured in /usr/local/etc/torrc.d/50_user.conf on Whonix-Gateway ™, and not from Whonix-Workstation ™ (see VPN/Tunnel support for more information).
  15. TB_NO_TOR_CON_CHECK=1 needs to be set because there is no filtered Tor ControlPort access when Whonix ™ tunnel firewall is enabled, which would break tb-updater's Tor connectivity check.
  16. By tb-updater default, if unset, variable CURL_PROXY will be dynamically set to a Tor SocksPort on Whonix-Gateway ™. For example to CURL_PROXY="--proxy socks5h://user:password@10.137.6.1:9115".
    By utilizing a curl parameter we are using anyhow -- CURL_PROXY="--fail" -- the environment variable can be disabled even if it is technically still set. This will result in downloading via the system's default networking.
  17. Using .anondist-orig, i.e. /usr/bin/wget.anondist-orig will circumvent the wget uwt wrapper.
  18. For testing, you could compare the IP shown by the above command with the next one. If you didn't disable the wget uwt wrapper, the following command will most likely fetch another IP, because still using Stream Isolation. Using Tor's TransPort.
    (/usr/bin/wget.anondist-orig original non-uwt-wrapped version)
    wget.anondist-orig https://check.torproject.org

  19. For further explanation only... If you disabled wget's uwt wrapper, to use Tor's TransPort, you could use the following command.
    wget https://check.torproject.org

  20. This term was coined in context of a Tor Transparent Proxy [archive] (.onion [archive]). It acts as a simple gateway that routes all connections through Tor, but does not provide Stream Isolation.
  21. If these settings are changed, Tor Button would previously show a red sign and state "Tor Disabled" when a mouse was hovered over it.
  22. Unless this environment variable is manually unset before starting Tor Browser.
  23. The regular Tor Browser Bundle from The Tor Project (without Whonix ™) allows networking settings to changed inside Tor via the Open Network Settings menu option. It has the same effect as editing Tor's config file torrc. In Whonix ™, the environment variable export TOR_NO_DISPLAY_NETWORK_SETTINGS=1 has been set [archive] to disable the Tor BrowserOpen Network Settings... menu item. It is not useful and confusing to have in the Whonix-Workstation ™ because:
    • In Whonix ™, there is only limited access to Tor's control port (see Dev/CPFP for more information).
    • For security reasons, Tor must be manually configured in /usr/local/etc/torrc.d/50_user.conf on Whonix-Gateway ™, and not from Whonix-Workstation ™ (see VPN/Tunnel support for more information).
  24. Might be also interesting: Advanced Security Guide#More than one Tor Browser in Whonix ™
  25. https://gitlab.torproject.org/legacy/trac/-/wikis/doc/torsocks#WorkaroundforIPv6leakbug [archive]
  26. Advanced. Recommendation: Why not use Tor stream isolation for the proxychains connection?
    [ProxyList]
    ## add proxy here ...
    ## meanwhile
    ## defaults set to "tor"
    #socks4 127.0.0.1 9050
    socks5 10.152.152.10 9152
    socks5 x.x.x.x xxxx
    
  27. For testing, you could compare the IP shown by the above command with the next one. If you didn't disable the wget uwt wrapper, the following command will most likely fetch another IP, because still using Stream Isolation. Using Tor's TransPort. (/usr/bin/wget.anondist-orig original non-uwt-wrapped version)
    wget.anondist-orig https://check.torproject.org

  28. This term was coined in context of a Tor Transparent Proxy [archive] (.onion [archive]). It acts as a simple gateway that routes all connections through Tor, but does not provide Stream Isolation.
  29. If these settings are changed, Tor Button would previously show a red sign and state "Tor Disabled" when a mouse was hovered over it.
  30. Unless this environment variable is manually unset before starting Tor Browser.
  31. The regular Tor Browser Bundle from The Tor Project (without Whonix ™) allows networking settings to changed inside Tor via the Open Network Settings menu option. It has the same effect as editing Tor's config file torrc. In Whonix ™, the environment variable export TOR_NO_DISPLAY_NETWORK_SETTINGS=1 has been set [archive] to disable the Tor BrowserOpen Network Settings... menu item. It is not useful and confusing to have in the Whonix-Workstation ™ because:
    • In Whonix ™, there is only limited access to Tor's control port (see Dev/CPFP for more information).
    • For security reasons, Tor must be manually configured in /usr/local/etc/torrc.d/50_user.conf on Whonix-Gateway ™, and not from Whonix-Workstation ™ (see VPN/Tunnel support for more information).
  32. anonymizing middlebox
  33. by uwt socksifier or proxy settings
  34. local redirection
  35. torproject.org wiki version 129 [archive] contains an old example using privoxy, JonDo and httpsdnsd. The new example uses redsocks and is simpler.
  36. https://en.wikipedia.org/wiki/Comparison_of_DNS_server_software [archive]
  37. You can't simply add another public DNS resolver (i.e. OpenDNS or Google) to /etc/resolv.conf in Whonix-Workstation ™ (i.e. Tor → public DNS resolver), it would have no effect, as explained under Whonix-Workstation ™ is Firewalled.
  38. Also Secondary DNS Resolver#httpsdnsd by JonDos might work, but you'd need to make some changes (use httpsdnsd as a system wide, Whonix-Workstation ™ wide, DNS resolver, not just for a specific user account).
  39. DNSCrypt and httpsdnsd add the advantage, that neither the proxy nor the Tor exit relay can sniff or manipulate your DNS requests, since they are encrypted and authenticated.
  40. Or perhaps also ttdnsd [archive] with Google could work.
  41. This term was coined in context of a Tor Transparent Proxy [archive] (.onion [archive]). It acts as a simple gateway that routes all connections through Tor, but does not provide Stream Isolation.
  42. If these settings are changed, Tor Button would previously show a red sign and state "Tor Disabled" when a mouse was hovered over it.
  43. Unless this environment variable is manually unset before starting Tor Browser.
  44. The regular Tor Browser Bundle from The Tor Project (without Whonix ™) allows networking settings to changed inside Tor via the Open Network Settings menu option. It has the same effect as editing Tor's config file torrc. In Whonix ™, the environment variable export TOR_NO_DISPLAY_NETWORK_SETTINGS=1 has been set [archive] to disable the Tor BrowserOpen Network Settings... menu item. It is not useful and confusing to have in the Whonix-Workstation ™ because:
    • In Whonix ™, there is only limited access to Tor's control port (see Dev/CPFP for more information).
    • For security reasons, Tor must be manually configured in /usr/local/etc/torrc.d/50_user.conf on Whonix-Gateway ™, and not from Whonix-Workstation ™ (see VPN/Tunnel support for more information).
  45. TB_NO_TOR_CON_CHECK=1 needs to be set because there is no filtered Tor ControlPort access when Whonix ™ tunnel firewall is enabled, which would break tb-updater's Tor connectivity check.
  46. By tb-updater default, if unset, variable CURL_PROXY will be dynamically set to a Tor SocksPort on Whonix-Gateway ™. For example to CURL_PROXY="--proxy socks5h://user:password@10.137.6.1:9115".
    By utilizing a curl parameter we are using anyhow -- CURL_PROXY="--fail" -- the environment variable can be disabled even if it is technically still set. This will result in downloading via the system's default networking.


Fosshost is sponsors Kicksecure ™ stage server 100px
Fosshost About Advertisements

Search engines: YaCy | Qwant | ecosia | MetaGer | peekier | Whonix ™ Wiki


Follow: 1024px-Telegram 2019 Logo.svg.png Iconfinder Apple Mail 2697658.png Twitter.png Facebook.png Rss.png Reddit.jpg 200px-Mastodon Logotype (Simple).svg.png

Support: Discourse logo.png

Donate: Donate Bank Wire Paypal Bitcoin accepted here Monero accepted here Contribute

Whonix donate bitcoin.png Monero donate Whonix.png United Federation of Planets 1000px.png

Twitter-share-button.png Facebook-share-button.png Telegram-share.png link=mailto:?subject=Tunnels/Connecting to Tor before a proxy&body=../Tunnels/Connecting_to_Tor_before_a_proxy link=https://reddit.com/submit?url=../Tunnels/Connecting_to_Tor_before_a_proxy&title=Tunnels/Connecting to Tor before a proxy link=https://news.ycombinator.com/submitlink?u=../Tunnels/Connecting_to_Tor_before_a_proxy&t=Tunnels/Connecting to Tor before a proxy link=https://mastodon.technology/share?message=Tunnels/Connecting to Tor before a proxy%20../Tunnels/Connecting_to_Tor_before_a_proxy&t=Tunnels/Connecting to Tor before a proxy

Follow us on Twitter.png Twitter / Facebook.png Facebook.

https link onion link Priority Support | Investors | Professional Support

Whonix | © ENCRYPTED SUPPORT LP | Heckert gnu.big.png Freedom Software / Osi standard logo 0.png Open Source (Why?)

The personal opinions of moderators or contributors to the Whonix ™ project do not represent the project as a whole.

By using our website, you acknowledge that you have read, understood and agreed to our Privacy Policy, Cookie Policy, Terms of Service, and E-Sign Consent.