blob: a6ba95fbaa9f105a00cc6594b018661de9075aaa [file] [log] [blame]
Kees Cook504f2312017-05-13 04:51:43 -07001===========================
2Linux Security Module Usage
3===========================
Kees Cooke163bc82011-11-01 17:20:01 -07004
5The Linux Security Module (LSM) framework provides a mechanism for
6various security checks to be hooked by new kernel extensions. The name
7"module" is a bit of a misnomer since these extensions are not actually
8loadable kernel modules. Instead, they are selectable at build-time via
9CONFIG_DEFAULT_SECURITY and can be overridden at boot-time via the
Kees Cook504f2312017-05-13 04:51:43 -070010``"security=..."`` kernel command line argument, in the case where multiple
Kees Cooke163bc82011-11-01 17:20:01 -070011LSMs were built into a given kernel.
12
13The primary users of the LSM interface are Mandatory Access Control
14(MAC) extensions which provide a comprehensive security policy. Examples
15include SELinux, Smack, Tomoyo, and AppArmor. In addition to the larger
16MAC extensions, other extensions can be built using the LSM to provide
17specific changes to system operation when these tweaks are not available
18in the core functionality of Linux itself.
19
Casey Schaufler6d9c9392018-09-21 17:16:59 -070020The Linux capabilities modules will always be included. This may be
21followed by any number of "minor" modules and at most one "major" module.
Kees Cook504f2312017-05-13 04:51:43 -070022For more details on capabilities, see ``capabilities(7)`` in the Linux
Kees Cooke163bc82011-11-01 17:20:01 -070023man-pages project.
24
Casey Schauflerd69dece52017-01-18 17:09:05 -080025A list of the active security modules can be found by reading
Kees Cook504f2312017-05-13 04:51:43 -070026``/sys/kernel/security/lsm``. This is a comma separated list, and
Casey Schauflerd69dece52017-01-18 17:09:05 -080027will always include the capability module. The list reflects the
28order in which checks are made. The capability module will always
29be first, followed by any "minor" modules (e.g. Yama) and then
30the one "major" module (e.g. SELinux) if there is one configured.
Kees Cook229fd052017-05-13 04:51:44 -070031
Casey Schaufler6d9c9392018-09-21 17:16:59 -070032Process attributes associated with "major" security modules should
33be accessed and maintained using the special files in ``/proc/.../attr``.
34A security module may maintain a module specific subdirectory there,
35named after the module. ``/proc/.../attr/smack`` is provided by the Smack
36security module and contains all its special files. The files directly
37in ``/proc/.../attr`` remain as legacy interfaces for modules that provide
38subdirectories.
39
Kees Cook229fd052017-05-13 04:51:44 -070040.. toctree::
41 :maxdepth: 1
42
Kees Cook26fccd92017-05-13 04:51:45 -070043 apparmor
Kees Cook30da4f72017-05-13 04:51:48 -070044 LoadPin
Kees Cook229fd052017-05-13 04:51:44 -070045 SELinux
Kees Cooka5606ce2017-05-13 04:51:49 -070046 Smack
Kees Cook5ea672c2017-05-13 04:51:46 -070047 tomoyo
Kees Cook90bb7662017-05-13 04:51:47 -070048 Yama
Micah Mortonaeca4e22019-01-16 07:46:06 -080049 SafeSetID