Jump to: navigation, search

Connections between Whonix-Gateway and Whonix-Workstation

Introduction[edit]

This chapter is only important, if you do not use the Default/Download (host + VM + VM) version.
You should read it if you are using Physical Isolation, or for any custom, non-stock, configurations.

Basics[edit]

By default, Whonix assumes that Whonix-Gateway and Whonix-Workstation are connected by (virtual) LAN cable. Wireless technologies are not recommended as a malware compromised Whonix-Workstation could access (other) wireless access points and subsequently connect without Tor. Using a (virtual) cable enforces that Whonix-Workstation can only connect through Whonix-Gateway. For the same reason, connections to Whonix-Gateway over the internet are also not recommended.

By default, connections between Whonix-Workstation and Whonix-Gateway are neither authenticated nor encrypted. The above (virtual) LAN connection between Whonix-Workstation and Whonix-Gateway is assumed to be secure.[1] Adding authentication and/or encryption by default would further increase the complexity of Whonix, which is to be avoided as explained in earlier chapters.

If you want to run multiple Whonix-Workstations at the same time inside the same (virtual) isolated LAN, authentication should be added:

  • Inside virtual LANs:
    • Authentication is enough.
    • Encryption is not required. (When machines cannot be impersonated, MITM attacks are not possible from within the virtual LAN.)
  • Inside physical LANs:
    • If your threat model includes the possibility of a MITM attack, encryption is needed .


If you want to connect to a Whonix-Gateway over insecure, untrusted, or unknown foreign networks (internet):

  • Both authentication and encryption should be added.
    • Encryption is required to deny MITM eavesdropping.
    • Authentication validates the identity of the connecting machine.
      • Encryption solutions such as OpenVPN and ssh also provide authentication.


Motivation for secure Whonix-Gateway / Whonix-Workstation connections[edit]

Only applies to non-stock configurations: If you run multiple Whonix-Workstations simultaneously or want to connect to Whonix-Gateways over insecure or untrusted networks (internet):

A compromised Whonix-Workstation can impersonate the Whonix-Gateway, or any other Whonix-Workstation, within the same (virtual) LAN, perform active MITM attacks, or passively eavesdrop.

OpenVPN vs SSH[edit]

Encryption can be added using OpenVPN or SSH. SSH, but not OpenVPN, has the advantage of being able to still easily tunnel a VPN through Tor, later. If you don't plan to do so, OpenVPN is probably easier. SSH has the disadvantage of increased setup complexity in this use case - you are probably better off using OpenVPN.

Authenticated connections between Whonix-Gateway and Whonix-Workstation[edit]

ARP spoofing defense[edit]

This has only been quickly researched: From the Wikipedia article about ARP spoofing, it appears that Static ARP entries could be used to authenticate connections between Whonix-Gateway and Whonix-Workstation.

Using additional (isolated) network interfaces[edit]

Theoretical[edit]

(This chapter is actually not authentication, but solves the threat nonetheless.)

A workaround, when running all vm's on the same VirtualBox host:

  • One can enable additional Virtual Network Adapters with uniquely named internal virtual networks, inherently isolating up to 7 Whonix-Workstations per Whonix-Gateway, [2]


A workaround, for Whonix with Physical Isolation, where all possible connecting machines are trusted:

  • Whonix-Gateway inherently requires two network interfaces - external and internal. Additional physical and/or virtual LAN interfaces could be added. (Ensure no bridging takes place.)


Instructions[edit]

DRAFT! UNFINISHED!

If you would like to see the unfinished documentation, please press on expand on the right.

These instructions explain how to do it using VirtualBox.

For basic setup, see this forum thread:
https://forums.whonix.org/t/running-2-isolated-workstations-on-a-single-gateway/835

The original poster is on a good track already. Some more changes required.

On Whonix-Workstation in an additional isolated network.

Modify Whonix Network Configuration.

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

undocumented

If you are using a graphical Whonix-Gateway, complete the following steps:

kdesudo kate /etc/network/interfaces.d/30_non-qubes-whonix

If you are using a terminal-only Whonix-Gateway, complete the following steps:

sudo nano /etc/network/interfaces.d/30_non-qubes-whonix

Use these settings.

address 10.152.152.17
netmask 255.255.192.0
gateway 10.152.152.13

On Whonix-Gateway.

Modify Whonix Network Configuration.

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

undocumented

If you are using a graphical Whonix-Gateway, complete the following steps:

kdesudo kate /etc/network/interfaces.d/30_non-qubes-whonix

If you are using a terminal-only Whonix-Gateway, complete the following steps:

sudo nano /etc/network/interfaces.d/30_non-qubes-whonix

Add this.

auto eth2
iface eth2 inet static
       address 10.152.152.13
       netmask 255.255.192.0

Modify Whonix User Firewall Settings.

Note: Initially, if you have not made any changes to Whonix Firewall Settings, then Whonix User Firewall Settings File /etc/whonix_firewall.d/50_user.conf appears empty, because it does not exist. This is expected.

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

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

If you are using a graphical Whonix-Gateway, complete the following steps:

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

If you are using a terminal-only Whonix-Gateway, complete the following steps:

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

For more help, press on expand on the right.

Note: Whonix Global Firewall Settings File /etc/whonix_firewall.d/30_default.conf contains default settings and explanatory comments what these settings purpose. It gets opened read-only by default. By default you are not supposed to directly edit the file. Below, we recommend 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, complete the following steps.

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

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

If you are using a graphical Whonix-Gateway, complete the following steps:

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

If you are using a terminal-only Whonix-Gateway, complete the following steps:

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

And add additional interfaces to the firewall config.

INT_IF="\
eth1
eth2"

INT_TIF="$INT_IF"

Reload Whonix's firewall (or reboot).

sudo whonix_firewall

Restart networking.

sudo service networking restart

Perhaps NetworkManager is interfering and must be disabled.

Also the file /usr/share/tor/tor-service-defaults-torrc needs some changes. Tor needs to listen on the additional interfaces.

kdesudo kwrite /usr/share/tor/tor-service-defaults-torrc

Use this file:
https://github.com/Whonix/anon-gw-anonymizer-config/blob/tor_listen_on_all_interfaces/usr/share/tor/tor-service-defaults-torrc.anondist

[3]

Restart Tor.

sudo service tor restart

It will now loudly complain, that Tor is listening on all IPs that that may not be what you want. You can ignore this, because the external network interface is firewalled.

TODO: Explain what happens during upgrades.

Whonix-Workstation's whonixcheck / timesync / Tor Browser won't work. (Would need updated IP of the other gateway internal interface.) TODO: Expand.

Whonix-Workstation's TransPort access should be functional though. I.e. nslookup check.torproject.org and/or iceweasel should work.

Whonix-Custom-Workstations should work.


Encrypted and authenticated connections between Whonix-Gateway and Whonix-Workstation[edit]

Using SSH (not tested/recommended)[edit]

* DO NOT ALLOW SSH LOGINS![4]

Each Gateway and Workstation should have its own SSH account and certificate distributed to each machine to which it will connect.[5] Each Gateway and Workstations will need ssh installed and the service started. Workstations need to be configured to automatically reconnect - in case Whonix-Workstation starts before the Gateway, or restarts.[6] Workstations need to use the tunnel IP to connect to the Gateway. The Whonix-Gateway should only accept certificate authentication, and only forward or answer to Tor over the SSH tunnel. All Workstations must use the established SSH tunnel to the Gateway, redirect such network access to socks via tranSOCKS_ev or similar. The Whonix-Gateway firewall may need corresponding changes. Not impossible to use SSH for this - but intricate.

You may be better off using OpenVPN. However - OpenVPN is a full machine to machine connection, while ssh is easily port restricted.

Using OpenVPN[edit]

DRAFT! UNFINISHED!

If you would like to see the unfinished documentation, please press on expand on the right.

Right now only supports two modes/security domains:

  • Whonix-Workstations with the secret key (=trusted) and
  • other workstation with no key/vpn configured.

NOTE:

  • Transparent proxying doesn't seem to work at all, therefore you need to configure all applications to use socks ports.

On the gateway:

sudo -i
apt-get -y install openvpn

Create a new symmetric key

sudo -u user openvpn --genkey --secret /home/user/static.key

Copy key to workstation (Firewall needs to be disabled and openssh-server installed on Whonix-Workstation for this to work).

sudo -u user scp /home/user/static.key user@10.152.152.10:/home/user/static.key
mv /home/user/static.key /etc/openvpn/static.key
chown root:root /etc/openvpn/static.key
chmod 700 /etc/openvpn/static.key

Create server configuration.

echo "
user nobody
group nogroup
daemon
dev tun
ifconfig 10.8.0.1 10.8.0.2
secret /etc/openvpn/static.key" > /etc/openvpn/server.conf
service openvpn restart

Edit torrc.
TODO: only selectively change listening addresses. TransPort and optionally other SocksPorts have to remain available, if unauthenticated workstations are to be used. NOTE: we are using a hardcoded default IP here, if you are using non standard settings this will have to be edited.

ed -s /etc/tor/torrc <<< $',s/10.152.152.10/10.8.0.1/g\nw'

Edit /usr/local/bin/whonix_firewall.
TODO: Put this automatically where it actually belongs

echo '
# Allow openvpn in on port 1194
iptables -A INPUT -i $INT_IF -p udp --dport 1194 -j ACCEPT' >> /usr/local/bin/whonix_firewall
# TODO: replace hardcoded "eth1" with a wildcard
ed -s /usr/local/bin/whonix_firewall<<< $',s/INT_TIF=eth1/INT_TIF=tun0/g\nw'
/usr/local/bin/whonix_firewall

On the Workstation(s):

TODO: Disable/tweak the new firewall

sudo -i
mv /home/user/static.key /etc/openvpn/static.key
chown root:root /etc/openvpn/static.key
chmod 700 /etc/openvpn/static.key

Should be in the default installation.

apt-get --yes install --no-install-recommends torsocks
echo "
user nobody
group nogroup
daemon
remote 10.152.152.10
dev tun
ifconfig 10.8.0.2 10.8.0.1
secret /etc/openvpn/static.key" > /etc/openvpn/server.conf

Edit resolv.conf.

chattr -i /etc/resolv.conf
echo "nameserver 10.8.0.1" > /etc/resolv.conf
chattr +i /etc/resolv.conf

See Also[edit]

Footnotes / References[edit]

  1. Here, secure is an assumption that nothing within your (virtual) LAN will MITM attack anything else.
  2. "Four of the network cards can be configured in the "Network" section of the settings dialog in the graphical user interface of VirtualBox. You can configure all eight network cards on the command line via VBoxManage modifyvm"
  3. This likely should not be made the default version. Because... TODO: Explain.
  4. See: ssh login
  5. Internet search How to set up ssh keys, for example, for instructions.
  6. Consider: autossh

Random News:

Did you know that anyone can edit Whonix's wiki?


Impressum | Datenschutz | Haftungsausschluss

https | (forcing) onion
Share: Twitter | Facebook | Google+
This is a wiki. Want to improve this page? Help welcome, 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 above, content of this page is copyrighted and licensed under the same Free (as in speech) license as Whonix itself.