Simple desktop application sandboxing tool for GNU\Linux
This tool is no longer in active development due to time constraints. While maintenance will continue when possible, updates will be less frequent. I still use it for some daily tasks but cannot extensively test it across various Linux distributions. Package updates for different host Linux distributions have ceased, as this process relied heavily on the Travis service and some other tools, which are no longer available. The only way to use the Sandboxer suite now is to build it manually from source.
Since its inception in 2012 and creation in 2016, the landscape of application isolation and containerization has evolved significantly, making it challenging to keep pace with these changes and compete with newer solutions.
The suite was originally designed to run outdated and customized development tools on modern Linux distributions more conveniently than using virtualization or simple chroot. Desktop application support was added later but was never fully optimized. It currently runs X11 apps relatively well (even with hardware acceleration) but lacks proper support for pure Wayland host sessions. Audio integration also still works with PulseAudio in sandbox and PulseAudio/Pipewire on host.
For those seeking alternatives:
It is recommended to explore these modern solutions before trying Sandboxer. However, if Sandboxer still meets your specific needs, you are welcome to use and contribute to it.
The main goal of this project is to create a customizable application sandboxing/isolation suite. In addition to sandboxing, this suite can also be used to run applications inside pre-configured custom environments based on user-made chroots, similar to server containerization software like libvirt-lxc, LXC, docker, etc.
This project relies on the “bubblewrap” utility (https://github.com/projectatomic/bubblewrap) to perform application isolation. The authors of bwrap implemented only minimal and essential functionality in their sandboxing utility. While this is good for security and ease of maintenance, it can be challenging to configure and prepare a sandboxed environment. That’s where the sandboxer suite comes in. It is a configuration wrapper and set of service utilities built on top of bubblewrap.
This software may contain security bugs due to limited development resources. Use at your own risk. For more secure isolation, consider using virtualization solutions like qemu-kvm, virtualbox, etc.
The environment constructed by your OS and used in your normal user-session is called the host environment (or simply “host”). It typically doesn’t have tight security restrictions, allowing applications to interact with each other and read/write user data. Running malicious or broken apps in an unprotected host environment may damage, delete, or steal your data and/or affect other running applications.
The Sandboxer suite runs applications inside a “sandbox” - a special environment isolated from the host that provides security against unexpected behavior of software running inside the sandbox. A single sandbox may run multiple applications that can interact with each other but not with host apps or apps from other sandboxes. To interact with sandboxed applications, there must be links connecting them to services running on the host, such as X11 service and PulseAudio. The Sandboxer suite configures and uses these links. So it is possible to seamlessly run desktop, 3D, multimedia or GPU-compute software inside sandbox.
Each sandbox environment is set up using a configuration file. A unique sandbox is bound to a configuration file and its on-disk location. The Sandboxer’s configuration system uses the Lua language (https://www.lua.org) to manage config options. Each config file is a Lua script that defines global “tables” with config options. This approach was chosen for its simplicity and extensibility, making it easier to program config options validation and transformation.
The sandbox config file must define at least two root-tables:
To launch multiple applications inside a bubblewrap-controlled sandbox, the Sandboxer suite includes its own session management utilities:
These utilities are written in C for optimal portability and resource efficiency. They are not intended for direct use, as command-line parameters and internal logic may change in future releases without notice.
The main sandboxer utility performs preparation tasks on the host system at sandboxed application startup/shutdown. These tasks include copying configuration files, defining mounts for rootfs inside the sandbox, and setting command-line options for bubblewrap. The utility and its components are currently written in Bash scripting language for rapid development, aiming to use native Bash features for portability across different systems.
sandboxer <sandbox config file> <exec profile> [parameters for application inside sandbox]
Execution must be performed from a regular user account. Running from root is not supported and would be insecure.
./download-ubuntu-chroot.sh 24.04
(run as regular user, DO NOT run this as root!)sandboxer debian-setup.cfg.lua fakeroot_shell
/root/debian-minimal-setup.sh
inside the sandbox shell.sandboxer debian-sandbox.cfg.lua shell
The Sandboxer suite requires:
bwrap
) utilitybwrap-apparmor-rule
example)For building and installing:
Use your package manager if bubblewrap is available. To build and install manually, run the “build-bwrap.sh” script.
Run the build.sh script to download and build all external dependencies and binary components. This script builds the executor, commander, and x11util binaries, as well as the fakeroot-userns binaries from an external repository.
Run install-to-home.sh after build.sh completes successfully. It will install the sandboxer suite and examples to “$HOME/sandboxer” and create a symlink to the main utility at “$HOME/bin/sandboxer”. You can pass a custom target installation path as a parameter.
The sandboxer-download-extra.sh utility is used to download precompiled binaries for running in sandboxes with older or newer Linux distributions. Host-compiled versions of these utilities may be incompatible with sandboxed Linux distributions of different versions (especially older ones). This utility checks, downloads, and verifies precompiled helper utilities for use with different types of external root-fs sandboxes.
To use the utility, run:
sandboxer-download-extra.sh [space separated targets list]
If no targets are specified, it will download binaries for debian-i386, debian-amd64, ubuntu-amd64, and ubuntu-24.04-amd64 by default. The downloaded components will be placed in ~/.cache/sandboxer, which can be removed if no longer needed.
Copyright (c) 2016-2024 DarkCaster, see LICENSE for details.