Connecting to isolated system environments using Waypipe
aluminium-tin-foil-hat_exw.jpg
Continuing with the previous boring opuses about environment isolation, it’s time to remember Wayland.
Of course, this is not a call to action, but just simple examples and reflections.
I personally adhere to a philosophy where the user is the center of the system, and he has the right to configure everything as he sees fit, and not as it is imposed by general trends, or as it is implemented in a specific distribution, at the same time understanding and accepting all the risks and consequences of these actions.
As the saying goes, “If you know what you are doing.”
And before we begin, it’s worth writing again that:
- Yes, I understand that this is all very superficial.
- Yes, any connections to the local graphical shell are not allowed for anything dangerous, and you must use VNC or virt-viewer/spice.
- Unprivileged LXC should be replaced with Xen / KVM
- And yes, I know that it is possible to breakout from KVM isolation too.
- I know about Flatpak.
- And finally, yes, I have known about Qubes OS and its architecture, let’s say, since its inception, which was 2010.
And, simplifying and adapting QubesOS ideas to my everyday needs, I prefer to use either other local users or lightweight unprivileged LXC environments.
And yes, I don’t run anything potentially dangerous in them, but rather something that many of you use directly under your system account, for example:
- Firefox for everyday use and casual browsing.
- Several projects using packages from PyPI, RubyGems.
- Separately, what I compile from sources from GitHub.
- Third-party programs, such as element-desktop, Telegram, Zoom.
What does this give?
- Mitigating the consequences of typical and common attacks.
- The ability to customize an individual environment for each set of specific programs, with smooth interaction.
- No contamination of either the system or user environment.
You simply don’t need to keep all these directories with endless configs in~/.config, or packages in~/.local. - More native support for specific software if it requires Ubuntu, CentOS, or Fedora.
Configuring .desktop files for easy launch from the KDE environment
Previously, for a long time, I used X network transparency, but Wayland is good enough and it is possible to switch to it without losing the concept, and, moreover, improving overall security.
nano /usr/share/applications/firefox.untrusted.desktop
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | |
nano /usr/share/applications/firefox.trusted.desktop
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | |
nano /usr/share/applications/chromium.trusted.desktop
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | |
A bit of routine
Here I deliberately do not want to describe everything in detail, I will only provide commands and tips.
As you may have noticed, the example uses two LXC virtual machines and three users in them.
Virtual machines do not communicate with each other, nor do users.
I prefer to use not just one user, say, for trusted tasks, but one user per application.
Unless, of course, this leads to excessive complication of file flow between different entities.
Next, you must do some preparatory work.
Deploy the required number of LXC/KVM and configure them:
- Install required software
- Passthrough the necessary hardware, such as a GPU, to accelerate hw rendering in Firefox.
Yes, additional hardware and its drivers are another attack surface ¯\_(⊙︿⊙)_/¯ - Configure iptables/nft, sshd_config, enable routing and networking
Generating ed25519 keys for SSH
1 2 3 | |
Let’s set up an SSH configuration for your user
nano /home/awesome/.ssh/config
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |
Make sure that the following lines are present in the virtual machine’s
/etc/ssh/sshd_config:
Start scripts, /usr/local/bin/ff.sh, are quite primitive.
Script for running Chromium via waypipe is a bit more complicated.
/usr/local/bin/waypipe-run-chromium.sh
We also need to remember about the sound
It is configured for users in virtual machines in the
/home/trusted-chromium/.pulse/client.conf file.
1 | |
On the host accordingly
/home/awesome/.config/pipewire/pipewire-pulse.conf.d/50-network.conf
Next comes the firewall, authorization and all that stuff that I’m too lazy to describe.
Let’s set each application’s own icon
In addition to setting up Wayland itself, I had to spend quite a lot of time searching for ways to customize specific icons for specific windows.
Here is one of the solutions.
This is an example for /usr/share/applications/firefox.untrusted.desktop
Let’s add some visuals and amenities
Each application, depending on its class, can be customized using either System Application Styles or, as in the case of the fox, Themes (of course only By Firefox).
I use a hidden sidebar with frequently used web apps.
All windows have correctly assigned icons.
Logically and visually, everything is simple:
- Red - everyday web surfing, 95% of websites.
- Blue - development. Only my own and trusted sites / APIs.
- Green - banking, personal information.
If a website doesn’t work correctly in fox, and this does happen, there’s a corresponding Chromium or Google Chrome browser.
Let’s configure compatibility for X11 applications
Not just web surfing
The examples above show how to use browsers from different isolated virtual machines with a connection to Wayland via waypipe.
Similarly, you can launch various editors/IDEs, specialized applications, and configure unique interaction environments for specific versions of operating systems and software.
You can maintain this separately from the Host and your user, as well as from other projects.
And get quite convenient and safe access to use.
Trend direction
Just a few days ago, Fedora Hummingbird was released.
The central goal of Project:
- to get as close to zero CVE reports as possible in every container image it ships, and to stay there continuously.
While it’s important to quickly deliver updates for packages like Python, Go, Node.js, Rust, Ruby, OpenJDK, PostgreSQL, nginx, it still doesn’t solve the problem of poor organization and separation of development environments from sensitive user data.
In this sense, QubesOS remains a reference model of paranoid system. In my opinion.