@@ -8,7 +8,7 @@ Landlock: unprivileged access control
8
8
=====================================
9
9
10
10
:Author: Mickaël Salaün
11
- :Date: May 2022
11
+ :Date: September 2022
12
12
13
13
The goal of Landlock is to enable to restrict ambient rights (e.g. global
14
14
filesystem 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
69
69
using. To avoid binary enforcement (i.e. either all security features or
70
70
none), we can leverage a dedicated Landlock command to get the current version
71
71
of 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
73
73
starting with the second version of the ABI.
74
74
75
75
.. code-block :: c
@@ -128,7 +128,7 @@ descriptor.
128
128
It may also be required to create rules following the same logic as explained
129
129
for the ruleset creation, by filtering access rights according to the Landlock
130
130
ABI 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.
132
132
133
133
We now have a ruleset with one rule allowing read access to ``/usr `` while
134
134
denying 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.
154
154
}
155
155
close(ruleset_fd);
156
156
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
159
159
children as well. Once a thread is landlocked, there is no way to remove its
160
160
security policy; only adding more restrictions is allowed. These threads are
161
161
now 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
170
170
possible. For instance, it is better to be able to have ``~/doc/ `` as a
171
171
read-only hierarchy and ``~/tmp/ `` as a read-write hierarchy, compared to
172
172
``~/ `` 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
174
174
depend on their location (i.e. parent directories). This is particularly
175
175
relevant when we want to allow linking or renaming. Indeed, having consistent
176
176
access rights per directory enables to change the location of such directory
177
177
without 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).
179
180
Having self-sufficient hierarchies also helps to tighten the required access
180
181
rights to the minimal set of data. This also helps avoid sinkhole directories,
181
182
i.e. directories where data can be linked to but not linked from. However,
@@ -259,7 +260,7 @@ Backward and forward compatibility
259
260
260
261
Landlock is designed to be compatible with past and future versions of the
261
262
kernel. 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
263
264
handled access right explicit enables the kernel and user space to have a clear
264
265
contract with each other. This is required to make sure sandboxing will not
265
266
get stricter with a system update, which could break applications.
@@ -380,8 +381,8 @@ by the Documentation/admin-guide/cgroup-v1/memory.rst.
380
381
Previous limitations
381
382
====================
382
383
383
- File renaming and linking (ABI 1 )
384
- ---------------------------------
384
+ File renaming and linking (ABI < 2 )
385
+ -----------------------------------
385
386
386
387
Because Landlock targets unprivileged access controls, it needs to properly
387
388
handle composition of rules. Such property also implies rules nesting.
@@ -394,7 +395,7 @@ according to the potentially lost constraints. To protect against privilege
394
395
escalations through renaming or linking, and for the sake of simplicity,
395
396
Landlock previously limited linking and renaming to the same directory.
396
397
Starting 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 ` `
398
399
access right.
399
400
400
401
.. _kernel_support :
@@ -403,14 +404,14 @@ Kernel support
403
404
==============
404
405
405
406
Landlock 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
407
408
time 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
410
411
potentially useful security modules for the running system (see the
411
- `CONFIG_LSM ` help).
412
+ `` CONFIG_LSM ` ` help).
412
413
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
414
415
still enable it by adding ``lsm=landlock,[...] `` to
415
416
Documentation/admin-guide/kernel-parameters.rst thanks to the bootloader
416
417
configuration.
0 commit comments