@@ -8,7 +8,7 @@ Landlock: unprivileged access control
88=====================================
99
1010:Author: Mickaël Salaün
11- :Date: May 2022
11+ :Date: September 2022
1212
1313The goal of Landlock is to enable to restrict ambient rights (e.g. global
1414filesystem access) for a set of processes. Because Landlock is a stackable
@@ -69,7 +69,7 @@ should try to protect users as much as possible whatever the kernel they are
6969using. To avoid binary enforcement (i.e. either all security features or
7070none), we can leverage a dedicated Landlock command to get the current version
7171of the Landlock ABI and adapt the handled accesses. Let's check if we should
72- remove the `LANDLOCK_ACCESS_FS_REFER ` access right which is only supported
72+ remove the `` LANDLOCK_ACCESS_FS_REFER ` ` access right which is only supported
7373starting with the second version of the ABI.
7474
7575.. code-block :: c
@@ -128,7 +128,7 @@ descriptor.
128128 It may also be required to create rules following the same logic as explained
129129for the ruleset creation, by filtering access rights according to the Landlock
130130ABI version. In this example, this is not required because
131- `LANDLOCK_ACCESS_FS_REFER ` is not allowed by any rule.
131+ `` LANDLOCK_ACCESS_FS_REFER ` ` is not allowed by any rule.
132132
133133We now have a ruleset with one rule allowing read access to ``/usr `` while
134134denying all other handled accesses for the filesystem. The next step is to
@@ -154,8 +154,8 @@ The current thread is now ready to sandbox itself with the ruleset.
154154 }
155155 close(ruleset_fd);
156156
157- If the `landlock_restrict_self ` system call succeeds, the current thread is now
158- restricted and this policy will be enforced on all its subsequently created
157+ If the `` landlock_restrict_self `` system call succeeds, the current thread is
158+ now restricted and this policy will be enforced on all its subsequently created
159159children as well. Once a thread is landlocked, there is no way to remove its
160160security policy; only adding more restrictions is allowed. These threads are
161161now in a new Landlock domain, merge of their parent one (if any) with the new
@@ -170,12 +170,13 @@ It is recommended setting access rights to file hierarchy leaves as much as
170170possible. For instance, it is better to be able to have ``~/doc/ `` as a
171171read-only hierarchy and ``~/tmp/ `` as a read-write hierarchy, compared to
172172``~/ `` as a read-only hierarchy and ``~/tmp/ `` as a read-write hierarchy.
173- Following this good practice leads to self-sufficient hierarchies that don't
173+ Following this good practice leads to self-sufficient hierarchies that do not
174174depend on their location (i.e. parent directories). This is particularly
175175relevant when we want to allow linking or renaming. Indeed, having consistent
176176access rights per directory enables to change the location of such directory
177177without relying on the destination directory access rights (except those that
178- are required for this operation, see `LANDLOCK_ACCESS_FS_REFER ` documentation).
178+ are required for this operation, see ``LANDLOCK_ACCESS_FS_REFER ``
179+ documentation).
179180Having self-sufficient hierarchies also helps to tighten the required access
180181rights to the minimal set of data. This also helps avoid sinkhole directories,
181182i.e. directories where data can be linked to but not linked from. However,
@@ -259,7 +260,7 @@ Backward and forward compatibility
259260
260261Landlock is designed to be compatible with past and future versions of the
261262kernel. This is achieved thanks to the system call attributes and the
262- associated bitflags, particularly the ruleset's `handled_access_fs `. Making
263+ associated bitflags, particularly the ruleset's `` handled_access_fs ` `. Making
263264handled access right explicit enables the kernel and user space to have a clear
264265contract with each other. This is required to make sure sandboxing will not
265266get stricter with a system update, which could break applications.
@@ -380,8 +381,8 @@ by the Documentation/admin-guide/cgroup-v1/memory.rst.
380381Previous limitations
381382====================
382383
383- File renaming and linking (ABI 1 )
384- ---------------------------------
384+ File renaming and linking (ABI < 2 )
385+ -----------------------------------
385386
386387Because Landlock targets unprivileged access controls, it needs to properly
387388handle composition of rules. Such property also implies rules nesting.
@@ -394,7 +395,7 @@ according to the potentially lost constraints. To protect against privilege
394395escalations through renaming or linking, and for the sake of simplicity,
395396Landlock previously limited linking and renaming to the same directory.
396397Starting with the Landlock ABI version 2, it is now possible to securely
397- control renaming and linking thanks to the new `LANDLOCK_ACCESS_FS_REFER `
398+ control renaming and linking thanks to the new `` LANDLOCK_ACCESS_FS_REFER ` `
398399access right.
399400
400401.. _kernel_support :
@@ -403,14 +404,14 @@ Kernel support
403404==============
404405
405406Landlock was first introduced in Linux 5.13 but it must be configured at build
406- time with `CONFIG_SECURITY_LANDLOCK=y `. Landlock must also be enabled at boot
407+ time with `` CONFIG_SECURITY_LANDLOCK=y ` `. Landlock must also be enabled at boot
407408time as the other security modules. The list of security modules enabled by
408- default is set with `CONFIG_LSM `. The kernel configuration should then
409- contains `CONFIG_LSM=landlock,[...] ` with `[...] ` as the list of other
409+ default is set with `` CONFIG_LSM ` `. The kernel configuration should then
410+ contains `` CONFIG_LSM=landlock,[...] `` with `` [...] ` ` as the list of other
410411potentially useful security modules for the running system (see the
411- `CONFIG_LSM ` help).
412+ `` CONFIG_LSM ` ` help).
412413
413- If the running kernel doesn't have `landlock ` in `CONFIG_LSM `, then we can
414+ If the running kernel does not have `` landlock `` in `` CONFIG_LSM ` `, then we can
414415still enable it by adding ``lsm=landlock,[...] `` to
415416Documentation/admin-guide/kernel-parameters.rst thanks to the bootloader
416417configuration.
0 commit comments