After a year of development published new version of tools for organizing the work of isolated environments Bubblewrap 0.9, used to restrict individual applications of unprivileged users. In practice, Bubblewrap is used by the Flatpak project as a layer to isolate applications launched from packages. The project code is written in C and distributed by licensed under LGPLv2+.
For isolation, traditional Linux container virtualization technologies are used, based on the use of cgroups, namespaces, Seccomp and SELinux. To perform privileged operations to configure a container, Bubblewrap is launched with root rights (an executable file with a suid flag) and then resets privileges after the container is initialized.
Activation of user namespaces in the namespace system, which allows you to use your own separate set of identifiers in containers, is not required for operation, since it does not work by default in many distributions (Bubblewrap is positioned as a limited suid implementation of a subset of user namespaces capabilities – to exclude all user and process identifiers from the environment, except the current one, the CLONE_NEWUSER and CLONE_NEWPID modes are used). For additional protection, programs executed under Bubblewrap are launched in the PR_SET_NO_NEW_PRIVS mode, which prohibits the acquisition of new privileges, for example, if the setuid flag is present.
Isolation at the file system level is accomplished by creating a new mount namespace by default, in which an empty root partition is created using tmpfs. If necessary, external FS partitions are attached to this partition in the “mount –bind” mode (for example, when launched with the “bwrap –ro-bind /usr /usr” option, the /usr partition is forwarded from the main system in read-only mode). Network capabilities are limited to access to the loopback interface with network stack isolation via the CLONE_NEWNET and CLONE_NEWUTS flags.
The key difference from the similar Firejail project, which also uses the setuid launch model, is that in Bubblewrap the container creation layer includes only the necessary minimum capabilities, and all the advanced functions necessary for running graphical applications, interacting with the desktop and filtering requests to Pulseaudio, transferred to the Flatpak side and executed after the privileges have been reset. Firejail, on the other hand, combines all the related functions in one executable file, which makes it difficult to audit and maintain security at the proper level.
In the new release:
- Files generated in Autotools have been removed from the source package. The Meson build system is now recommended for assembly. Optional support for Autotools remains for now, but is planned to be removed in future releases.
- Added option “–argv0” to set the value of the command line zero argument (argv(0) is the name of the executable file, for example “–argv0 /usr/bin/test”).
- The “–symlink” option now only fires when a symbolic link already exists and points to the desired target file.
- Documented option “–cap-add”, used to set capability flags, for example, “CAP_DAC_READ_SEARCH”.
- Increased information content of errors displayed when a mount fails.
- The process of creating unit tests has been simplified.
- Support for older versions of Python has been discontinued in use cases.
- Improved memory allocation operations.
Thanks for reading: