In this tutorial we're going to cover how to setup the open source hypervisor QEMU/KVM in Linux host OS, using the libvirt technology.
Hardware : PC / Laptop / Homeserver / Remote Server
Host OS : Linux
I recommend using this setup first of all to isolate your Public use, and to segment it from the other Uses such as Private use, but it can later be used for Anonymous use, and also Sensitive Use, as per the 4 basic OPSEC levels.
Bob has a problem, he wants to use his laptop for 4 different internet uses:
But currently, he has only one laptop with linux as the host OS.
So the idea basically is that Bob does not need to purchase 4 laptops each for a different usage, he just needs to virtualise those machines using a Hypervisor:
Bob is going to use a QEMU/KVM hypervisor to virtualize 4 VMs, each for a specific use. The windows VM will be for public use, the debian VM will be for the private use, the Whonix VM will be for Anonymous use, and the other whonix VMs in the veracrypt hidden volume be used for sensitive uses.
Next we do not virtualize anything using closed-source software like VMWare Workstation or else. We use QEMU/KVM with virt-manager, which is an open source hypervisor:
nihilist@debian:~# sudo apt install libvirt0 virt-manager dnsmasq bridge-utils
sudo systemctl enable --now libvirtd
nihilist@debian:~# sudo usermod -a -G libvirt nihilist
nihilist@debian:~# sudo usermod -a -G kvm nihilist
nihilist@debian:~# sudo vim /etc/libvirt/libvirtd.conf
nihilist@debian:~# cat /etc/libvirt/libvirtd.conf | grep sock_group
unix_sock_group = "libvirt"
unix_sock_rw_perms = "0770"
nihilist@debian:~# cat /etc/libvirt/qemu.conf
group = "libvirt"
user = "nihilist"
nihilist@debian:~# systemctl restart libvirtd.service
nihilist@debian:~# virt-manager
Next just make sure that the NAT network is created, and that the ISOs and VMs folders are with the correct permissions:
And also create another NAT network so that we can put all the untrusted VMs such as Windows into:
That way, the adversary that can normally see what's going on in the network attached to the Windows VM can no longer see as it is being put in a different network altogether.
nihilist@debian:~$ mkdir ISOs
nihilist@debian:~$ mkdir VMs
nihilist@debian:~$ sudo chmod 770 -R VMs
nihilist@debian:~$ sudo chmod 770 -R ISOs
nihilist@debian:~$ sudo chown nihilist:libvirt -R VMs
nihilist@debian:~$ sudo chown nihilist:libvirt -R ISOs
Then you can add the file directories in virt-manager like so:
And now you're all set to start making VMs while maintaining the open-source requirement. If you still want to use a closed-source OS, you can do so in a QEMU VM from virt-manager. always remember that closed-source OSes like Windows belong in a VM, never out of one.
Additional notes: you can prevent an adversary to tamper with your laptop, by using glitter polish as shown in mullvad's tutorial, and also make sure that your phone does not have a closed-source host OS by using Graphene OS.
Next, Bob needs to use VMs for 2 basic needs: Public internet usage, and Private internet usage. He first needs to download the Windows ISO file, and the debian iso file too:
First he creates the windows VM like so:
Then before we begin the installation, we make sure that the windows VM uses the untrusted NAT network to make sure it remains isolated:
Then we hit Apply, and then we click on begin installation
Then he creates the debian VM like so:
Then in both VMs he installs the OS on the virtual disk:
Then Bob can launch both VMs (make sure that the VM boots onto the disk instead of the iso in the boot settings):
Then Bob can use the windows VM for his public usage (such as KYC services, and closed-source software), and use the debian VM for his private usage (any personal matter, with only open source software)
From inside the Debian VM, you can run the following from a terminal to be able to copy and paste from inside the VM out, and from outside the VM in:
su -
apt update -y
apt install spice-vdagent -y
reboot now
Do not do the same for the windows VM, otherwise you'd be allowing the Windows VM to spy on what your clipboard contains, from outside the VM. Make sure it is kept isolated as it is by default here.
Next, Bob can setup a VPN by default into his debian VM to prevent his ISP from spying on what he is doing.
Donate XMR: 8AUYjhQeG3D5aodJDtqG499N5jXXM71gYKD8LgSsFB9BUV1o7muLv3DXHoydRTK4SZaaUBq4EAUqpZHLrX2VZLH71Jrd9k8
Contact: nihilist@contact.nowhere.moe (PGP)