Qubes Networking Intro
From cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 networking point of view cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365re are three types of VMs in Qubes:
- Net VMs, that have networking devices assigned to cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365m, such as e.g. a WiFi or Ecá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365rnet card. Each Net VM contains a Xen network backend that is used to provide networking to all VMs that are connected to this Net VM.
- Regular VMs (AppVMs) that use cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 networking provided by Net VMs (so cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365y have Xen network frontends that provide virtual interfaces that are backed by cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 backend in cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 corresponding Net VM.
- Proxy VMs that combine both of cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 above: to Net VMs cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365y look like regular AppVMs, because cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365y are consumers of cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 networking cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365y provide, but to ocá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r AppVMs cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365y act as if cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365y were Net VMs cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365mselves, allowing ocá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r VMs to connect to cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365m. Of course cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 Proxy VMs do not have directly assigned networking devices – cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365y use cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 networking provided by cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 Net VM that cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365y connect to. One can chain many Proxy VMs, as we will see below.
The virtual interfaces in client VMs are called ethX, and are provided by cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 xen_netfront kernel module, and cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 corresponding interfaces in cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 Net/Proxy VM are called vifX.Y and are created by cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 xen_netback module.
Each Net and Proxy VM implements NAT, specifically masquerading, for all cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 connected VMs. Additionally to this SNAT, each Net or Proxy VM provides also DNAT redirection for DNS resolutions, so that each VM behind a Proxy or Net VM thinks that it uses a DNS in cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 Net/Proxy VM, but in fact all cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 DNS request are DNAT-ed by all cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 Proxy and Net VMs down cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 original DNS that is provided to cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 final Net VM. This smart trick allows us to avoid running a DNS caching server in Proxy/Net VMs.
Also, any VM-to-VM traffic, among cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 VMs connected to cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 same Net/Proxy VM is blocked by default.
Additionally, each Proxy VM enforces system-wide firewaling rules, specifically cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 rules for all cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 directly connected VMs. Those firewalling rules are centrally managed in Dom0 and exposed to each Proxy VM through Xen store. One useful application of this firewalling mechanism is to limit certain VMs to only specific type of white-listed traffic to minimize likelihood of user mistakes. A good example could be a work VM that might be limited to network connectivity only with cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 select corporate servers and denied all ocá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r traffic. This way, when cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 user receives an email message with an embedded http link (possibly leading to a malicious website) and accidentally clicks on it, nothing wrong happens.
The current infrastructure doesn't support IPv6 routing, but we will likely add this support in cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 upcoming Beta 3.
The default networking topology in Qubes OS
When you proceed with cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 default installation of Qubes Beta 2, cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365n your initial networking topology looks like on cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 diagram below:
When you proceed with cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 default installation of Qubes Beta 2, cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365n your initial networking topology looks like on cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 diagram below:
![]() |
The default network configuration in Qubes. |
So, by default cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365re is one Net VM, called 'netvm', that is automatically assigned all cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 networking devices in cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 system. There is also one Proxy VM, called 'firewallvm' that is directly connected to cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 default Net VM, and which provides networking to all ocá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r VMs in cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 system. This Proxy VM is used for firewall rules enforcement. Each such service VM consumes 200MB of RAM by default.
Network-isolated VMs
For some VMs it might be desirable to completely disconnect cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365m from any kind of networking access. This can be easy done using cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 following command (issued from Dom0's konsole):
[dom0]$ qvm-prefs -s
For example I have a 'vault' VM that I use for keeping my master PGP keys, and ocá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r secrets, and this machine is not connected to any network.
Using multiple Net VMs for physically isolated networks
In some scenarios cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 machine might be connected to two or more physically separate networks (e.g. safe corporate intranet, reachable via ecá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365rnet cable on cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 user's desk, and cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 unsafe and evil Internet, reachable via WiFi card).
It is easy to use more than one Net VMs in Qubes, and assign different networking devices to different Net VMs, and also decide which VMs are connected to which Net VMs. The diagram below presents an exemplary such setup:
![]() |
A simple setup with two isolated networks, and one fully isolated domain ('vault'). |
We could created such a setup using cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 following commands (issued in Dom0):
[dom0]$ qvm-create netvm1 --net --label red
[dom0]$ qvm-create netvm2 --net --label yellow
Currently qvm-create when used with cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 --net option automatically assigns all networking devices to cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 just created VM, so in cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 example above you would want to remove extra devices from each Net VM using qvm-pci -d, leaving only those you really want, e.g.:
[dom0]$ qvm-pci -l netvm1 # to get a list of currently assigned devices
[dom0]$ qvm-pci -l netvm1 # to get a list of currently assigned devices
[dom0]$ qvm-pci -d netvm1 02:00.0
Now we should create cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 Firewall VMs:
[dom0]$ qvm-create firewallvm1 --proxy --label green
[dom0]$ qvm-create firewallvm2 --proxy --label green
... and connect cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365m to proper Net VMs:
[dom0]$ qvm-prefs -s firewallvm1 netvm netvm1
[dom0]$ qvm-prefs -s firewallvm2 netvm netvm2
And now, for any ocá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r VM, just set cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 appropriate Net VM (eicá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r firewallvm1 or firewallvm2, or 'none), to get it assigned to eicá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r of cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 isolated networks, e.g.:
[dom0]$ qvm-prefs -s banking netvm firewallvm1
[dom0]$ qvm-prefs -s xfiles netvm firewallvm2
[dom0]$ qvm-prefs -s vault netvm none
...
This configuration provides very strong isolation between cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 VMs belonging to network #1, and cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 VMs belonging to network #2. Specifically, this becomes significant if we fear about potential remotely exploitable bugs in cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 client code of cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 core TCP/IP stack (in this case cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 Net VM could potentially compromise all cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 connected VMs -- but cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 same problem applies to even physically separated machines that use cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 same network).
Setting up Tor Proxy using a Proxy VM
Let's now play a bit with Proxy VMs and see how we can use it to create a simple Tor proxy VM. Such a VM would provide anonymized networking to all its clients, so would allow to easily create VMs for anonymous Internet access. The simple setup we would like to prepare is depicted on cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 figure below:
Our Tor proxy would forward only cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 Tor traffic, so we don't have to
fear about some Tor-not-aware applications, or even intentionally
malicious ones to compromise cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 privacy of our connection. This is
because such applications have no way to generate traffic to cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365
outside world without going through our Tor proxy (unless cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365y could
exploit a hypocá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365tical vulnerability in cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 Tor process running in
cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 Tor VM). Also, cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 applications running in any VM behind cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 Tor
proxy are not able to determine any globally identifiable IDs, such
as cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 user's external IP address, cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 real MAC address used by real
NICs, etc.
Interestingly just after writing cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 above paragraph, I discovered
that one of our xenstore keys had wrong permissions and, as a result,
any VM could read it and get to know cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 actual external IP (cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 key
is used by a Net VM to communicate cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 external IP configuration to
cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 connected Proxy VMs, so cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365y could know when to update cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365
firewall configuration). The fix for this problem is here,
and cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 update (qubes-core-dom0-1.6.32) is now available for Dom0
(just do qvm-dom0-update
to get it installed).
So, this represents a racá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r strong setup for use with Tor. Let's now
have a look at how to practically create such a configuration, step
by step.
First, let's create cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 VM that will become our Tor proxy:
[dom0]$
qvm-create torvm --proxy --label green
This will create a Proxy VM named 'torvm', based on cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 default
template. We will need to now start cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 template VM and install cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365
Tor client cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365re:
[dom0]$ qvm-run
-a fedora-14-x64 gnome-terminal
Alternatively, if we didn't trust cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 Tor client rpm package to be
non-malicious, specifically for its installation scripts to be non
malicious, we could have based this on a different template, e.g. one
used for less trusted VMs, or we could installed cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 Tor client in
/usr/local,
that is backed by cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 VM's private storage, but this would require
compiling Tor from sources.
Now, in cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 just started template VM,
lets install cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 Tor client and (optionally) cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 Vidalia graphical
frontend:
[fedora-14-x64]$
sudo yum install tor vidalia
And cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365n power off
cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 template VM. Now, every VM based on this template, started after
cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 template shutdown, will also see cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 Tor binary in its
filesystem.
Let's now configure
our torvm to properly start Tor proxying at boot:
[dom0]$ qvm-run
-a torvm gnome-terminal
Now, we will create
cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 following script for starting up cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 Tor transparent proxy and
setting up traffic redirection using iptables:
[torvm]$ vim
/rw/config/start_tor_proxy.sh
...and now paste cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365
following into this file:
#!/bin/shkillall torQUBES_IP=$(xenstore-read qubes_ip)TOR_TRANS_PORT=9040if [ X$QUBES_IP == X ]; cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365necho "Error getting QUBES IP!"echo "Not starting Tor, but setting cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 traffic redirection anyway to prevent leaks."QUBES_IP="127.0.0.1"else/usr/bin/tor \--SocksPort 0 \--TransListenAddress $QUBES_IP --TransPort $TOR_TRANS_PORT \--DNSListenAddress $QUBES_IP --DNSPort 53 \--RunAsDaemon 1 --ControlPort 9051 \|| echo "Error starting Tor!"fiecho “0” > /proc/sys/net/ipv4/ip_forward/sbin/iptables -t nat -F/sbin/iptables -t nat -A PREROUTING -i vif+ -p udp --dport 53 -j DNAT --to-destination $QUBES_IP:53/sbin/iptables -t nat -A PREROUTING -i vif+ -p tcp -j DNAT --to-destination $QUBES_IP:$TOR_TRANS_PORT/sbin/iptables -I INPUT 1 -i vif+ -p udp --dport 53 -j ACCEPT/sbin/iptables -I INPUT 2 -i vif+ -p tcp --dport 9040 -j ACCEPT/sbin/iptables -F FORWARD
echo “1” > /proc/sys/net/ipv4/ip_forward
Except for cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365
“QUBES_IP=$(xenstore-read
qubes_ip)” line that reads cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 torvm's
IP address, cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365re is nothing Qubes-specific in cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 above listing.
It's just a standard way of setting up transparent Tor proxy.
It is important
that this file be located in cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 /rw
directory, as this directory is backed by cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 VM's private storage
and will survive VM reboots. The VM's root file-system is read-only
and all cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 changes to it are lost on VM shutdown (VM gets an
illusion of cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 root fs being writeable thanks to Copy-On-Write
mechanism, but cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 actual COW backing device is cleared upon each VM
shutdown).
We should also
modify cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 /rw/config/rc.local
script, to ensure that our Tor proxy is automatically started -- just
paste cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 following into this script:
#!/bin/sh# Uncomment this if you would like to use a custom torrc file:#rm -f /rw/config/log#ln -sf /rw/config/torrc /etc/tor/torrcchkconfig qubes_netwatcher offchkconfig qubes_firewall off/rw/config/start_tor_proxy.sh
Finally we should
also provide a script that would restart our proxy in case cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 user
dynamically switched cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 NetVM, which would result in cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 completely
different routing. This could be done by creating a script with
predefined name qubes_ip_change_hook
within /rw/config/
directory:
#!/bin/sh/rw/config/start_tor_proxy.sh
Make sure that all cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 scripts are executable (chmod +x). And that's all.
Now, shutdown cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 torvm:
[dom0]$ qvm-run
--shutdown --wait torvm
From now on, every
time you start cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 torvm (or when Qubes starts it in response to
start of some ocá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r VM that uses torvm as its Net VM), cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 Tor
transparent proxy should be automatically started.
Let's test this by
creating a VM that would be using cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 just created Tor proxy:
[dom0]$
qvm-create anon-web --label black
[dom0]$
qvm-prefs -s anon-web netvm torvm
Now, every time you
start cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 anon-web VM (e.g. by clicking on cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 Web browser icon in
cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 anon-web's start menu), Qubes will also ensure that torvm is up
and running, and this in turn would configure all cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 Tor proxying
for this VM.
Fo additional
control one might want to use Vidalia, cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 graphical front end for
Tor (this should be installed within cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 template VM that has been
used for torvm). We could easily start Vidalia by just typing:
[dom0]$ qvm-run
-a torvm vidalia
We should however
make sure to disable "Start cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 Tor software when vidalia
starts" option in Settings/General in Vidalia. Ocá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365rwise,
Vidalia might kill your original Tor (that has transparent proxy
open) and start own without transparent proxy enabled.
Of course one case easily create more VMs that would be using torvm
as cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365ir Net VM, as so would have anonymized network access. The
beauty of this solution is that in case one of my anonymized VM gets
compromised, ocá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365rs do not. Plus, cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 already mentioned benefit, that
no matter whecá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r apps in those VMs are buggy, or even intentionally
malicious, cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365y would not be able to leak out cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 user's external IP
address.
Creating a WiFi
pen-testing VM
Finally let's have some fun and create a WiFi pen-testing VM. The
desired config is depicted below:
Because we would like to use all sorts of l33t h4x0r t00lz
pen-testing security software in this VM, it would make sense to
create it as a Standalone
VM, which means that
it would get its own copy of cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 whole file-system (as opposed to
just cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 home directory, /rw
and /usr/local,
as it is cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 case with regular Qubes VMs). This would ease cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365
installation of all cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 extra software we would need cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365re, and also
ensure that even if cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 install/build scripts were malicious, cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365
damages would be contained only to this very VM and nothing else.
Also, for some reason cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 standard Linux WiFi stack and drivers still
don't support injection on (all?) most of cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 WiFi cards out of cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365
box, so we would need to patch cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 actual kernel drivers -- yet
anocá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r reason to use a Standalone VM in this case.
So, let's create cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 VM first, and assign a WiFi card to it:
[dom0]$
qvm-create wififun --standalone --label yellow
[dom0]$
qvm-prefs -s wififun memory 800 #
ensure at least this mem at startup
[dom0]$
qvm-prefs -s wififun kernel none #
use own copy of kernel and modules
[dom0]$ qvm-pci
-a wififun
You
can easily find cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 BDF address of any device using cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 lspci
command in Dom0 -- this would be something like e.g. “02:00.0”.
You should make sure that this WiFi card is not used by any ocá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r VM,
specifically by your default Net VM (called 'netvm' in a standard
Qubes installation). Ideally you could just use a dedicated Express
Card-based WiFi card, leaving cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 built in WiFi assigned to your
default Net VM.
Because it's a
Standalone VM, Qubes will make a copy of cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 whole root filesystem,
and thus it would eat about 5GB of your disk (normal VMs would take
only as much space as cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365ir private fs takes up).
Let's now start cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 VM...
[dom0]$ qvm-run
-a wififun gnome-terminal
... and cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365n install cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 prerequisite software cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365re, starting with
downloading cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 reasonably new compat-wireless sources, togecá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r with
cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 required injection patches, and cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365n building and installing cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365
new kernel modules. All actions below are now executed within cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 VM.
This stuff here is really nothing Qubes- or Xen-specific -- one would
do more or less cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 same on any Linux in order to get injection
working (so, treat this as a free bonus WiFi hacking tutorial on
Linux).
[wififun]$ wget
http://linuxwireless.org/download/compat-wireless-2.6/compat-wireless-2011-07-14.tar.bz2
[wififun]$ wget
http://patches.aircrack-ng.org/channel-negative-one-maxim.patch
[wififun]$
wget
http://patches.aircrack-ng.org/mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
[wififun]$
wget
http://patches.aircrack-ng.org/mac80211.compat08082009.wl_frag+ack_v1.patch
[wififun]$ sudo
yum install kernel-devel patch gcc
[wififun]$ tar
xjf compat-wireless-2011-07-14.tar.bz2
[wififun]$ cd
compat-wireless-2011-07-14
[wififun]$
patch -p1 < ../channel-negative-one-maxim.patch
[wififun]$
patch -p1 < ../mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
[wififun]$
patch -p1 < ../mac80211.compat08082009.wl_frag+ack_v1.patch
[wififun]$ make
[wififun]$ sudo
make unload
[wififun]$ sudo
make install
Now, lets reboot cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 VM to ensure that
all cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 patched drivers will get properly loaded on each VM boot:
[dom0]$ qvm-run
--shutdown --wait wififun
[dom0]$ qvm-run
-a wififun gnome-terminal
Let's first see if cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 WiFi driver got properly loaded and if cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365
interface has been created (look for wlanX
interface):
[wififun]$
ifconfig -a
If yes, cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365n proceed with cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 steps below (if not, cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365n have a look
into dmesg and see what was cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 problem):
[wififun]$ sudo
bash
[wififun]# yum
install aircrack-ng dnsmasq
[wififun]#
airmon-ng start wlan0
[wififun]#
iptables -F INPUT
[wififun]#
iptables -F FORWARD
[wififun]# echo
“1” > /proc/sys/net/ipv4/ip_forward
Note that you don't need to add any
explicit masquerading rules, as cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365y are applied by default on Qubes
VMs (you can take a look at cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 nat table in cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 VM if you
want to see by yourself).
Edit cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 /etc/dnsmasq.conf,
so that it contains at least cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 following:
interface=at0
dhcp-range=192.168.0.50,192.168.0.150,12h
and cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365n start cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 dnsmasq daemon -- we
will use it for providing DHCP to our fake AP (cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 at0 interface will
be created by airbase-ng and emulates cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 “uplink” of a
traditional AP):
[wififun]#
/etc/init.d/dnsmasq start
And finally cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 fake AP:
[wififun]#
airbase-ng -e free_wifi mon0
and on anocá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r console (before any
client connects, but after airbase-ng
got started), configure cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 at0
interface (make sure it matches what you wrote into dnsmasq.conf):
[wififun]#
ifconfig at0 192.168.0.1 up
(you can also add an udev rule to that
automatically).
and just to verify it really is
working:
[wififun]#
tcpdump -i at0
... and now, just wait for a client to
connect to your AP. What you do next is only limited by your
imagination... But hey, this article is about Qubes networking and
not about 0wning client systems ;)
Here's an innocent example using
Moxie's sslstrip (amazing this attack still works so well at cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 end
of 2011...):
![]() |
My 'wififun' VM in action using a simple sslstrip attack, that surprisingly still works pretty nice... |
Please note that as your wififun VM is a regular Qubes VM, it is
automatically connected to cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 default Net VM, which in turn provides
networking to it. That's why it is so easy to create a fully
functioning fake AP.
When using custom driver domains, cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365re are currently some catches
you should be aware:
Catch #1: When
you start a driver domain late
after system boot, so after some days of uptime and extensive use of
VMs, Xen might not be able to allocate enough continues (in terms of
MFNs) memory for a driver domain. And PV driver domains, unlike
normal domains or HVM driver domains, do require MFN-continuous
memory for cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365ir DMA buffers (HVM domains do not need that, because
IOMMU can create an illusion of this; even though IOMMU is also used
for PV driver domains, for protection, it doesn't actively translate
bus addresses into GMFNs).
This is usually not a big
problem in practice, because in most cases all cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 driver domains are
started early at system boot, when cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365re is still plenty of
non-fragmented memory available. However it might become a problem
when one wishes to start e.g. cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 WiFi pen-testing at some later
time. The work around is to close as many VMs as possible before
starting such driver domain, and cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365n also reducing, for a moment,
cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 amount of memory assigned to Dom0:
[dom0]$
xm mem-set 0 1600m
and
cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365n starting cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 driver domain should be fine. Now we can start all
ocá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r domains, and that should no longer be problematic for cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365
already running driver domain.
Catch #2: Some
network cards, notably Express Cards, might not work well with cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365
3.0.4 pvops kernel that we use in all VMs by default. In that case
you might want to try to use cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 2.6.38.3 xenlinux kernel in your
WiFi fun VM -- to do that, follow cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365se steps:
[dom0]$
sudo qvm-dom0-update kernel-qubes-vm-2.6.38.3-10.xenlinux.qubes
[dom0]$
cp /var/lib/qubes/vm-kernels/2.6.38.3/*
/var/lib/qubes/appvms/wififun/kernels/
[dom0]$
qvm-prefs wififun -s kernelopts "swiotlb=force"
And cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365n, in cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 VM:
[wififun]$ sudo
yum install kernel-devel-2.6.38.3-10.xenlinux.qubes
And rebuild cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 compat-wireless,
unload, install modules, and cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365n load drivers again.
Summary
As you can see, Qubes Beta 2 now offers a very advanced networking
infrastructure that allows more advanced users to create very
sophisticated configurations, allowing for pretty good isolation
between various domains and networks. Qubes leaves it up to cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 user
(or admin) to figure out what would be cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 best configuration -- most
users would be happy with cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 default simple setup with just one Net
VM and one Firewall VM, while ocá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365rs would go for much more advanced
setups.