This page provides instructions for sandboxing the Linux build of Tor Browser Bundle using the [https://wiki.smartos.org/display/DOC/Home SmartOS hypervisor] with the [https://wiki.illumos.org/display/illumos/illumos+Home IllumOS kernel] such that the Browser is only able to access the `SocksPort` of a `tor` instance running in another security domain. We make use of native Solaris [https://wiki.smartos.org/display/DOC/Zones zones] for running `tor` and a firewall, and Solaris' [https://wiki.smartos.org/display/DOC/LX+Branded+Zones Linux-Branded Zones] (which emulate Linux system calls, and can run both x86 32-bit and 64-bit Linux binaries) for running Tor Browser. We also provide instructions for using the browser-based NoVNC client to access the sandboxed Tor Browser (eg, from another Tor Browser running locally).
'''The Linux Tor Browser binary runs just fine in a Linux zone on Solaris/SmartOS!'''
Our sandbox environment will have several components which will each be in their own zone. The Tor Browser will run with a X server created by vnc4server. A stealth authenticated onion service will expose an HTTP service via noVNC which will serve an HTML5 VNC client to the browser and it will connect to the zone running the Tor Browser vnc4server.
5 zones:
* firewall which performs filtering and NAT
* tor instance for Tor Browser
* tor instance for onion service (pointing at noVNC webserver)
* Tor Browser + vnc4server
* the webserver component of noVNC
== why? ==
* use of dtrace
* use of ZFS to take snapshots and rollback to previous snapshots
* if the browser is exploited, it won't be allowed to make non-tor connections (ala Whonix, Qubes, etc)
* superior isolation than Linux containers
* less overhead than Linux virtualization
* remote execution vulnerability not likely to exploit kernel since we aren't running the Linux kernel
== global zone configuration ==
I recommend that the global zone have several changes such as disabling ssh password login, changing the ssh listening port and using strict firewall rules.
my '''/usbkey/config''' looks like this:
{{{
admin_nic=MM:MM:MM:MM:MM:MM
admin_ip=dhcp
headnode_default_gateway=none
dns_resolvers=8.8.8.8,8.8.4.4
dns_domain=computer
ntp_hosts=0.pool.ntp.org
hostname=computer
root_authorized_keys_file=authorized_keys
etherstub="switch0"
}}}
firewall rules in '''/etc/ipf/ipf.conf'''; you'll have to change the rule for your DNS resolver IPv4 address and I also recommend that you not use ssh port 22 but instead pick a high port number:
{{{
#
# ipf.conf
#
# IP Filter rules to be loaded during startup
#
# See ipf(4) manpage for more information on
# IP Filter rules syntax.
#
# this ipf ruleset is intended to be used with SmartOS
# OUTBOUND rules
# allow dns out to DDD.DDD.DDD.DDD
pass out quick on vioif0 proto tcp from any to DDD.DDD.DDD.DDD port = 53 flags S keep state
pass out quick on vioif0 proto udp from any to DDD.DDD.DDD.DDD port = 53 keep state
# DHCP
# Allow access to ISP's specified DHCP server for cable or DSL networks.
# Use the first rule, then check log for the IP address of DHCP server.
# Then, uncomment the second rule, replace z.z.z.z with the IP address,
# and comment out the first rule
pass out log quick on vioif0 proto udp from any to any port = 67 keep state
#pass out quick on vioif0 proto udp from any to z.z.z.z port = 67 keep state
# Allow HTTP and HTTPS
pass out quick on vioif0 proto tcp from any to any port = 80 flags S keep state
pass out quick on vioif0 proto tcp from any to any port = 443 flags S keep state
# Allow ssh
pass out quick on vioif0 proto tcp from any to any port = 46341 flags S keep state
# Allow NTP
pass out quick on vioif0 proto tcp from any to any port = 37 flags S keep state
# Allow ping
pass out quick on vioif0 proto icmp from any to any icmp-type 8 keep state
# Block and log everything else
block out log first quick on vioif0 all
# INCOMING rules
# BLOCKING rules
# Block all inbound traffic from non-routable or reserved address spaces
block in quick on vioif0 from 192.168.0.0/16 to any #RFC 1918 private IP
block in quick on vioif0 from 172.16.0.0/12 to any #RFC 1918 private IP
#block in quick on vioif0 from 10.0.0.0/8 to any #RFC 1918 private IP
block in quick on vioif0 from 127.0.0.0/8 to any #loopback
block in quick on vioif0 from 0.0.0.0/8 to any #loopback
block in quick on vioif0 from 169.254.0.0/16 to any #DHCP auto-config
block in quick on vioif0 from 192.0.2.0/24 to any #reserved for docs
block in quick on vioif0 from 204.152.64.0/23 to any #Sun cluster interconnect
block in quick on vioif0 from 224.0.0.0/3 to any #Class D & E multicast
# Block fragments and too short tcp packets
block in quick on vioif0 all with frags
block in quick on vioif0 proto tcp all with short
# block source routed packets
block in quick on vioif0 all with opt lsrr
block in quick on vioif0 all with opt ssrr
# Block OS fingerprint attempts and log first occurrence
block in log first quick on vioif0 proto tcp from any to any flags FUP
# Block anything with special options
block in quick on vioif0 all with ipopts
# Block public pings and ident
block in quick on vioif0 proto icmp all icmp-type 8
block in quick on vioif0 proto tcp from any to any port = 113
# Block incoming Netbios services
block in log first quick on vioif0 proto tcp/udp from any to any port = 137
block in log first quick on vioif0 proto tcp/udp from any to any port = 138
block in log first quick on vioif0 proto tcp/udp from any to any port = 139
block in log first quick on vioif0 proto tcp/udp from any to any port = 81
# ALLOW rules
## Allow traffic in from ISP's DHCP server. Replace z.z.z.z with
## the same IP address used in the outbound section.
#pass in quick on vioif0 proto udp from z.z.z.z to any port = 68 keep state
pass in quick on vioif0 proto udp from any to any port = 68 keep state
# Allow SSH
pass in quick proto tcp from any to any port = 22 flags S/FSRPAU keep state keep frags
# Block and log only first occurrence of all remaining traffic.
block in log first quick on vioif0 all
}}}
== creation of zones ==
Read the SmartOS documentation on [https://wiki.smartos.org/display/DOC/Managing+Images zone image management].
We create Solaris and Linux zones using the latest SmartOS zone images available:
These two image IDs will be specified in our zone manifests.
Refer to [https://wiki.smartos.org/display/DOC/How+to+create+a+zone+%28+OS+virtualized+machine+%29+in+SmartOS creating zones with SmartOS] for more information.
== firewall zone ==
create a '''firewall.json''' file where public IPv4 address is '''XXX.XXX.XXX.XXX''' and the gateway is '''YYY.YYY.YYY.YYY''' :