Kconfig 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. # SPDX-License-Identifier: GPL-2.0-only
  2. #
  3. # Security configuration
  4. #
  5. menu "Security options"
  6. source "security/keys/Kconfig"
  7. config SECURITY_DMESG_RESTRICT
  8. bool "Restrict unprivileged access to the kernel syslog"
  9. default n
  10. help
  11. This enforces restrictions on unprivileged users reading the kernel
  12. syslog via dmesg(8).
  13. If this option is not selected, no restrictions will be enforced
  14. unless the dmesg_restrict sysctl is explicitly set to (1).
  15. If you are unsure how to answer this question, answer N.
  16. choice
  17. prompt "Allow /proc/pid/mem access override"
  18. default PROC_MEM_ALWAYS_FORCE
  19. help
  20. Traditionally /proc/pid/mem allows users to override memory
  21. permissions for users like ptrace, assuming they have ptrace
  22. capability.
  23. This allows people to limit that - either never override, or
  24. require actual active ptrace attachment.
  25. Defaults to the traditional behavior (for now)
  26. config PROC_MEM_ALWAYS_FORCE
  27. bool "Traditional /proc/pid/mem behavior"
  28. help
  29. This allows /proc/pid/mem accesses to override memory mapping
  30. permissions if you have ptrace access rights.
  31. config PROC_MEM_FORCE_PTRACE
  32. bool "Require active ptrace() use for access override"
  33. help
  34. This allows /proc/pid/mem accesses to override memory mapping
  35. permissions for active ptracers like gdb.
  36. config PROC_MEM_NO_FORCE
  37. bool "Never"
  38. help
  39. Never override memory mapping permissions
  40. endchoice
  41. config MSEAL_SYSTEM_MAPPINGS
  42. bool "mseal system mappings"
  43. depends on 64BIT
  44. depends on ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGS
  45. depends on !CHECKPOINT_RESTORE
  46. help
  47. Apply mseal on system mappings.
  48. The system mappings includes vdso, vvar, vvar_vclock,
  49. vectors (arm compat-mode), sigpage (arm compat-mode), uprobes.
  50. A 64-bit kernel is required for the memory sealing feature.
  51. No specific hardware features from the CPU are needed.
  52. WARNING: This feature breaks programs which rely on relocating
  53. or unmapping system mappings. Known broken software at the time
  54. of writing includes CHECKPOINT_RESTORE, UML, gVisor, rr. Therefore
  55. this config can't be enabled universally.
  56. For complete descriptions of memory sealing, please see
  57. Documentation/userspace-api/mseal.rst
  58. config SECURITY
  59. bool "Enable different security models"
  60. depends on SYSFS
  61. depends on MULTIUSER
  62. help
  63. This allows you to choose different security modules to be
  64. configured into your kernel.
  65. If this option is not selected, the default Linux security
  66. model will be used.
  67. If you are unsure how to answer this question, answer N.
  68. config HAS_SECURITY_AUDIT
  69. def_bool y
  70. depends on AUDIT
  71. depends on SECURITY
  72. config SECURITYFS
  73. bool "Enable the securityfs filesystem"
  74. help
  75. This will build the securityfs filesystem. It is currently used by
  76. various security modules (AppArmor, IMA, SafeSetID, TOMOYO, TPM).
  77. If you are unsure how to answer this question, answer N.
  78. config SECURITY_NETWORK
  79. bool "Socket and Networking Security Hooks"
  80. depends on SECURITY
  81. help
  82. This enables the socket and networking security hooks.
  83. If enabled, a security module can use these hooks to
  84. implement socket and networking access controls.
  85. If you are unsure how to answer this question, answer N.
  86. config SECURITY_INFINIBAND
  87. bool "Infiniband Security Hooks"
  88. depends on SECURITY && INFINIBAND
  89. help
  90. This enables the Infiniband security hooks.
  91. If enabled, a security module can use these hooks to
  92. implement Infiniband access controls.
  93. If you are unsure how to answer this question, answer N.
  94. config SECURITY_NETWORK_XFRM
  95. bool "XFRM (IPSec) Networking Security Hooks"
  96. depends on XFRM && SECURITY_NETWORK
  97. help
  98. This enables the XFRM (IPSec) networking security hooks.
  99. If enabled, a security module can use these hooks to
  100. implement per-packet access controls based on labels
  101. derived from IPSec policy. Non-IPSec communications are
  102. designated as unlabelled, and only sockets authorized
  103. to communicate unlabelled data can send without using
  104. IPSec.
  105. If you are unsure how to answer this question, answer N.
  106. config SECURITY_PATH
  107. bool "Security hooks for pathname based access control"
  108. depends on SECURITY
  109. help
  110. This enables the security hooks for pathname based access control.
  111. If enabled, a security module can use these hooks to
  112. implement pathname based access controls.
  113. If you are unsure how to answer this question, answer N.
  114. config INTEL_TXT
  115. bool "Enable Intel(R) Trusted Execution Technology (Intel(R) TXT)"
  116. depends on HAVE_INTEL_TXT
  117. help
  118. This option enables support for booting the kernel with the
  119. Trusted Boot (tboot) module. This will utilize
  120. Intel(R) Trusted Execution Technology to perform a measured launch
  121. of the kernel. If the system does not support Intel(R) TXT, this
  122. will have no effect.
  123. Intel TXT will provide higher assurance of system configuration and
  124. initial state as well as data reset protection. This is used to
  125. create a robust initial kernel measurement and verification, which
  126. helps to ensure that kernel security mechanisms are functioning
  127. correctly. This level of protection requires a root of trust outside
  128. of the kernel itself.
  129. Intel TXT also helps solve real end user concerns about having
  130. confidence that their hardware is running the VMM or kernel that
  131. it was configured with, especially since they may be responsible for
  132. providing such assurances to VMs and services running on it.
  133. See <https://www.intel.com/technology/security/> for more information
  134. about Intel(R) TXT.
  135. See <http://tboot.sourceforge.net> for more information about tboot.
  136. See Documentation/arch/x86/intel_txt.rst for a description of how to enable
  137. Intel TXT support in a kernel boot.
  138. If you are unsure as to whether this is required, answer N.
  139. config LSM_MMAP_MIN_ADDR
  140. int "Low address space for LSM to protect from user allocation"
  141. depends on SECURITY && SECURITY_SELINUX
  142. default 32768 if ARM || (ARM64 && COMPAT)
  143. default 65536
  144. help
  145. This is the portion of low virtual memory which should be protected
  146. from userspace allocation. Keeping a user from writing to low pages
  147. can help reduce the impact of kernel NULL pointer bugs.
  148. For most ia64, ppc64 and x86 users with lots of address space
  149. a value of 65536 is reasonable and should cause no problems.
  150. On arm and other archs it should not be higher than 32768.
  151. Programs which use vm86 functionality or have some need to map
  152. this low address space will need the permission specific to the
  153. systems running LSM.
  154. config STATIC_USERMODEHELPER
  155. bool "Force all usermode helper calls through a single binary"
  156. help
  157. By default, the kernel can call many different userspace
  158. binary programs through the "usermode helper" kernel
  159. interface. Some of these binaries are statically defined
  160. either in the kernel code itself, or as a kernel configuration
  161. option. However, some of these are dynamically created at
  162. runtime, or can be modified after the kernel has started up.
  163. To provide an additional layer of security, route all of these
  164. calls through a single executable that can not have its name
  165. changed.
  166. Note, it is up to this single binary to then call the relevant
  167. "real" usermode helper binary, based on the first argument
  168. passed to it. If desired, this program can filter and pick
  169. and choose what real programs are called.
  170. If you wish for all usermode helper programs are to be
  171. disabled, choose this option and then set
  172. STATIC_USERMODEHELPER_PATH to an empty string.
  173. config STATIC_USERMODEHELPER_PATH
  174. string "Path to the static usermode helper binary"
  175. depends on STATIC_USERMODEHELPER
  176. default "/sbin/usermode-helper"
  177. help
  178. The binary called by the kernel when any usermode helper
  179. program is wish to be run. The "real" application's name will
  180. be in the first argument passed to this program on the command
  181. line.
  182. If you wish for all usermode helper programs to be disabled,
  183. specify an empty string here (i.e. "").
  184. source "security/selinux/Kconfig"
  185. source "security/smack/Kconfig"
  186. source "security/tomoyo/Kconfig"
  187. source "security/apparmor/Kconfig"
  188. source "security/loadpin/Kconfig"
  189. source "security/yama/Kconfig"
  190. source "security/safesetid/Kconfig"
  191. source "security/lockdown/Kconfig"
  192. source "security/landlock/Kconfig"
  193. source "security/ipe/Kconfig"
  194. source "security/integrity/Kconfig"
  195. choice
  196. prompt "First legacy 'major LSM' to be initialized"
  197. default DEFAULT_SECURITY_SELINUX if SECURITY_SELINUX
  198. default DEFAULT_SECURITY_SMACK if SECURITY_SMACK
  199. default DEFAULT_SECURITY_TOMOYO if SECURITY_TOMOYO
  200. default DEFAULT_SECURITY_APPARMOR if SECURITY_APPARMOR
  201. default DEFAULT_SECURITY_DAC
  202. help
  203. This choice is there only for converting CONFIG_DEFAULT_SECURITY
  204. in old kernel configs to CONFIG_LSM in new kernel configs. Don't
  205. change this choice unless you are creating a fresh kernel config,
  206. for this choice will be ignored after CONFIG_LSM has been set.
  207. Selects the legacy "major security module" that will be
  208. initialized first. Overridden by non-default CONFIG_LSM.
  209. config DEFAULT_SECURITY_SELINUX
  210. bool "SELinux" if SECURITY_SELINUX=y
  211. config DEFAULT_SECURITY_SMACK
  212. bool "Simplified Mandatory Access Control" if SECURITY_SMACK=y
  213. config DEFAULT_SECURITY_TOMOYO
  214. bool "TOMOYO" if SECURITY_TOMOYO=y
  215. config DEFAULT_SECURITY_APPARMOR
  216. bool "AppArmor" if SECURITY_APPARMOR=y
  217. config DEFAULT_SECURITY_DAC
  218. bool "Unix Discretionary Access Controls"
  219. endchoice
  220. config LSM
  221. string "Ordered list of enabled LSMs"
  222. depends on SECURITY
  223. default "landlock,lockdown,yama,loadpin,safesetid,smack,selinux,tomoyo,apparmor,ipe,bpf" if DEFAULT_SECURITY_SMACK
  224. default "landlock,lockdown,yama,loadpin,safesetid,apparmor,selinux,smack,tomoyo,ipe,bpf" if DEFAULT_SECURITY_APPARMOR
  225. default "landlock,lockdown,yama,loadpin,safesetid,tomoyo,ipe,bpf" if DEFAULT_SECURITY_TOMOYO
  226. default "landlock,lockdown,yama,loadpin,safesetid,ipe,bpf" if DEFAULT_SECURITY_DAC
  227. default "landlock,lockdown,yama,loadpin,safesetid,selinux,smack,tomoyo,apparmor,ipe,bpf"
  228. help
  229. A comma-separated list of LSMs, in initialization order.
  230. Any LSMs left off this list, except for those with order
  231. LSM_ORDER_FIRST and LSM_ORDER_LAST, which are always enabled
  232. if selected in the kernel configuration, will be ignored.
  233. This can be controlled at boot with the "lsm=" parameter.
  234. If unsure, leave this as the default.
  235. config SECURITY_COMMONCAP_KUNIT_TEST
  236. bool "Build KUnit tests for commoncap" if !KUNIT_ALL_TESTS
  237. depends on KUNIT=y && USER_NS
  238. default KUNIT_ALL_TESTS
  239. help
  240. This builds the commoncap KUnit tests.
  241. KUnit tests run during boot and output the results to the debug log
  242. in TAP format (https://testanything.org/). Only useful for kernel devs
  243. running KUnit test harness and are not for inclusion into a
  244. production build.
  245. For more information on KUnit and unit tests in general please refer
  246. to the KUnit documentation in Documentation/dev-tools/kunit/.
  247. If unsure, say N.
  248. source "security/Kconfig.hardening"
  249. endmenu