Kconfig 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  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 SECURITY
  42. bool "Enable different security models"
  43. depends on SYSFS
  44. depends on MULTIUSER
  45. help
  46. This allows you to choose different security modules to be
  47. configured into your kernel.
  48. If this option is not selected, the default Linux security
  49. model will be used.
  50. If you are unsure how to answer this question, answer N.
  51. config SECURITYFS
  52. bool "Enable the securityfs filesystem"
  53. help
  54. This will build the securityfs filesystem. It is currently used by
  55. various security modules (AppArmor, IMA, SafeSetID, TOMOYO, TPM).
  56. If you are unsure how to answer this question, answer N.
  57. config SECURITY_NETWORK
  58. bool "Socket and Networking Security Hooks"
  59. depends on SECURITY
  60. help
  61. This enables the socket and networking security hooks.
  62. If enabled, a security module can use these hooks to
  63. implement socket and networking access controls.
  64. If you are unsure how to answer this question, answer N.
  65. config SECURITY_INFINIBAND
  66. bool "Infiniband Security Hooks"
  67. depends on SECURITY && INFINIBAND
  68. help
  69. This enables the Infiniband security hooks.
  70. If enabled, a security module can use these hooks to
  71. implement Infiniband access controls.
  72. If you are unsure how to answer this question, answer N.
  73. config SECURITY_NETWORK_XFRM
  74. bool "XFRM (IPSec) Networking Security Hooks"
  75. depends on XFRM && SECURITY_NETWORK
  76. help
  77. This enables the XFRM (IPSec) networking security hooks.
  78. If enabled, a security module can use these hooks to
  79. implement per-packet access controls based on labels
  80. derived from IPSec policy. Non-IPSec communications are
  81. designated as unlabelled, and only sockets authorized
  82. to communicate unlabelled data can send without using
  83. IPSec.
  84. If you are unsure how to answer this question, answer N.
  85. config SECURITY_PATH
  86. bool "Security hooks for pathname based access control"
  87. depends on SECURITY
  88. help
  89. This enables the security hooks for pathname based access control.
  90. If enabled, a security module can use these hooks to
  91. implement pathname based access controls.
  92. If you are unsure how to answer this question, answer N.
  93. config INTEL_TXT
  94. bool "Enable Intel(R) Trusted Execution Technology (Intel(R) TXT)"
  95. depends on HAVE_INTEL_TXT
  96. help
  97. This option enables support for booting the kernel with the
  98. Trusted Boot (tboot) module. This will utilize
  99. Intel(R) Trusted Execution Technology to perform a measured launch
  100. of the kernel. If the system does not support Intel(R) TXT, this
  101. will have no effect.
  102. Intel TXT will provide higher assurance of system configuration and
  103. initial state as well as data reset protection. This is used to
  104. create a robust initial kernel measurement and verification, which
  105. helps to ensure that kernel security mechanisms are functioning
  106. correctly. This level of protection requires a root of trust outside
  107. of the kernel itself.
  108. Intel TXT also helps solve real end user concerns about having
  109. confidence that their hardware is running the VMM or kernel that
  110. it was configured with, especially since they may be responsible for
  111. providing such assurances to VMs and services running on it.
  112. See <https://www.intel.com/technology/security/> for more information
  113. about Intel(R) TXT.
  114. See <http://tboot.sourceforge.net> for more information about tboot.
  115. See Documentation/arch/x86/intel_txt.rst for a description of how to enable
  116. Intel TXT support in a kernel boot.
  117. If you are unsure as to whether this is required, answer N.
  118. config LSM_MMAP_MIN_ADDR
  119. int "Low address space for LSM to protect from user allocation"
  120. depends on SECURITY && SECURITY_SELINUX
  121. default 32768 if ARM || (ARM64 && COMPAT)
  122. default 65536
  123. help
  124. This is the portion of low virtual memory which should be protected
  125. from userspace allocation. Keeping a user from writing to low pages
  126. can help reduce the impact of kernel NULL pointer bugs.
  127. For most ia64, ppc64 and x86 users with lots of address space
  128. a value of 65536 is reasonable and should cause no problems.
  129. On arm and other archs it should not be higher than 32768.
  130. Programs which use vm86 functionality or have some need to map
  131. this low address space will need the permission specific to the
  132. systems running LSM.
  133. config HARDENED_USERCOPY
  134. bool "Harden memory copies between kernel and userspace"
  135. imply STRICT_DEVMEM
  136. help
  137. This option checks for obviously wrong memory regions when
  138. copying memory to/from the kernel (via copy_to_user() and
  139. copy_from_user() functions) by rejecting memory ranges that
  140. are larger than the specified heap object, span multiple
  141. separately allocated pages, are not on the process stack,
  142. or are part of the kernel text. This prevents entire classes
  143. of heap overflow exploits and similar kernel memory exposures.
  144. config FORTIFY_SOURCE
  145. bool "Harden common str/mem functions against buffer overflows"
  146. depends on ARCH_HAS_FORTIFY_SOURCE
  147. # https://github.com/llvm/llvm-project/issues/53645
  148. depends on !CC_IS_CLANG || !X86_32
  149. help
  150. Detect overflows of buffers in common string and memory functions
  151. where the compiler can determine and validate the buffer sizes.
  152. config STATIC_USERMODEHELPER
  153. bool "Force all usermode helper calls through a single binary"
  154. help
  155. By default, the kernel can call many different userspace
  156. binary programs through the "usermode helper" kernel
  157. interface. Some of these binaries are statically defined
  158. either in the kernel code itself, or as a kernel configuration
  159. option. However, some of these are dynamically created at
  160. runtime, or can be modified after the kernel has started up.
  161. To provide an additional layer of security, route all of these
  162. calls through a single executable that can not have its name
  163. changed.
  164. Note, it is up to this single binary to then call the relevant
  165. "real" usermode helper binary, based on the first argument
  166. passed to it. If desired, this program can filter and pick
  167. and choose what real programs are called.
  168. If you wish for all usermode helper programs are to be
  169. disabled, choose this option and then set
  170. STATIC_USERMODEHELPER_PATH to an empty string.
  171. config STATIC_USERMODEHELPER_PATH
  172. string "Path to the static usermode helper binary"
  173. depends on STATIC_USERMODEHELPER
  174. default "/sbin/usermode-helper"
  175. help
  176. The binary called by the kernel when any usermode helper
  177. program is wish to be run. The "real" application's name will
  178. be in the first argument passed to this program on the command
  179. line.
  180. If you wish for all usermode helper programs to be disabled,
  181. specify an empty string here (i.e. "").
  182. source "security/selinux/Kconfig"
  183. source "security/smack/Kconfig"
  184. source "security/tomoyo/Kconfig"
  185. source "security/apparmor/Kconfig"
  186. source "security/loadpin/Kconfig"
  187. source "security/yama/Kconfig"
  188. source "security/safesetid/Kconfig"
  189. source "security/lockdown/Kconfig"
  190. source "security/landlock/Kconfig"
  191. source "security/ipe/Kconfig"
  192. source "security/integrity/Kconfig"
  193. choice
  194. prompt "First legacy 'major LSM' to be initialized"
  195. default DEFAULT_SECURITY_SELINUX if SECURITY_SELINUX
  196. default DEFAULT_SECURITY_SMACK if SECURITY_SMACK
  197. default DEFAULT_SECURITY_TOMOYO if SECURITY_TOMOYO
  198. default DEFAULT_SECURITY_APPARMOR if SECURITY_APPARMOR
  199. default DEFAULT_SECURITY_DAC
  200. help
  201. This choice is there only for converting CONFIG_DEFAULT_SECURITY
  202. in old kernel configs to CONFIG_LSM in new kernel configs. Don't
  203. change this choice unless you are creating a fresh kernel config,
  204. for this choice will be ignored after CONFIG_LSM has been set.
  205. Selects the legacy "major security module" that will be
  206. initialized first. Overridden by non-default CONFIG_LSM.
  207. config DEFAULT_SECURITY_SELINUX
  208. bool "SELinux" if SECURITY_SELINUX=y
  209. config DEFAULT_SECURITY_SMACK
  210. bool "Simplified Mandatory Access Control" if SECURITY_SMACK=y
  211. config DEFAULT_SECURITY_TOMOYO
  212. bool "TOMOYO" if SECURITY_TOMOYO=y
  213. config DEFAULT_SECURITY_APPARMOR
  214. bool "AppArmor" if SECURITY_APPARMOR=y
  215. config DEFAULT_SECURITY_DAC
  216. bool "Unix Discretionary Access Controls"
  217. endchoice
  218. config LSM
  219. string "Ordered list of enabled LSMs"
  220. depends on SECURITY
  221. default "landlock,lockdown,yama,loadpin,safesetid,smack,selinux,tomoyo,apparmor,ipe,bpf" if DEFAULT_SECURITY_SMACK
  222. default "landlock,lockdown,yama,loadpin,safesetid,apparmor,selinux,smack,tomoyo,ipe,bpf" if DEFAULT_SECURITY_APPARMOR
  223. default "landlock,lockdown,yama,loadpin,safesetid,tomoyo,ipe,bpf" if DEFAULT_SECURITY_TOMOYO
  224. default "landlock,lockdown,yama,loadpin,safesetid,ipe,bpf" if DEFAULT_SECURITY_DAC
  225. default "landlock,lockdown,yama,loadpin,safesetid,selinux,smack,tomoyo,apparmor,ipe,bpf"
  226. help
  227. A comma-separated list of LSMs, in initialization order.
  228. Any LSMs left off this list, except for those with order
  229. LSM_ORDER_FIRST and LSM_ORDER_LAST, which are always enabled
  230. if selected in the kernel configuration, will be ignored.
  231. This can be controlled at boot with the "lsm=" parameter.
  232. If unsure, leave this as the default.
  233. source "security/Kconfig.hardening"
  234. endmenu