Repository navigation
Creating Profiles
~/.config/firejail/ is the place for user-defined profiles.
The default configuration starts any program with a profile in a sandbox. However a user can still run without firejail (/usr/bin/firefox) and use the commandline (firejail --noprofile firefox, firejail --profile=myprofile firefox). Likewise any local non-admin user may change firejail behavior by editing ~/.config/firejail.
Profiles are configurations defined as how Firejail will treat the application being run under it. This defines options such as what directories it has access to, what base system functionality it has access to, and so on.
The execution sequence is generally the following:
- Command line parameter execution as customizations
- Recursive running the profiles
- Redirection due to alias profile (loading full profile)
- Local customization
- Global customization
- Profile content (which often uses common settings)
See Locations and Types, or the profile template in /usr/share/doc/firejail/profile.template and the man page for understanding the customizations.
Every file in a firejail directory (/etc/firejail or /usr/local/etc/firejail when compiled without --prefix=/usr, ~/.config/firejail) is basically a profile. They all follow the same syntax.
However, there are still some different file types:
- Regular profiles (
.profile)- It contains settings for a specific application, like
curl.profile - There are a few subtypes:
- Regular profiles, like
curl.profile - Alias profiles, like
atom-beta.profile. They usually only containincludestatements.atom-betais very similar toatom, so the same sandboxing settings are used. - Common profiles, like
firefox-common.profile. Some applications have different flavors, like Firefox, and all have some sandboxing settings in common.
- Regular profiles, like
- It contains settings for a specific application, like
- Overrides (
.local)- This file contains overrides which can override specific parts of a regular profile, like
curl.local. Also see this wiki page -
globals.localis a special override file. It will affect every regular profile.
- This file contains overrides which can override specific parts of a regular profile, like
- Includes (
.inc)- Every file type can be included, see the recurring
include globals.localandinclude $application.localparts of almost every profile but this file type usually contains useful reusable statements, likedisable-common.inc - An include will fail if the file you want to include does not exist, except when trying to include a
.localfile. - There are some subtypes:
- Includes that start with
allowhandle allowing access to certain paths. e.gallow-ruby.incwill allow access to certain ruby paths, which the application may need for addons/plugins. -
disable-*includes handle blacklisting paths, like disallowing access to sensible files. -
whitelist-*includes contain statements necessary for whitelisting profiles - Everything else is a special application-specific include, like
firefox-common-addons.inc
- Includes that start with
- Every file type can be included, see the recurring
Depending on where you put a file, it might override other files.
Files in ~/.config/firejail have a higher priority than /etc/firejail (or /usr/local/etc/firejail), so if /etc/firejail/curl.profile and ~/.config/firejail/curl.profile both exist, firejail uses ~/.config/firejail/curl.profile. This applies to every file type mentioned above.
System-wide profiles for pull requests are supposed to be created in folder etc and are
based on a template in /usr/share/doc/firejail/profile.template.
The process is fairly straightforward, given the template:
- Copy
etc/templates/profile.templateto~/PROGRAM.profile - Open
~/PROGRAM.profilein a text editor and follow the introductions in the file. To run usefirejail --profile=PROGRAM.profile PROGRAM. If your program acts like a similar program (e.g. an electron app is similar to Discord and teams-for-linux), you can look at their profiles.
The debugger options--debug,--debug-{blacklists, caps, errnos, private-lib, protocols, syscalls, whitelists},--trace,--buildand--auditmay be of use. - Create a pull request.
-
blacklist PATH:PATHis still present, but not accessible (withwhitelistthey don't exist) -
noblacklist ~/Documents/presentationsblacklist ~/Documents: does not work - whitelisting in profiles: new files are not saved (=> don't use for text editors, image editing software, ... )
- Write fail-safe profiles: If someone decides to un-whitelist the wire profile, sensitive files should not be be visible inside the sandbox. For example for the wire profile, see whitelist-noblacklist
noblacklist ${HOME}/.config/Wire
mkdir ${HOME}/.config/Wire
whitelist ${HOME}/.config/Wire