Jump to: navigation, search

Tunnels/Connecting to Tor before a VPN

This page contains changes which are not marked for translation.


Connecting to Tor before a VPN


User -> Tor -> VPN -> Internet


Increased Threat of Identity Correlation[edit]

By design, a VPN routes all your applications - those without any proxy settings - through the VPN. You may not want this, as explained below. To circumvent that, you should use this Whonix-Workstation only for the particular application you want to route through the tunnel-link. You are advised to use Multiple Whonix-Workstations.

Prevent Bypassing of the Tunnel-Link[edit]

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, if for example you wish to tunnel Tor Browser via the route User -> Tor -> Tunnel-link -> Internet, all proxy settings from Tor Browser need to be removed. 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.

If you want more granular control of uwt wrapper deactivation, see Stream_Isolation#Deactivate_uwt_Stream_Isolation_Wrapper.

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

If you are using a graphical Whonix or Qubes-Whonix, run.

kdesudo kwrite /etc/uwt.d/50_user.conf

If you are using a terminal-only Whonix, run.

sudo nano /etc/uwt.d/50_user.conf

Add.

uwtwrapper_global="0"

Save and exit.


Tor Browser Remove Proxy Settings

Introduction

This configuration causes Tor Browser to no longer use proxy settings. With no proxy, Tor Browser uses the (VM) system's default networking. This is identical to any other application inside the 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. [1]

Note: This action will break both the Stream Isolation for Tor Browser and Tor Browser's tab isolation by socks user name. This worsens the web fingerprint and causes the user to be pseudonymous, rather than anonymous. To mitigate these risks, consider using More than one Tor Browser in Whonix, or better yet, Multiple Whonix-Workstations.

If these settings are changed, expect Tor Button to show a red sign and state "Tor Disabled" if a mouse is hovered over it.

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

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

<span id="
od"></span> 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 in an editor.

This is most likely 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. [2]

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

If you are using a graphical Whonix or Qubes-Whonix, run.

kdesudo kwrite /etc/environment

If you are using a terminal-only Whonix, run.

sudo nano /etc/environment

Add the following line.

TOR_TRANSPROXY=1

Save and reboot.

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. [3]


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 Tor Browser Downloader by Whonix.

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

If you are using a graphical Whonix or Qubes-Whonix, run.

kdesudo kwrite /etc/torbrowser.d/50_user.conf

If you are using a terminal-only Whonix, run.

sudo nano /etc/torbrowser.d/50_user.conf

Paste. [4] [5]

TB_NO_TOR_CON_CHECK=1
CURL_PROXY="--fail"

Save.

For some applications, this is impossible:


These applications can only talk to Tor Hidden Services directly and cannot be configured to use the system default. You can only deactivate sdwdate and/or not use Ricochet IM.

Use a Fail Closed Mechanism[edit]

A general problem with VPNs is that connections often fail to remain open. This means the VPN connection suddenly closes, leaving the user directly connected to the Internet (without first tunneling through the VPN). This is not a Whonix-specific problem. VPN servers and software can occasionally fail without prior notice. Therefore, if the VPN is unreachable or the connection breaks down for whatever reason, in most cases the user will continue to connect to the Internet without the VPN.

One of the key benefits of Whonix is that when a VPN connection fails, protection is still provided by the Tor process. In this instance, the Whonix-Workstation will seamlessly continue to make "direct" connections through Tor. Failure of the VPN tunnel may be inconsequential if a VPN is only used to circumvent Tor censorship. On the other hand, if VPN use is intended to improve security, then it must be configured so that if/when the VPN connection fails, all connections between the outside world and the computer are halted.

Instructions below include a fail closed mechanism.


VPN Client Choice[edit]

Use OpenVPN.

Using bitmask for this use case is not possible. In other words, you cannot use user -> Tor -> bitmask -> Internet. [6]

Other VPN clients are unsupported. We are not aware of any sane VPN client choices besides OpenVPN.


Setup Tor before a VPN (User -> Tor -> VPN -> Internet)[edit]

Introduction[edit]

Two methods.


Separate VPN-Gateway[edit]

A separate VPN-Gateway between Whonix-Gateway and Whonix-Workstation, i.e. Whonix-Workstation -> VPN-Gateway -> Whonix-Gateway.

Qubes-Whonix only! Non-Qubes-Whonix is unsupported!

User -> Tor -> VPN -> Internet

These "Separate VPN-Gateway" instructions are new. You might be one of the first users. You might run into minor issues. Please test and report how it went.

Create a new ProxyVM called for example VPN-Gateway.

Set the NetVM of the VPN-Gateway to Whonix-Gateway (commonly called sys-whonix).

Note that UDP-style VPN connections are incompatible with Tor; the VPN must be configured to use TCP. [7] To do that, add proto tcp to the VPN configuration file /rw/config/vpn/openvpn-client.ovpn. Most, but not all VPN providers support this configuration.

Setup the VPN-Gateway as per Qubes VPN documentation for ProxyVMs. It is also highly recommended to setup the iptables firewall rules as described in Qubes VPN documentation to prevent clearnet traffic when the VPN breaks down. (In that cases, Whonix-Workstation (commonly called anon-whonix traffic would only go user -> Tor -> Internet as opposed to user -> Tor -> VPN -> Internet, which is what you want if you are reading this documentation chapter.

Check, that your VPN-Gateway is fully functional. Test connectivity from inside the VPN-Gateway.

In Whonix-Workstation (commonly called anon-whonix) you might want to apply instructions from above chapter #Prevent Bypassing the Tunnel-Link.

No DNS configuration required. System DNS should work out of the box. [8]

If you would use Tor Browser, it would show the following warning: Something Went Wrong!
Tor is not working in this browser.
This is because Tor Browser can no longer access Tor's ControPort (control-port-filter-proxy-python) on Whonix-Gateway.

For troubleshooting, see footnote. [9]

Done. It is recommended to run the related #Leak Tests.

Whonix user forum discussion:
https://forums.whonix.org/t/setup-a-vpn-in-proxyvm-over-sys-whonix

[10]


Inside Whonix-Workstation[edit]

Connect to your VPN using your preferred software *inside* the (Whonix-)Workstation.

Note that UDP-style VPN connections are incompatible with Tor; the VPN must be configured to use TCP. [7] To do that, add proto tcp to the VPN configuration file /etc/openvpn/openvpn.conf. Most, but not all VPN providers support this configuration.

User -> Tor -> VPN -> Internet

Whonix TUNNEL_FIREWALL vs standalone VPN-Firewall[edit]

When applying VPN instructions inside Whonix VMs, do not use the standalone VPN-Firewall. It is not required and is incompatible with the integrated Whonix TUNNEL_FIREWALL feature which is documented below.

Preparation[edit]

It is challenging to set up OpenVPN on Whonix with a secure, leak preventing Fail Closed Mechanism. For this reason, it is strongly recommended to learn how to set up OpenVPN on Debian stable (currently Jessie). The following steps are a simple overview of the process:

  1. Prepare a Debian stable VM.
  2. Install the Debian OpenVPN package: sudo apt-get install openvpn
  3. Research how to set up a VPN using OpenVPN on the command line. [11]
  4. Search for help with general VPN setup in the #VPN Setup chapter or on the TestVPN page. Help is available from various sources, and the VPN provider may also be of assistance.

Whonix 12 users may recall the variable VPN_SERVERS; it has been abolished for better security. [12]

Prerequisite Knowledge[edit]

Highly recommended reading and understanding before proceeding: Whonix Debian Packages

Firewall Settings[edit]

Modify Whonix-Workstation User Firewall Settings

Note: If no changes have yet been made to Whonix Firewall Settings, then the Whonix User Firewall Settings File /etc/whonix_firewall.d/50_user.conf appears empty (because it does not exist). This is expected.

If using Qubes-Whonix, complete these steps.
In Whonix-Workstation AppVM.

Make sure folder /rw/config/whonix_firewall.d exists.

sudo mkdir -p /rw/config/whonix_firewall.d

Open /rw/config/whonix_firewall.d/50_user.conf with root rights.

kdesudo kwrite /rw/config/whonix_firewall.d/50_user.conf

If using a graphical Whonix-Workstation, complete these steps.

Start Menu -> Applications -> Settings -> User Firewall Settings

If using a terminal-only Whonix-Workstation, complete these steps.

sudo nano /etc/whonix_firewall.d/50_user.conf

For more help, press on Expand on the right.

Note: The Whonix Global Firewall Settings File /etc/whonix_firewall.d/30_default.conf contains default settings and explanatory comments about their purpose. By default, the file is opened read-only and is not meant to be directly edited. Below, it is recommended to open the file without root rights. The file contains an explanatory comment on how to change firewall settings.

## Please use "/etc/whonix_firewall.d/50_user.conf" for your custom configuration,
## which will override the defaults found here. When Whonix is updated, this
## file may be overwritten.

See also Whonix modular flexible .d style configuration folders.

To view the file, follow these instructions.

If using Qubes-Whonix, complete these steps.

Qubes App Launcher (blue/grey "Q") -> Template: whonix-ws -> Whonix Global Firewall Settings

If using a graphical Whonix-Workstation, complete these steps.

Start Menu -> Applications -> Settings -> Global Firewall Settings

If using a terminal-only Whonix-Workstation, complete these steps.

nano /etc/whonix_firewall.d/30_default.conf

Add the following settings. You can skip comments (starting with #). Don't use ; for comments. [13] Likely you do not need to either uncomment (removing the # in front) or modify VPN_INTERFACE / LOCAL_NET.

WORKSTATION_FIREWALL=1
TUNNEL_FIREWALL_ENABLE=true

Save.

Reload Firewall[edit]

Reload Whonix-Workstation Firewall.

If you are using Qubes-Whonix, complete the following steps.

Qubes App Launcher (blue/grey "Q") -> Whonix-Workstation AppVM (commonly named anon-whonix) -> Reload Whonix Firewall

If you are using a graphical Whonix-Workstation, complete the following steps.

Start Menu -> Applications -> System -> Reload Whonix Firewall

If you are using a terminal-only Whonix-Workstation, run.

sudo whonix_firewall

sudoers configuration[edit]

Open /etc/sudoers.d/tunnel_unpriv in an editor with root rights.

If you are using a graphical Whonix or Qubes-Whonix, run.

kdesudo kwrite /etc/sudoers.d/tunnel_unpriv

If you are using a terminal-only Whonix, run.

sudo nano /etc/sudoers.d/tunnel_unpriv

Comment in the following and remove the single hashes (#) in front of all lines, but do not remove the double hashes (##). The edited file should look like this.

tunnel ALL=(ALL) NOPASSWD: /bin/ip
tunnel ALL=(ALL) NOPASSWD: /usr/sbin/openvpn *
Defaults:tunnel !requiretty

Save and exit.

Add.

Defaults:tunnel env_keep += script_type
Defaults:tunnel env_keep += dev

Save.

VPN Setup[edit]
Introduction[edit]

The following example uses the free Riseup VPN, because it is known to support TCP, UDP and SSL. However, any preferred VPN can be used.

Update: The Riseup "legacy" VPN may have been discontinued, as it no longer works for the author of these instructions. The Riseup replacement service (Bitmask) has not been tested.

Get VPN Certificate[edit]

Look at the riseup VPN help page for RiseupCA.pem and (right-click) download it. Store the certificate in /etc/openvpn/RiseupCA.pem

curl --tlsv1.2 --proto =https https://help.riseup.net/security/network-security/riseup-ca/RiseupCA.pem | sudo tee /etc/openvpn/RiseupCA.pem

VPN Credentials[edit]

For this step, a riseup.net account and Riseup account name is required. Go to https://user.riseup.net/users/riseupusername/vpn to obtain a VPN secret (VPN password). Below, replace "riseupusername" with the actual riseup user name, or just go to https://user.riseup.net, login and click on "VPN".

Open /etc/openvpn/auth.txt in an editor with root rights.

If you are using a graphical Whonix or Qubes-Whonix, run.

kdesudo kwrite /etc/openvpn/auth.txt

If you are using a terminal-only Whonix, run.

sudo nano /etc/openvpn/auth.txt

Add the actual user name and password.

riseupusername
vpnsecret

Save and exit.

VPN IP Address[edit]

Note: IP addresses are required, not DNS hostnames. Therefore, vpn.riseup.net cannot be used, but an IP address instead like 198.252.153.226. To discover the IP address, check with the provider or use nslookup on the host. For example, to verify the actual IP address of the vpn.riseup.net DNS server, run.

nslookup vpn.riseup.net
VPN Configuration File[edit]

Open /etc/openvpn/openvpn.conf in an editor with root rights.

If you are using a graphical Whonix or Qubes-Whonix, run.

kdesudo kwrite /etc/openvpn/openvpn.conf

If you are using a terminal-only Whonix, run.

sudo nano /etc/openvpn/openvpn.conf

Add.

Note: make sure to adjust the remote 198.252.153.226 80 variable in your config (unless you are using nyc.vpn.riseup.net as your VPN service). Replace the IP (198.252.153.226) and port (80) to match your VPN service.

##############################
## VPN provider specific settings ##
##############################
auth-user-pass auth.txt

## using nyc.vpn.riseup.net 80
remote 198.252.153.226 80

ca RiseupCA.pem

remote-cert-tls server

####################################
## TUNNEL_FIREWALL specific settings ##
####################################
client
dev tun0
persist-tun
persist-key

script-security 2
up "/etc/openvpn/update-resolv-conf script_type=up dev=tun0"
down "/etc/openvpn/update-resolv-conf script_type=down dev=tun0"

user tunnel
iproute /usr/bin/ip_unpriv

############################################
## Connecting to Tor before a VPN specific settings #
############################################

proto tcp

[14] [15]

Save.

install resolvconf[edit]

Update the package lists.

sudo apt-get update

Install resolvconf. [16]

sudo apt-get install resolvconf

Users preferring not to install resolvconf should read the footnotes. [17]

This will remove several Whonix meta packages. To find out what that is about and what the following command is good for, please read the prerequisite knowledge wiki page Whonix Debian Packages.

sudo aptitude keep-all

Next time you run whonixcheck you will get the following warning.

Whonix Meta Packages test Result: Whonix-Workstation detected that the meta package (non-)qubes-whonix-workstation is not installed

The background of this is also explained on the wiki page Whonix Debian Packages.

DNS Configuration[edit]

Open /usr/lib/tmpfiles.d/50_openvpn_unpriv.conf in an editor with root rights.

If you are using a graphical Whonix or Qubes-Whonix, run.

kdesudo kwrite /usr/lib/tmpfiles.d/50_openvpn_unpriv.conf

If you are using a terminal-only Whonix, run.

sudo nano /usr/lib/tmpfiles.d/50_openvpn_unpriv.conf

Add. [18]

d       /run/resolvconf 0775    root      tunnel    -       -
d       /run/resolvconf/interface         0775      root    tunnel    -    -

Save.

Adjust permissions. [18]

sudo chown --recursive root:tunnel /run/resolvconf
sudo chmod --recursive 775 /run/resolvconf

Open /etc/resolvconf/run/interface/original.resolvconf in an editor with root rights.

If you are using a graphical Whonix or Qubes-Whonix, run.

kdesudo kwrite /etc/resolvconf/run/interface/original.resolvconf

If you are using a terminal-only Whonix, run.

sudo nano /etc/resolvconf/run/interface/original.resolvconf

Comment everything out by adding a # in front of all entries. Alternatively, empty or delete that file. [19]

Save and exit.

Setup[edit]

Configuration Folder Permissions[edit]

Since OpenVPN will be run under user tunnel, that user requires read access to the folder /etc/openvpn.

sudo chown -R tunnel:tunnel /etc/openvpn
sudo chown -R tunnel:tunnel /var/run/openvpn
systemd setup[edit]

Create the OpenVPN systemd service file.

sudo cp /lib/systemd/system/openvpn@.service /lib/systemd/system/openvpn@openvpn.service

Enable the OpenVPN systemd service file.

sudo systemctl enable openvpn@openvpn

Start the OpenVPN systemd service.

sudo service openvpn@openvpn start

Check the OpenVPN systemd service status.

sudo service openvpn@openvpn status
resolvconf adjustments[edit]

Restart resolvconf. [20]

sudo service resolvconf restart
Verify DNS Settings[edit]

See current /etc/resolv.conf settings.

sudo cat /etc/resolv.conf

Should not include the following settings.[21]

nameserver 10.152.152.10

Should not include the following settings.[22]

nameserver 10.137.3.1
nameserver 10.137.3.254

Should include only the DNS server of your DNS provider. For example.

nameserver 10.5.0.1
whonixcheck[edit]

whonixcheck cannot work in this configuration out of the box. To unbreak it.

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

If you are using a graphical Whonix or Qubes-Whonix, run.

kdesudo kwrite /etc/whonix.d/50_user.conf

If you are using a terminal-only Whonix, run.

sudo nano /etc/whonix.d/50_user.conf

whonixcheck_skip_functions+=" check_tor_bootstrap "
whonixcheck_skip_functions+=" check_tor_socks_port_reachability "
whonixcheck_skip_functions+=" check_tor_socks_port "
whonixcheck_skip_functions+=" check_tor_trans_port "
whonixcheck_skip_functions+=" check_stream_isolation "
whonixcheck_skip_functions+=" download_whonix_news "

## {{ Alternative to disabling check_tor_trans_port.

## Make the Tor TransPort test work by simulating the Tor SocksPort test succeeded.
#CHECK_TOR_RESULT_SOCKS_PORT=0

## Do not warn if Tor was not detected. (Will be the VPN.)
#WHONIXCHECK_NO_EXIT_ON_TRANS_PORT_DETECTION_FAILURE=1

## }}

## {{ Alternative to download_whonix_news.

## Download news through system default.
#CURL_PROXY_WHONIX_NEWS="--fail"

## }}

Save.

Qubes specific[edit]

Placeholder. Ignore the Qubes specific chapter for now. TODO

When using a TemplateBasedVM, to persist these changes use the Qubes bind dirs mechanism.

sudo mkdir /rw/config/qubes-bind-dirs.d

Open /rw/config/qubes-bind-dirs.d/50_user.conf in an editor with root rights.

If you are using a graphical Whonix or Qubes-Whonix, run.

kdesudo kwrite /rw/config/qubes-bind-dirs.d/50_user.conf

If you are using a terminal-only Whonix, run.

sudo nano /rw/config/qubes-bind-dirs.d/50_user.conf

binds+=( '/etc/sudoers.d/tunnel_unpriv' )
binds+=( '/etc/openvpn' )
binds+=( '/lib/systemd/system/openvpn@openvpn.service' )
binds+=( '/etc/systemd/system/multi-user.target.wants/openvpn@openvpn.service' )

TODO: Does not work yet. Files need to exist first.

/usr/lib/qubes/bind-dirs.sh umount
/usr/lib/qubes/bind-dirs.sh
Test[edit]

Test ping to IP. Ping some IP. Ping google's DNS server or maybe better some server of your choice.

ping 8.8.8.8

Test DNS. DNS resolve some domain. Resolve check.torproject.org or maybe better some server of your choice.

nslookup check.torproject.org

Test DNS and output IP address.

whonixcheck_skip_functions="" \
CHECK_TOR_RESULT_SOCKS_PORT=0 \
WHONIXCHECK_NO_EXIT_ON_TRANS_PORT_DETECTION_FAILURE=1 \
whonixcheck --function check_tor_trans_port
Done[edit]

Done. If you have any issues, see below chapter #Troubleshooting. Once it is working, it is recommended to run the #Leak Tests.

Troubleshooting[edit]

You can skip this troubleshooting chapter unless any difficulties are encountered.

ip_unpriv vs ip-unpriv[edit]

There are two similar, yet distinct projects: standalone VPN-FIREWALL and Whonix TUNNEL_FIREWALL. Although both are alike, there is one difference that might be encountered. For instance, in chapter #VPN Configuration File:

  • Whonix TUNNEL_FIREWALL uses ip_unpriv (underscore)
  • Standalone VPN-FIREWALL uses ip-unpriv (hyphen)


Be sure to use the right version of ip unpriv according to whether the VPN-FIREWALL or Whonix TUNNEL_FIREWALL project is being used.

50_openvpn_unpriv.conf vs 50_openvpn-unpriv.conf[edit]

Like the example above:

  • Whonix TUNNEL_FIREWALL uses /usr/lib/tmpfiles.d/50_openvpn_unpriv.conf ip_unpriv (underscore)
  • Standalone VPN-FIREWALL uses /usr/lib/tmpfiles.d/50_openvpn-unpriv.conf ip-unpriv (hyphen)
Cannot ioctl TUNSETIFF[edit]
ERROR: Cannot ioctl TUNSETIFF tun: Operation not permitted (errno=1)

In openvpn.conf do not use.

dev tun

Use.

dev tun0
Dev tun Mismatch[edit]

In openvpn.conf do not use.

dev tun

Use.

dev tun0
/run/openvpn/openvpn.status Permission denied[edit]
Options error: --status fails with '/run/openvpn/openvpn.status': Permission denied

Do not start OpenVPN as root. Do not use sudo openvpn, because this will lead to permission issues. Files in the /run/openvpn folder are owned by root, so they cannot be overwritten by the user tunnel.

debug start[edit]

To debug start on the command line, run.

sudo /usr/sbin/openvpn --rmtun --dev tun0
sudo /usr/sbin/openvpn --mktun --dev tun0 --dev-type tun --user tunnel --group tunnel
cd /etc/openvpn/
sudo -u tunnel openvpn /etc/openvpn/openvpn.conf
Linux ip link set failed[edit]
Linux ip link set failed: external program exited with error status: 2

Use ip_unpriv as documented above.

DNS Configuration[edit]

This only applies if resolvconf is used.

Permissions on two directories may need to be manually changed if they are not automatically applied. Check if changes are necessary via the following command.

ls -al /run/resolvconf

If the output lists tunnel as having read / write / execute permissions for both /run/resolvconf and /run/resolvconf/interface, then nothing needs modification. If tunnel is not listed as a group for one or both of these directories, then permissions need to be changed. In that case, run.

sudo chown --recursive root:tunnel /run/resolvconf

Then set the necessary permissions.

sudo chmod --recursive 775 /run/resolvconf

In /run/resolvconf, resolv.conf may or may not be owned by tunnel, depending on whether the systemd service has already started. There is no need to modify permissions on this file, as the permissions will change when the service starts.

Terminology for Support Requests[edit]

Phrases such as "over Tor" are ambiguous. Please do not coin idiosyncratic words or phrases, otherwise this leads to confusion. Please use the same terms that are consistently referenced in documentation, such as:

  • How to Connect to a VPN Before Tor (User -> VPN -> Tor -> Internet).
  • How to Connect to Tor Before a VPN (User -> Tor -> VPN -> Internet).
  • And so on.


Always refer to the connection scheme when requesting support: User -> VPN -> Tor -> Internet or User -> Tor -> VPN -> Internet and so on.


Leak Tests[edit]

Introduction[edit]

We want to verify, that the traffic always goes User -> Tor -> VPN -> Internet and not only User -> Tor -> Internet. Therefore you should run the following related leak tests inside Whonix-Workstation. Test Tor Browser, a uwt wrapper deactivated application as well as a regular application for leaks.

regular application test[edit]

Same test as above, but use curl without pre-configured stream isolation.

UWT_DEV_PASSTHROUGH=1 curl --silent --tlsv1.2 --proto =https https://check.torproject.org | grep IP

[23] [24]

Should show something along the lines: Your IP address appears to be: xxx.xxx.xxx.xxx
Should show the IP of your VPN.

uwt wrapped application test[edit]

Connect to check.torproject.org.

curl --silent --tlsv1.2 --proto =https https://check.torproject.org | grep IP

[23] [25]

Browser IP Test[edit]

You can skip this test if you do not care about using Tor Browser through the VPN.

If you did correctly configure everything, test your setup. Open https://check.torproject.org in Tor Browser. It will tell you then "You are not using Tor." and you'll see your VPN's IP. In fact your VPN was tunneled through Tor first. (Because Whonix-Workstation can not make any non-Tor connections by design, everything is tunneled over Tor.)

DNS Leak Test[edit]

Other Leak Tests[edit]

If you are feeling awesome, you could also run more general leak tests that are not related to tunneling. However, these are more difficult to do and target developers rather than users. If you are interested, see leak tests.


Footnotes[edit]

  1. This term was coined in context of a Tor Transparent Proxy. It acts as a simple gateway that routes all connections through Tor, but does not provide Stream Isolation.
  2. Unless this environment variable is manually unset before starting Tor Browser.
  3. 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 to disable the TorButton -> Open 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 /etc/tor/torrc on the Whonix-Gateway, and not from the Whonix-Workstation (see VPN/Tunnel support for more information).
  4. 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.
  5. 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 using a curl parameter we are using anyhow, i.e. CURL_PROXY="--fail" we can in effect disable the environment variable even if it's technically still set. This will result in downloading by using the system's default networking.
  6. https://github.com/leapcode/bitmask_client/issues/1009
  7. 7.0 7.1 Tor#UDP
  8. Because a properly configured Qubes VPN-Gateway will be able to resolve DNS.
    • Check, that your VPN-Gateway is fully functional. Test connectivity from inside the VPN-Gateway.
    • Add a non-Whonix VM behind your VPN-Gateway. For example, add a debian based AppVM behind your VPN-Gateway. Figure out if the VPN-Gateway works at all before involving Whonix.
  9. Only proceed if this is successful. Do not post support requests regarding these instructions before completing this basic exercise.
  10. https://phabricator.whonix.org/T460
  11. That config file is a bash fragment.
  12. The /usr/bin/ip_unpriv wrapper script is being provided by the usabilty-misc package. The /etc/sudoers.d/tunnel_unpriv wrapper script is being provided by the usabilty-misc package. The /lib/systemd/system/openvpn@openvpn.service.d/50_unpriv.conf wrapper script is being provided by the usabilty-misc package.
  13. We must run OpenVPN as user 'tunnel', because that is the only user besides user clearnet that will be allowed to establish external connections when using Whonix Firewall setting VPN_FIREWALL=1.
  14. /etc/openvpn/update-resolv-conf uses resolvconf. resolvconf needs to be installed for the lines beginning with script-security, up, and down to function properly.
  15. In the /etc/openvpn/openvpn.conf file, change the following text.
    script-security 2
    up "/etc/openvpn/update-resolv-conf script_type=up dev=tun0"
    down "/etc/openvpn/update-resolv-conf script_type=down dev=tun0"
    

    To the following. Remove or comment out the lines beginning with "up" and "down", and change the 2 to a 1.

    script-security 1
    

    Open /etc/resolv.conf in an editor with root rights.

    If you are using a graphical Whonix or Qubes-Whonix, run.

    kdesudo kwrite /etc/resolv.conf

    If you are using a terminal-only Whonix, run.

    sudo nano /etc/resolv.conf

    Comment out.

    #nameserver 10.152.152.10
    

    Add.

    ## Riseup.net OpenVPN DNS server
    nameserver 172.27.100.1
    

    If Riseup is not being used, replace 172.27.100.1 with the virtual LAN IP address of the VPN provider's DNS server. If unsure, the VPN provider might provide it. Users can also try to infer it by running sudo route after successfully connecting to the VPN. The first destination default gateway should also function as a DNS server.

    Save and exit.

    Users who want to prevent /etc/resolv.conf being overwritten by other packages like DHCP or resolvconf should run.

    sudo chattr +i /etc/resolv.conf
    

    In order to revert this change, use -i.

    Ignore the /etc/resolv.conf instructions below.

  16. 18.0 18.1 Removeable in Whonix 14 since merged in usablity-misc package.
  17. This is done to prevent the old DNS server being used. For further discussion of this issue, see: https://github.com/adrelanos/vpn-firewall/issues/16
  18. So changes in /etc/resolvconf/run/interface/original.resolvconf from chapter #DNS Configuration take effect.
  19. These is the standard Whonix DNS server.
  20. These are standard Qubes DNS servers.
  21. 23.0 23.1 In case you have no functional system DNS, you could also alternatively just test TCP. The IP 138.201.14.212 might change. You can find out the current one by running the following command inside a VM that has functional system DNS. (Ideally inside a Whonix-Workstation.)
    nslookup check.torproject.org
    
  22. UWT_DEV_PASSTHROUGH=1 curl --silent --tlsv1.2 --proto =https -H 'Host: check.torproject.org' -k https://138.201.14.212 | grep IP
  23. curl --silent --tlsv1.2 --proto =https -H 'Host: check.torproject.org' -k https://138.201.14.212 | grep IP

Random News:

We are looking for maintainers and developers.


Impressum | Datenschutz | Haftungsausschluss

https | (forcing) onion
Share: Twitter | Facebook | Google+

This is a wiki. Want to improve this page? Help is welcome and volunteer contributions are happily considered! See Conditions for Contributions to Whonix, then Edit! IP addresses are scrubbed, but editing over Tor is recommended. Edits are held for moderation.

Whonix (g+) is a licensee of the Open Invention Network. Unless otherwise noted, the content of this page is copyrighted and licensed under the same Libre Software license as Whonix itself. (Why?)