From 460fa7a6f98cc1e7aec2953e6523f32677d546c7 Mon Sep 17 00:00:00 2001 From: Азалия Смарагдова Date: Tue, 16 Aug 2022 12:03:50 +0500 Subject: Proposed fixes. --- src/man/firejail-profile.txt | 24 +++++++++++++------- src/man/firejail.txt | 53 ++++++++++++++++++++++++++++++++++++-------- 2 files changed, 60 insertions(+), 17 deletions(-) (limited to 'src/man') diff --git a/src/man/firejail-profile.txt b/src/man/firejail-profile.txt index 6e75aceed..1f543980e 100644 --- a/src/man/firejail-profile.txt +++ b/src/man/firejail-profile.txt @@ -499,23 +499,31 @@ Blacklist all Linux capabilities. Whitelist given Linux capabilities. #ifdef HAVE_LANDLOCK .TP -\fBlandlock-read path -Create a Landlock ruleset (if it doesn't already exist) and add a read access rule for path. Note: if a process doesn't have CAP_SYS_ADMIN and the "No New Privileges" restriction is not enabled, the Landlock self-restriction will fail and Firejail will exit with an error. +\fBlandlock +Create a Landlock ruleset (if it doesn't already exist) and add basic access rules to it. +.br +.TP +\fBlandlock.proc no|ro|rw +Add an access rule for /proc directory (read-only if set to \fBro\fR and read-write if set to \fBrw\fR). The access rule for /proc is added after this directory is set up in the sandbox. Access rules for /proc set up with other Landlock-related profile options have no effect. +.br +.TP +\fBlandlock.read path +Create a Landlock ruleset (if it doesn't already exist) and add a read access rule for path. .br .TP -\fBlandlock-write path -Create a Landlock ruleset (if it doesn't already exist) and add a write access rule for path. Note: if a process doesn't have CAP_SYS_ADMIN and the "No New Privileges" restriction is not enabled, the Landlock self-restriction will fail and Firejail will exit with an error. +\fBlandlock.write path +Create a Landlock ruleset (if it doesn't already exist) and add a write access rule for path. .br .TP -\fBlandlock-restricted-write path -Create a Landlock ruleset (if it doesn't already exist) and add a write access rule for path. This type of write access doesn't include the permission to create Unix domain sockets, FIFO pipes and block devices. Note: if a process doesn't have CAP_SYS_ADMIN and the "No New Privileges" restriction is not enabled, the Landlock self-restriction will fail and Firejail will exit with an error. +\fBlandlock.special path +Create a Landlock ruleset (if it doesn't already exist) and add an access rule for creation of FIFO pipes, Unix-domain sockets and block devices beneath given path. .br .TP -\fBlandlock-execute path -Create a Landlock ruleset (if it doesn't already exist) and add an execution permission rule for path. Note: if a process doesn't have CAP_SYS_ADMIN and the "No New Privileges" restriction is not enabled, the Landlock self-restriction will fail and Firejail will exit with an error. +\fBlandlock.execute path +Create a Landlock ruleset (if it doesn't already exist) and add an execution permission rule for path. .br #endif .TP diff --git a/src/man/firejail.txt b/src/man/firejail.txt index 7082fe0ab..7922a53d0 100644 --- a/src/man/firejail.txt +++ b/src/man/firejail.txt @@ -1146,29 +1146,37 @@ $ firejail --keep-var-tmp #ifdef HAVE_LANDLOCK .TP -\fB\-\-landlock-read=path -Create a Landlock ruleset (if it doesn't already exist) and add a read access rule for path. Note: if a process doesn't have CAP_SYS_ADMIN and the "No New Privileges" restriction is not enabled, the Landlock self-restriction will fail and Firejail will exit with an error. +\fB\-\-landlock +Create a Landlock ruleset (if it doesn't already exist) and add basic access rules to it. See \fBLANDLOCK\fR section for more information. +.br +.TP +\fB\-\-landlock.proc=no|ro|rw +Add an access rule for /proc directory (read-only if set to \fBro\fR and read-write if set to \fBrw\fR). The access rule for /proc is added after this directory is set up in the sandbox. Access rules for /proc set up with other Landlock-related command-line options have no effect. +.br +.TP +\fB\-\-landlock.read=path +Create a Landlock ruleset (if it doesn't already exist) and add a read access rule for path. .br .TP -\fB\-\-landlock-write=path -Create a Landlock ruleset (if it doesn't already exist) and add a write access rule for path. Note: if a process doesn't have CAP_SYS_ADMIN and the "No New Privileges" restriction is not enabled, the Landlock self-restriction will fail and Firejail will exit with an error. +\fB\-\-landlock.write=path +Create a Landlock ruleset (if it doesn't already exist) and add a write access rule for path. .br .TP -\fB\-\-landlock-restricted-write=path -Create a Landlock ruleset (if it doesn't already exist) and add a write access rule for path. This type of write access doesn't include the permission to create Unix domain sockets, FIFO pipes and block devices. Note: if a process doesn't have CAP_SYS_ADMIN and the "No New Privileges" restriction is not enabled, the Landlock self-restriction will fail and Firejail will exit with an error. +\fB\-\-landlock.special=path +Create a Landlock ruleset (if it doesn't already exist) and add a permission rule to create FIFO pipes, Unix domain sockets and block devices beneath given path. .br .TP -\fB\-\-landlock-execute=path -Create a Landlock ruleset (if it doesn't already exist) and add an execution permission rule for path. Note: if a process doesn't have CAP_SYS_ADMIN and the "No New Privileges" restriction is not enabled, the Landlock self-restriction will fail and Firejail will exit with an error. +\fB\-\-landlock.execute=path +Create a Landlock ruleset (if it doesn't already exist) and add an execution permission rule for path. .br .br Example: .br -$ firejail \-\-landlock-read=/ \-\-landlock-restricted-write=/home \-\-landlock-execute=/usr +$ firejail \-\-landlock.read=/ \-\-landlock.write=/home \-\-landlock.execute=/usr #endif .TP @@ -3216,7 +3224,34 @@ To enable AppArmor confinement on top of your current Firejail security features .br $ firejail --apparmor firefox #endif +#ifdef HAVE_LANDLOCK +.SH LANDLOCK +.TP +Landlock is a Linux security module first introduced in the 5.13 version of Linux kernel. It allows unprivileged processes to restrict their access to the filesystem. Once imposed, these restrictions can never be removed, and all child processes created by a Landlock-restricted processes inherit these restrictions. Firejail supports Landlock as an additional sandboxing feature. It can be used to ensure that a sandboxed application can only access files and directories that it was explicitly allowed to access. Firejail supports populating the ruleset with both basic set of rules and with custom set of rules. Basic set of rules allows read-only access to /bin, /dev, /etc, /lib, /opt, /proc, /usr and /var, read-write access to the home directory, and allows execution of binaries located in /bin, /opt and /usr. +.br + +.TP +Important notes: +.br +.br +- A process can install a Landlock ruleset only if it has either \fBCAP_SYS_ADMIN\fR in its effective capability set, or the "No New Privileges" restriction enabled. Because of this, enabling the Landlock feature will also cause Firejail to enable the "No New Privileges" restriction, regardless of the profile or the \fB\-\-no\-new\-privs\fR command line option. +.br + +.br +- Access to the /proc directory is managed through the \fB\-\-landlock.proc\fR command line option. + +.br +- Access to the /etc directory is automatically allowed. To override this, use the \fB\-\-writable\-etc\fR command line option. You can also use the \fB\-\-private\-etc\fR option to restrict access to the /etc directory. +.br + +.TP +To enable Landlock self-restriction on top of your current Firejail security features, pass \fB\-\-landlock\fR flag to Firejail command line. You can also use \fB\-\-landlock.read\fR, \fB\-\-landlock.write\fR, \fB\-\-landlock.special\fR and \fB\-\-landlock.execute\fR options together with \fB\-\-landlock\fR or instead of it. Example: +.br + +.br +$ firejail --landlock --landlock.read=/media --landlock.proc=ro mc +#endif .SH DESKTOP INTEGRATION A symbolic link to /usr/bin/firejail under the name of a program, will start the program in Firejail sandbox. The symbolic link should be placed in the first $PATH position. On most systems, a good place -- cgit v1.2.3-70-g09d2