Spin up new Windows qubes quickly, effortlessly and securely
Qvm-Create-Windows-Qube is a tool for quickly and conveniently installing fresh new Windows qubes with Qubes Windows Tools (QWT) drivers automatically. It officially supports Windows 7, 8.1 and 10 as well as Windows Server 2008 R2, 2012 R2, 2016 and 2019.
The project emphasizes correctness, security and treating Windows as an untrusted guest operating system throughout the entire process. The installation takes place 100% air gapped and features optional Whonix integration on the finished Windows qube for added privacy. Accomplishing these goals in as few lines of code as possible to ensure simplicity and minimalism is key.
It also features other niceties such as automatic installation of packages including Firefox, Office 365, Notepad++, Visual Studio and more using Chocolatey to get you up and running quickly in your new environment.
As featured on: Hacker News | Proudly ranked in the top 10 on the front page of Hacker News as well as first place for Show HN
install.sh
into Dom0 by running the following command in Dom0:
qvm-run -p --filter-escape-chars --no-color-output <name_of_qube_script_is_located_on> "cat '/home/user/Downloads/install.sh'" > install.sh
install.sh
to ensure its integrity
qvm-run
disables it by default when the output is a filechmod +x install.sh && ./install.sh
TemplateVM
, which is fedora-XX
by default/usr/bin/qvm-create-windows-qube
To update Qvm-Create-Windows-Qube, start by simply deleting the windows-mgmt
VM and main program by running the following command in Dom0:
qvm-remove -f windows-mgmt && sudo rm /usr/bin/qvm-create-windows-qube
Lastly, follow the installation steps above to reinstall.
Note that this will also delete any Windows ISOs that have already been downloaded. This may be desirable in the case that Microsoft has updated the Windows ISOs (meaning you should redownload them anyway). However, if you would like to avoid downloading any of the Windows ISOs again, simply navigate to /home/user/qvm-create-windows-qube/windows/isos
in the windows-mgmt
VM and copy its contents to another (preferably disposable) qube. After the reinstall is complete, copy those ISOs back into windows-mgmt
at the aforementioned directory.
Usage: qvm-create-windows-qube [options] -i <iso> -a <answer file> <name>
-h, --help
-c, --count <number> Number of Windows qubes with given basename desired
-t, --template Make this qube a TemplateVM instead of a StandaloneVM
-n, --netvm <qube> NetVM for Windows to use
-s, --seamless Enable seamless mode persistently across reboots
-o, --optimize Optimize Windows by disabling unnecessary functionality for a qube
-y, --spyless Configure Windows telemetry settings to respect privacy
-w, --whonix Apply Whonix recommended settings for a Windows-Whonix-Workstation
-p, --packages <packages> Comma-separated list of packages to pre-install (see available packages at: https://chocolatey.org/packages)
-P, --pool <name> LVM storage pool to install Windows on (https://www.qubes-os.org/doc/secondary-storage/)
-i, --iso <file> Windows media to automatically install and setup
-a, --answer-file <xml file> Settings for Windows installation
Mido (mido.sh
) is the secure Microsoft Windows Downloader (for Unix), inspired by Fido from Rufus. It's capable of automating the download process for a few Windows ISOs that Microsoft has behind a gated download web interface. Mido is robust and securely downloads Windows ISOs to be used by Qvm-Create-Windows-Qube from official Microsoft servers. You can find it located at /home/user/qvm-create-windows-qube/windows/isos/mido.sh
in windows-mgmt
.
windows-mgmt
is air gapped from the network. This means that in order to securely perform the download, one must copy the mido.sh
script to another (disposable) qube followed by transferring the newly downloaded ISO(s) into windows-mgmt
and placing them into the /home/user/qvm-create-windows-qube/windows/isos
directory. Alternatively, windows-mgmt
can temporarily be given network access, however, this isn't recommended for security reasons.
Once generated, Windows ISOs are cached in /home/user/qvm-create-windows-qube/windows/out
for later use. If you download an updated ISO with Mido, then make sure to remove the same ISO from the aforementioned cache directory. This will cause the cache to be regenerated from the updated ISO.
For advanced readers: Qvm-Create-Windows-Qube takes a generic approach to handling ISOs that can work with any given Windows ISO. If you have your own Windows ISO you would like to use then likely only a very slight adjustment to the closest matching answer file (namely the /IMAGE/NAME
key) would be needed to make it work. You can get the valid /IMAGE/NAME
values for your ISO by parsing the install.wim
inside using the wiminfo
command (packaged as wimlib-utils
on Fedora or wimtools
on Debian) or from within Windows using Windows ADK.
Important: Be sure to read the Qubes Windows Tools Known Issues section below for a small upstream issue.
qvm-create-windows-qube -n sys-firewall -oyp firefox,notepadplusplus,office365proplus -i win10x64.iso -a win10x64-pro.xml work-win10
qvm-create-windows-qube -n sys-firewall -oyp steam -i win10x64.iso -a win10x64-pro.xml game-console
qvm-create-windows-qube -n sys-firewall -oy -i win2019-eval.iso -a win2019-datacenter-eval.xml fs-win2019
qvm-create-windows-qube -n sys-firewall -oyp firefox,notepadplusplus,office365proplus -i win10x64-enterprise-ltsc-eval.iso -a win10x64-enterprise-ltsc-eval.xml work-win10
qvm-create-windows-qube -n sys-whonix -oyw -i win10x64-enterprise-ltsc-eval.iso -a win10x64-enterprise-ltsc-eval.xml anon-win10
qvm-create-windows-qube -n sys-firewall -soyp firefox,notepadplusplus,office365proplus -i win7x64-ultimate.iso -a win7x64-ultimate.xml work-win7
Qvm-Create-Windows-Qube is "reasonably secure" as Qubes would have it.
windows-mgmt
is air gappedwindows-mgmt
qube
qvm-run
; no variablesmicrosoft.com
.UNVERIFIED
until it's made certain that its checksum is a matchwindows-mgmt
release4.1
branch and qubes-mgmt-salt-windows-mgmtDon't forget to apply any applicable updates upon creation of your Windows qube. Microsoft frequently builds up-to-date ISOs for current versions of Windows, such as Windows 10. For these Windows versions, it's recommended to periodically download the latest version using Mido to get a fresh Windows image out of the box.
Windows 7 and Windows Server 2008 R2 reached end of life (EOL) on January 14, 2020.
Qvm-Create-Windows-Qube aims to be the most private way to use Windows. Many Qubes users switched from Windows (or another proprietary OS) in part to get away from Microsoft (or Big Tech in general) and so being able to use Windows from a safe distance is of utmost importance to this project. Or at least, as safe a distance as possible for what is essentially a huge, proprietary binary blob.
Configures Windows telemetry settings to respect privacy.
spyless.bat
for more infoEverything mentioned here up to "Even more security" is implemented. "Most security" is to use an official Whonix-Workstation built yourself from source. This feature is not official or endorsed by Whonix.
It's recommended to read this Whonix documentation to understand the implications of using Windows in this way.
There are countless unique identifiers present in every Windows installation such as the MachineGUID, installation ID, NTFS drive Volume Serial Numbers (VSNs) and more. With Qvm-Create-Windows-Qube, these unique identifiers can easily be reset by automatically reinstalling Windows.
Fingerprinting is possible through the hypervisor in the event of VM compromise, here are some practical examples (not specific to Windows):
timedatectl set-timezone
every boot using the standard /rw/config/rc.local
Qubes providesNo, with every Windows installation comes an embedded trial product key which is used by default if none other is provided. Qvm-Create-Windows-Qube explicitly specifies no product key in the answer files in order to use the default trial key.
On general consumer versions of Windows such as (non-enterprise) 7, 8.1 and 10, these trials extend forever with the understanding that a watermark or pop up may start appearing requesting activation of the product.
On Windows Enterprise Evaluation and Server Evaluation versions, once the trial is up the machine will automatically (and without warning) be shut down after being up for a set amount of time by the Windows License Monitoring Service (C:\Windows\System32\wlms\wlms.exe
; it's in a hidden folder). When this occurs, the aforementioned reason for shutdown will be logged in the Event Viewer. To renew the trial run slmgr /rearm
in the command prompt. This will work for the number of times specified in slmgr /dlv
(it can vary) at which point the product must be activated or reinstalled.
It's recommended that you license the product when the trial is up in all cases.
Giving Windows Internet access is not required for using the trial key (as it's embedded within each ISO). However, it is required for activating Windows with a product key of your own (unless you do activation by phone).
windows-mgmt
AppVM? May I delete it once the Windows installation is complete?The purpose of the windows-mgmt
AppVM is to securely isolate everything that goes on as part of the Windows installation to a single virtual machine. That way, the exploitation of any bugs that exist in, for example, in the Linux ISO filesystem parsing code is limited in the amount of harm it can do should a Windows ISO be malicious. This is the security principle upon which all of Qubes OS is built upon, it's known as "security by isolation" or "security by compartmentalization".
Feel free to delete windows-mgmt
if you are sure there are no more Windows VMs you would like to create. However, if it's just the disk space you want to reclaim then you can simply delete the ISOs located at /home/user/qvm-create-windows-qube/windows/isos
and /home/user/qvm-create-windows-qube/windows/out
(in windows-mgmt
) to save the vast majority of that space.
Don't enable "Include in memory balancing" (the checkbox) in the Windows qube settings. This feature of Qubes OS is currently unstable on Windows and enabling it will lead to frequent Windows crashes (BSODs).
You can start by giving this project a star! High quality PRs are also welcome! Take a look at the todo list below if you're looking for things that need improvement. Other improvements such as more elegant ways of completing a task, code cleanup and other fixes are also welcome.
Lots of Windows-related GSoCs for those interested.
The logo of this project is by Max Andersen, used with written permission.
This project is the product of an independent effort that is not officially endorsed by Qubes OS.
In Qubes R4.1, Qubes Windows Tools comes with newer drivers that work better on newer versions of Windows such as Windows 10. Unfortunately, it's also been documented that these new drivers work less well with older versions of Windows such as Windows 7. Ideally, the fixes should be consolidated into a single driver but that is yet to happen.
Windows 7 is an EOL operating system at this point so this is less important. However, there are still some valid reasons for using (at least an air gapped) Windows 7 machine (e.g. for technical research/testing purposes).
There are community members documenting this experience (I can also attest to it) on the Qubes OS Forum and a few Qubes OS GitHub issues.
ISO-13346
at the topfile
command may slightly misidentify these ISO files as being the now supplanted ISO 9660 format but that's probably only because "UDF shares the basic volume descriptor format with ISO 9660"mkisofs
)mido.sh
(which will not be a problem now that I've extended it's functionality to download from behind the gated Microsoft ISO download API)windows-mgmt
air gappeddownload-windows.sh
(now mido.sh
to download ISOs from behind Microsoft's gated ISO download API/etc/qubes/templates/libvirt/xen/by-name/<windows_qube>
create-media.sh
where the Python script would essentially just be calling out to external programsqvm-create-windows-qube
program though
wiminfo
command (Currently a WIP; see branch)
wiminfo
works just like DISM on Windowslibguestfs
libguestfs
used on QEMU/KVM so it's definitely a good candidate for this use caselibguestfs
cannot write (an answer file) to an ISO which is why we there's no point in using using this library until we no longer need to create a whole new ISO to add the answer file to itcreate-media.sh
to add MSUs (Microsoft Update standalone packages) to be installed during the Windows PE pass (specifically "Installing updates...") of Windows setup
allow-drivers.vbs
hack by fixing SHA-256 automatic driver installation bug in newer versions of Windows 7 with KB2921916 (see allow-drivers.vbs
for details)
qubes-dom0-update
Have a feature similar (or superior) to VMWare's Windows "Easy Install" feature on Qubes OS. VMWare's solution is proprietary and only available in their paid products.
VirtualBox also has something similar but it's not as feature-rich.