lsm.rst 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. .. SPDX-License-Identifier: GPL-2.0
  2. .. Copyright (C) 2022 Casey Schaufler <casey@schaufler-ca.com>
  3. .. Copyright (C) 2022 Intel Corporation
  4. =====================================
  5. Linux Security Modules
  6. =====================================
  7. :Author: Casey Schaufler
  8. :Date: July 2023
  9. Linux security modules (LSM) provide a mechanism to implement
  10. additional access controls to the Linux security policies.
  11. The various security modules may support any of these attributes:
  12. ``LSM_ATTR_CURRENT`` is the current, active security context of the
  13. process.
  14. The proc filesystem provides this value in ``/proc/self/attr/current``.
  15. This is supported by the SELinux, Smack and AppArmor security modules.
  16. Smack also provides this value in ``/proc/self/attr/smack/current``.
  17. AppArmor also provides this value in ``/proc/self/attr/apparmor/current``.
  18. ``LSM_ATTR_EXEC`` is the security context of the process at the time the
  19. current image was executed.
  20. The proc filesystem provides this value in ``/proc/self/attr/exec``.
  21. This is supported by the SELinux and AppArmor security modules.
  22. AppArmor also provides this value in ``/proc/self/attr/apparmor/exec``.
  23. ``LSM_ATTR_FSCREATE`` is the security context of the process used when
  24. creating file system objects.
  25. The proc filesystem provides this value in ``/proc/self/attr/fscreate``.
  26. This is supported by the SELinux security module.
  27. ``LSM_ATTR_KEYCREATE`` is the security context of the process used when
  28. creating key objects.
  29. The proc filesystem provides this value in ``/proc/self/attr/keycreate``.
  30. This is supported by the SELinux security module.
  31. ``LSM_ATTR_PREV`` is the security context of the process at the time the
  32. current security context was set.
  33. The proc filesystem provides this value in ``/proc/self/attr/prev``.
  34. This is supported by the SELinux and AppArmor security modules.
  35. AppArmor also provides this value in ``/proc/self/attr/apparmor/prev``.
  36. ``LSM_ATTR_SOCKCREATE`` is the security context of the process used when
  37. creating socket objects.
  38. The proc filesystem provides this value in ``/proc/self/attr/sockcreate``.
  39. This is supported by the SELinux security module.
  40. Kernel interface
  41. ================
  42. Set a security attribute of the current process
  43. -----------------------------------------------
  44. .. kernel-doc:: security/lsm_syscalls.c
  45. :identifiers: sys_lsm_set_self_attr
  46. Get the specified security attributes of the current process
  47. ------------------------------------------------------------
  48. .. kernel-doc:: security/lsm_syscalls.c
  49. :identifiers: sys_lsm_get_self_attr
  50. .. kernel-doc:: security/lsm_syscalls.c
  51. :identifiers: sys_lsm_list_modules
  52. Additional documentation
  53. ========================
  54. * Documentation/security/lsm.rst
  55. * Documentation/security/lsm-development.rst