man firejail-profile

FIREJAIL-PROFILE(5)       firejail profiles man page      FIREJAIL-PROFILE(5)

NAME
       profile - Security profile file syntax for Firejail

USAGE
       firejail --profile=filename.profile

DESCRIPTION
       Several  command  line options can be passed to the program using pro‐
       file files. Firejail chooses the profile file as follows:

       1. If a profile file is provided by the user  with  --profile  option,
       the profile file is loaded.  Example:

              $ firejail --profile=/home/netblue/icecat.profile icecat
              Reading profile /home/netblue/icecat.profile
              [...]

       2.  If a profile file with the same name as the application is present
       in ~/.config/firejail directory or in /etc/firejail,  the  profile  is
       loaded.  ~/.config/firejail takes precedence over /etc/firejail. Exam‐
       ple:

              $ firejail icecat
              Command name #icecat#
              Found icecat profile in  /home/netblue/.config/firejail  direc‐
              tory
              Reading profile /home/netblue/.config/firejail/icecat.profile
              [...]

       3.  Use  a default.profile file if the sandbox is started by a regular
       user, or a server.profile file if the  sandbox  is  started  by  root.
       Firejail  looks  for these files in ~/.config/firejail directory, fol‐
       lowed by /etc/firejail directory.  To disable default profile loading,
       use --noprofile command option. Example:

              $ firejail
              Reading profile /etc/firejail/default.profile
              Parent pid 8553, child pid 8554
              Child process initialized
              [...]

              $ firejail --noprofile
              Parent pid 8553, child pid 8554
              Child process initialized
              [...]

Scripting
       Scripting commands:

       File and directory names
              File  and  directory names containing spaces are supported. The
              space character ' ' should not be escaped.

              Example: "blacklist ~/My Virtual Machines"

       # this is a comment

       include other.profile
              Include other.profile file.

              Example: "include /etc/firejail/disable-common.inc"

              The file name can be prefixed with a macro such as  ${HOME}  or
              ${CFG}.  ${HOME} is expanded as user home directory, and ${CFG}
              is expanded as Firejail system  configuration  directory  -  in
              most cases /etc/firejail or /usr/local/etc/firejail.

              Example:   "include   ${HOME}/myprofiles/profile1"   will  load
              "~/myprofiles/profile1" file.

              Example: "include ${CFG}/firefox.profile" will load "/etc/fire‐
              jail/firefox.profile" file.

              System  configuration  files  in  ${CFG} are overwritten during
              software  installation.   Persistent  configuration  at  system
              level  is  handled in ".local" files. For every profile file in
              ${CFG} directory, the user can create  a  corresponding  .local
              file  storing  modifications  to  the persistent configuration.
              Persistent .local files are included at the  start  of  regular
              profile files.

       noblacklist file_name
              If the file name matches file_name, the file will not be black‐
              listed in any blacklist commands that follow.

              Example: "noblacklist ${HOME}/.mozilla"

       nowhitelist file_name
              If the file name  matches  file_name,  the  file  will  not  be
              whitelisted in any whitelist commands that follow.

              Example: "nowhitelist ~/.config"

       ignore Ignore command.

              Example: "ignore seccomp"

       quiet  Disable Firejail's output. This should be the first uncommented
              command in the profile file.

              Example: "quiet"

Filesystem
       These profile entries define a chroot filesystem built on top  of  the
       existing  host  filesystem. Each line describes a file element that is
       removed from the filesystem (blacklist), a read-only file or directory
       (read-only),  a tmpfs mounted on top of an existing directory (tmpfs),
       or mount-bind a directory  or file on top of another directory or file
       (bind).  Use private to set private mode.  File globbing is supported,
       and PATH and HOME directories are searched.  Examples:

       blacklist file_or_directory
              Blacklist directory or file. Examples:

              blacklist /usr/bin
              blacklist /usr/bin/gcc*
              blacklist ${PATH}/ifconfig
              blacklist ${HOME}/.ssh

       blacklist-nolog file_or_directory
              When --tracelog flag is set, blacklisting generates syslog mes‐
              sages  if  the  sandbox  tries to access the file or directory.
              blacklist-nolog command disables syslog messages for this  par‐
              ticular file or directory. Examples:

              blacklist-nolog /usr/bin
              blacklist-nolog /usr/bin/gcc*

       bind directory1,directory2
              Mount-bind directory1 on top of directory2. This option is only
              available when running as root.

       bind file1,file2
              Mount-bind file1 on top of file2. This option is only available
              when running as root.

       disable-mnt
              Disable /mnt, /media, /run/mount and /run/media access.

       mkdir directory
              Create  a directory in user home or under /tmp before the sand‐
              box is started.  The directory is created if it doesn't already
              exist.

              Use  this  command for whitelisted directories you need to pre‐
              serve when the sandbox is closed. Without it,  the  application
              will  create  the  directory, and the directory will be deleted
              when the sandbox is closed. Subdirectories are recursively cre‐
              ated. Example from firefox profile:

              mkdir ~/.mozilla
              whitelist ~/.mozilla
              mkdir ~/.cache/mozilla/firefox
              whitelist ~/.cache/mozilla/firefox

       mkfile file
              Similar  to  mkdir, this command creates a file in user home or
              under /tmp before the sandbox is started.  The file is  created
              if it doesn't already exist.

       noexec file_or_directory
              Remount the file or the directory noexec, nodev and nosuid.

       overlay
              Mount   a   filesystem  overlay  on top of the current filesys‐
              tem.  The overlay is stored  in  $HOME/.firejail/   direc‐
              tory.

       overlay-named name
              Mount   a   filesystem  overlay  on top of the current filesys‐
              tem.  The overlay is stored in $HOME/.firejail/name  directory.

       overlay-tmpfs
              Mount  a  filesystem  overlay  on top of the  current  filesys‐
              tem.   All  filesystem   modifications  are  discarded when the
              sandbox is closed.

       private
              Mount  new  /root  and  /home/user  directories  in   temporary
              filesystems.  All  modifications are discarded when the sandbox
              is closed.

       private directory
              Use directory as user home.

       private-home file,directory
              Build a new user home in a temporary filesystem, and  copy  the
              files  and directories in the list in the new home. All modifi‐
              cations are discarded when the sandbox is closed.

       private-bin file,file
              Build a new /bin in a temporary filesystem, and copy  the  pro‐
              grams  in  the  list.   The same directory is also bind-mounted
              over /sbin, /usr/bin and /usr/sbin.

       private-dev
              Create a new /dev directory. Only dri, null, full,  zero,  tty,
              pts, ptmx, random, urandom, log and shm devices are available.

       private-etc file,directory
              Build  a new /etc in a temporary filesystem, and copy the files
              and directories in the list.  All modifications  are  discarded
              when the sandbox is closed.

       private-lib file,directory
              Build  a new /lib directory and bring in the libraries required
              by the application to run.  This feature is still under  devel‐
              opment, see man 1 firejail for some examples.

       private-opt file,directory
              Build  a  new /optin a temporary filesystem, and copy the files
              and directories in the list.  All modifications  are  discarded
              when the sandbox is closed.

       private-srv file,directory
              Build  a new /srv in a temporary filesystem, and copy the files
              and directories in the list.  All modifications  are  discarded
              when the sandbox is closed.

       private-tmp
              Mount  an  empty  temporary filesystem on top of /tmp directory
              whitelisting /tmp/.X11-unix.

       read-only file_or_directory
              Make directory or file read-only.

       read-write file_or_directory
              Make directory or file read-write.

       tmpfs directory
              Mount an empty tmpfs  filesystem  on  top  of  directory.  This
              option is available only when running the sandbox as root.

       tracelog
              Blacklist violations logged to syslog.

       whitelist file_or_directory
              Whitelist directory or file. A temporary file system is mounted
              on the top directory, and  the  whitelisted  files  are  mount-
              binded  inside.  Modifications to whitelisted files are persis‐
              tent, everything else is discarded when the sandbox is  closed.
              The top directory could be user home, /dev, /media, /mnt, /opt,
              /srv, /var, and /tmp.

              Symbolic link handling: with the exception of user  home,  both
              the link and the real file should be in the same top directory.
              For user home, both the link and the real file should be  owned
              by the user.

       writable-etc
              Mount /etc directory read-write.

       writable-var
              Mount /var directory read-write.

       writable-var-log
              Use  the  real  /var/log  directory, not a clone. By default, a
              tmpfs is mounted on top of /var/log directory, and  a  skeleton
              filesystem is created based on the original /var/log.

Security filters
       The following security filters are currently implemented:

       apparmor
              Enable AppArmor confinement.

       caps   Enable default Linux capabilities filter.

       caps.drop all
              Blacklist all Linux capabilities.

       caps.drop capability,capability,capability
              Blacklist given Linux capabilities.

       caps.keep capability,capability,capability
              Whitelist given Linux capabilities.

       protocol protocol1,protocol2,protocol3
              Enable  protocol  filter.  The  filter  is based on seccomp and
              checks the first argument to  socket  system  call.  Recognized
              values: unix, inet, inet6, netlink and packet.

       seccomp
              Enable seccomp filter and blacklist the syscalls in the default
              list. See man 1 firejail for more details.

       seccomp syscall,syscall,syscall
              Enable seccomp filter and blacklist the  system  calls  in  the
              list on top of default seccomp filter.

       seccomp.block-secondary
              Enable  seccomp  filter and filter system call architectures so
              that only the native architecture is allowed.

       seccomp.drop syscall,syscall,syscall
              Enable seccomp filter and blacklist  the system  calls  in  the
              list.

       seccomp.keep syscall,syscall,syscall
              Enable  seccomp  filter  and  whitelist the system calls in the
              list.

       memory-deny-write-execute
              Install a seccomp filter to block  attempts  to  create  memory
              mappings  that are both writable and executable, to change map‐
              pings to be executable or to create executable shared memory.

       nonewprivs
              Sets the NO_NEW_PRIVS prctl.  This ensures that child processes
              cannot  acquire new privileges using execve(2);  in particular,
              this means that calling a suid binary (or one with  file  capa‐
              bilities) does not result in an increase of privilege.

       noroot Use  this  command   to enable an user namespace. The namespace
              has only one user, the current user.  There is no root  account
              (uid 0) defined in the namespace.

       x11    Enable X11 sandboxing.

       x11 none
              Blacklist  /tmp/.X11-unix  directory,  ${HOME}/.Xauthority  and
              file specified in ${XAUTHORITY} environment  variable.   Remove
              DISPLAY  and XAUTHORITY environment variables.  Stop with error
              message if X11 abstract socket will be accessible in jail.

       x11 xephyr
              Enable X11 sandboxing with Xephyr server.

       x11 xorg
              Enable X11 sandboxing with X11 security extension.

       x11 xpra
              Enable X11 sandboxing with Xpra server.

       x11 xvfb
              Enable X11 sandboxing with Xvfb server.

       xephyr-screen WIDTHxHEIGHT
              Set screen size for x11 xephyr. This command should be included
              in the profile file before x11 xephyr command.

              Example:

              xephyr-screen 640x480
              x11 xephyr

Resource limits, CPU affinity, Control Groups
       These  profile entries define the limits on system resources (rlimits)
       for the processes inside the sandbox.   The  limits  can  be  modified
       inside  the sandbox using the regular ulimit command. cpu command con‐
       figures the CPU cores available, and cgroup command place the  sandbox
       in an existing control group.

       Examples:

       rlimit-fsize 1024
              Set  the  maximum file size that can be created by a process to
              1024 bytes.

       rlimit-nproc 1000
              Set the maximum number of processes that can be created for the
              real user ID of the calling process to 1000.

       rlimit-nofile 500
              Set the maximum number of files that can be opened by a process
              to 500.

       rlimit-sigpending 200
              Set the maximum number of processes that can be created for the
              real user ID of the calling process to 200.

       cpu 0,1,2
              Use only CPU cores 0, 1 and 2.

       nice -5
              Set  a  nice  value  of  -5 to all processes running inside the
              sandbox.

       cgroup /sys/fs/cgroup/g1/tasks
              The sandbox is placed in g1 control group.

User Environment
       allusers
              All user home directories are visible inside  the  sandbox.  By
              default, only current user home directory is visible.

       name sandboxname
              Set sandbox name. Example:

              name browser

       env name=value
              Set environment variable. Examples:

              env LD_LIBRARY_PATH=/opt/test/lib
              env CFLAGS="-W -Wall -Werror"

       nodvd  Disable DVD and audio CD devices.

       nogroups
              Disable supplementary user groups

       shell none
              Run the program directly, without a shell.

       ipc-namespace
              Enable IPC namespace.

       nosound
              Disable sound system.

       notv   Disable DVB (Digital Video Broadcasting) TV devices.

       novideo
              Disable video devices.

       no3d   Disable 3D hardware acceleration.

Networking
       Networking features available in profile files.

       defaultgw address
              Use  this  address as default gateway in the new network names‐
              pace.

       dns address
              Set a DNS server for the sandbox. Up to three DNS  servers  can
              be defined.

       hostname name
              Set a hostname for the sandbox.

       hosts-file file
              Use file as /etc/hosts.

       ip address
              Assign  IP addresses to the last network interface defined by a
              net command. A default gateway is assigned by default.

              Example:
              net eth0
              ip 10.10.20.56

       ip none
              No IP address and no default gateway  are  configured  for  the
              last  interface  defined  by  a net command. Use this option in
              case you intend to start an external DHCP client in  the  sand‐
              box.

              Example:
              net eth0
              ip none

       ip6 address
              Assign  IPv6 addresses to the last network interface defined by
              a net command.

              Example:
              net eth0
              ip6 2001:0db8:0:f101::1/64

       iprange address,address
              Assign  an  IP address in the provided range to the  last  net‐
              work interface defined by  a  net command.  A  default  gateway
              is assigned by default.

              Example:

              net eth0
              iprange 192.168.1.150,192.168.1.160

       mac address
              Assign MAC addresses to the last network interface defined by a
              net command.

       machine-id
              Spoof  id  number  in /etc/machine-id file - a new random id is
              generated inside the sandbox.

       mtu number
              Assign a MTU value to the last network interface defined  by  a
              net command.

       netfilter
              If  a new network namespace is created, enabled default network
              filter.

       netfilter filename
              If a new network namespace is created, enabled the network fil‐
              ter in filename.

       net bridge_interface
              Enable  a  new  network namespace and connect it to this bridge
              interface.  Unless specified with option --ip and  --defaultgw,
              an  IP address and a default gateway will be assigned automati‐
              cally to the sandbox. The IP  address  is  verified  using  ARP
              before assignment. The address configured as default gateway is
              the bridge device IP address. Up to four --net  bridge  devices
              can be defined. Mixing bridge and macvlan devices is allowed.

       net ethernet_interface
              Enable  a new network namespace and connect it to this ethernet
              interface using the standard Linux macvlan driver. Unless spec‐
              ified  with  option  --ip  and --defaultgw, an IP address and a
              default gateway will be assigned automatically to the  sandbox.
              The  IP  address  is  verified using ARP before assignment. The
              address configured as default gateway is the default gateway of
              the  host.  Up  to  four  --net  devices can be defined. Mixing
              bridge and macvlan devices is allowed.  Note: wlan devices  are
              not supported for this option.

       net none
              Enable a new, unconnected network namespace. The only interface
              available in the new namespace  is  a  new  loopback  interface
              (lo).   Use this option to deny network access to programs that
              don't really need network access.

       veth-name name
              Use this name for the interface connected  to  the  bridge  for
              --net=bridge_interface commands, instead of the default one.

Other
       join-or-start sandboxname
              Join  the  sandbox identified by name or start a new one.  Same
              as "firejail --join=sandboxname" command if sandbox with speci‐
              fied name exists, otherwise same as "name sandboxname".

RELOCATING PROFILES
       For various reasons some users might want to keep the profile files in
       a different directory.   Using  --profile-path  command  line  option,
       Firejail can be instructed to look for profiles into this directory.

       This  is  an example of relocating the profile files into a new direc‐
       tory, /home/netblue/myprofiles. Start by creating  the  new  directory
       and copy all the profile files in:

       $ mkdir ~/myprofiles && cd ~/myprofiles && cp /etc/firejail/* .

       Using sed utility, modify the absolute paths for include commands:

       $ sed -i "s/\/etc\/firejail/\/home\/netblue\/myprofiles/g" *.profile
       $ sed -i "s/\/etc\/firejail/\/home\/netblue\/myprofiles/g" *.inc

       Start Firejail using the new path:

       $ firejail --profile-path=~/myprofiles

FILES
       /etc/firejail/filename.profile,   $HOME/.config/firejail/filename.pro‐
       file

LICENSE
       Firejail is free software; you can redistribute it  and/or  modify  it
       under  the terms of the GNU General Public License as published by the
       Free Software Foundation; either version 2 of the License, or (at your
       option) any later version.

       Homepage: https://firejail.wordpress.com

SEE ALSO
       firejail(1), firemon(1), firecfg(1), firejail-login(5)

0.9.50                             Sep 2017               FIREJAIL-PROFILE(5)
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s