I’ve really been missing the experience of Qubes OS, where all programs are properly isolated. However, I can’t install it on my daily driver because I use that machine for gaming. Instead, I’ve been exploring ways to approximate that isolation on a standard Linux setup.
Firefox Profiles
Let’s start with the browser. There are many privacy and security benefits to separating profiles. My general workflow is as follows:
- I create separate
.desktopfiles to run Firefox with different profiles. Each file uses a unique--nameandStartupWMClass=. This prevents the icons from stacking together on the GNOME Panel. - I use ImageMagick to tint the icons so I can tell the profiles apart
at a glance:
magick input.png -colorspace gray -fill "#cc0000" -tint 100 output.png - The “new” Firefox profile manager didn’t work well for me. For example, I couldn’t set a default profile for opening external URLs. I eventually had to switch back to the old profile management style.
However, while this setup isolates cookies, it doesn’t isolate processes. A compromised Firefox instance could still theoretically access data from other profiles. For better security, I’m considering:
- Installing Firefox via Flatpak and launching multiple instances with different data directories.
- Installing entirely different browsers via Flatpak.
One challenge is that some configurations (like specific extensions) need to be synced across profiles, which isn’t always easy to automate.
Flatpak
Since Fedora Silverblue provides Flatpak by default, I gave it a try and really liked it. It feels similar to the application sandboxing on modern mobile phones. I can fine-tune permissions using Flatseal, though the default permissions are usually reasonable enough that I don’t have to.
There are only two real downsides: * It isn’t obvious or easy to launch multiple independent instances of the same application (like Firefox). * The Fedora repository isn’t very comprehensive, and I’m not quite ready to switch to the Flathub repository yet.
Podman
Podman is great for accessing a wider selection of packages, though it requires more manual work to configure permissions.
Wayland
Surprisingly, it isn’t difficult to allow a container to use the host’s Wayland display. Here is an example command:
podman run \
--device /dev/dri:/dev/dri \
--env=WAYLAND_DISPLAY="${WAYLAND_DISPLAY}" \
--volume "${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}":/run/wayland-0:z \
...However, this does require some SELinux configuration, which I’ll cover below.
SELinux
Podman supports SELinux, and the :z and :Z
volume flags are useful in many cases. However, they don’t work well for
shared resources like Wayland sockets or network shares.
I used udica to analyze container images and generate
custom SELinux types. It isn’t perfect, for instance, it doesn’t
automatically detect and allow Unix sockets, but it provides a solid
base configuration.
This is where I learned about SELinux CIL (Common Intermediate
Language). Standard SELinux doesn’t strictly allow “inheritance,” but
CIL files make it possible to define a container that behaves like a
standard container while adding specific permissions (like talking to
/dev/vsock). For more on this, check out this
customization guide.
By using udica, audit2allow, and
semodule, I defined a custom SELinux type (e.g.,
my-type) for my container. Now, I just run the container
with: --security-opt label=type:my-type.process.
Security-Focused Runtimes
Generally, standard containers aren’t considered a “hard” security boundary. There are security-focused runtimes like gVisor and Kata Containers, but gVisor isn’t ideal for graphical programs, and Kata uses VMs. Since my daily driver is already a VM, I want to avoid the performance hit of nested virtualization.
Virtual Machines
For serious isolation, a VM is the gold standard. Since my daily driver is a VM with GPU passthrough, I decided that instead of nesting, the daily driver should coordinate with the host to launch headless VMs and render the graphics back to the daily driver.
I also wanted to experiment with microVMs, which seem perfect for this. I looked into several options:
Kata Containers is appealing because it supports OCI images.
Theoretically, I could run podman inside my VM to control a
podman socket on the host. libvirt might offer
a similar path.
However, I want to stick to the official Debian repositories and keep my host installation as minimal as possible. Currently, my host is just a bare-bones Debian install with QEMU.
Ultimately, I decided to see how far I could get with QEMU microvm. After a few days of tinkering, I have a working prototype. In the next post, I’ll share the details of that setup.
Comments