Secure Desktops with Qubes: Extra Protection
This article is the fourth in my series about the Qubes operating system, a security-focused Linux distribution that compartmentalizes your common desktop tasks into individual VMs. In the previous articles, I gave a general introduction to Qubes, walked through the installation process and discussed how I personally organize my own work into different appVMs. If you haven't read those earlier articles, I suggest you do so before diving in here. In this article, I focus on some of the more advanced security features in Qubes, including split-GPG, the usbVM and how I control where URLs open.
One of the concerns I've always had with my Linux desktop was with the fact that I had a copy of my GPG key on the desktop so I could use it for my email. Of course, my key was password-protected, but I still worried that if my computer ever were compromised, an attacker still could grab it and try to brute-force it.
You can use a number of different techniques to protect GPG keys, including methods that store the master key offline in an air-gapped system while you use subordinate keys. Qubes offers a pretty novel approach to GPG key security with its split GPG system that acts kind of like a poor man's Hardware Security Module. With split GPG, you store your GPG key in a highly trusted appVM, such as the vault VM Qubes installs by default. The vault has no network card at all and is designed to store sensitive files like GPG keys. When an application wants to access the GPG key to encrypt or decrypt a file, instead of calling GPG directly, it calls a wrapper script that is included in the Qubes default templates. This script asks for permission to access the vault GPG key for a limited amount of time (which means you get an unspoofable prompt on your desktop from the vault), and if you grant it permission, it will send the GPG input (data to encrypt or decrypt, for instance) to the vault. The vault then will perform the GPG operation and send the output back to the appVM. In this way, the key always stays within the vault, and the appVM never sees it.
Split GPG is relatively simple to set up with the main challenge being that because it relies on a wrapper script, any application that calls out to GPG will need to be changed to point to a script like qubes-gpg-client or qubes-gpg-client-wrapper (the former works on the command line, which preserves environment variables, and the latter works better in programs that don't preserve them well, like email clients). Qubes has great documentation on split GPG on its website that includes some diagrams, detailed explanations of how it works and its limitations, and a how-to guide with sample configs for Thunderbird and Mutt.
The first step is to make sure that the qubes-gpg-split package is
installed in your appVMs (you should be able to use your regular package
manager to install it if it isn't) and that qubes-gpg-split-dom0 is
installed in dom0 (if not run
in a dom0 terminal).
Once the software is installed, put your GPG keyring into the appVM you
want to use as your vault. I recommend the default vault unless you have
more advanced and specific reasons you want to use another appVM. Execute
some GPG command-line commands from a terminal in the vault (such as
gpg -K) to confirm that the GPG key is installed correctly.
Now to use split GPG, just set the
QUBES_GPG_DOMAIN environment variable
to the name of the appVM that has your GPG key, and then you should
be able to run qubes-gpg-client from that appVM with the same kind
of arguments you normally would pass GPG. For applications like mail
clients that may not be able to load that environment variable, you must
use qubes-gpg-client-wrapper instead. This script is configured to read
the contents of the /rw/config/gpg-split-domain file to determine which
appVM to use, so be sure it contains the name of your vault:
$ sudo bash -c 'echo vault > /rw/config/gpg-split-domain'
That's pretty much it for basic GPG usage. The one major use case it doesn't cover is importing keys from an appVM back to the vault. You want to import keys in a trusted way, so Qubes provides a different script for this purpose that will prompt you from the vault in an unspoofable window before it imports the key. To import a key, just use this:
$ export QUBES_GPG_DOMAIN=vault $ qubes-gpg-import-key somekey.asc
That should be enough to get you started with split GPG, but if you need particular split GPG configuration examples for applications like Thunderbird, Mutt, and Git, I recommend checking out the Qubes split GPG documentation page.
Kyle Rankin is a VP of engineering operations at Final, Inc., the author of a number of books including DevOps Troubleshooting and The Official Ubuntu Server Book, and is a columnist for Linux Journal. Follow him @kylerankin.
- VMware's Clarity Design System
- Let's Go to Mars with Martian Lander
- On Your Marks, Get Set...Gutsy Gibbon!
- Applied Expert Systems, Inc.'s CleverView for TCP/IP on Linux
- Papa's Got a Brand New NAS
- My Childhood in a Cigar Box
- Rogue Wave Software's TotalView for HPC and CodeDynamics
- Panther MPC, Inc.'s Panther Alpha
- Simplenote, Simply Awesome!
- Jetico's BestCrypt Container Encryption for Linux