Kconfig 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. # SPDX-License-Identifier: GPL-2.0-only
  2. # IBM Integrity Measurement Architecture
  3. #
  4. config IMA
  5. bool "Integrity Measurement Architecture(IMA)"
  6. select SECURITYFS
  7. select CRYPTO
  8. select CRYPTO_HMAC
  9. select CRYPTO_SHA1
  10. select CRYPTO_HASH_INFO
  11. select TCG_TPM if HAS_IOMEM
  12. select TCG_TIS if TCG_TPM && X86
  13. select TCG_CRB if TCG_TPM && ACPI
  14. select TCG_IBMVTPM if TCG_TPM && PPC_PSERIES
  15. select INTEGRITY_AUDIT if AUDIT
  16. help
  17. The Trusted Computing Group(TCG) runtime Integrity
  18. Measurement Architecture(IMA) maintains a list of hash
  19. values of executables and other sensitive system files,
  20. as they are read or executed. If an attacker manages
  21. to change the contents of an important system file
  22. being measured, we can tell.
  23. If your system has a TPM chip, then IMA also maintains
  24. an aggregate integrity value over this list inside the
  25. TPM hardware, so that the TPM can prove to a third party
  26. whether or not critical system files have been modified.
  27. Read <https://www.usenix.org/events/sec04/tech/sailer.html>
  28. to learn more about IMA.
  29. If unsure, say N.
  30. if IMA
  31. config IMA_KEXEC
  32. bool "Enable carrying the IMA measurement list across a soft boot"
  33. depends on TCG_TPM && HAVE_IMA_KEXEC
  34. default n
  35. help
  36. TPM PCRs are only reset on a hard reboot. In order to validate
  37. a TPM's quote after a soft boot, the IMA measurement list of the
  38. running kernel must be saved and restored on boot.
  39. Depending on the IMA policy, the measurement list can grow to
  40. be very large.
  41. config IMA_MEASURE_PCR_IDX
  42. int
  43. range 8 14
  44. default 10
  45. help
  46. IMA_MEASURE_PCR_IDX determines the TPM PCR register index
  47. that IMA uses to maintain the integrity aggregate of the
  48. measurement list. If unsure, use the default 10.
  49. config IMA_LSM_RULES
  50. bool
  51. depends on AUDIT && (SECURITY_SELINUX || SECURITY_SMACK || SECURITY_APPARMOR)
  52. default y
  53. help
  54. Disabling this option will disregard LSM based policy rules.
  55. choice
  56. prompt "Default template"
  57. default IMA_NG_TEMPLATE
  58. help
  59. Select the default IMA measurement template.
  60. The original 'ima' measurement list template contains a
  61. hash, defined as 20 bytes, and a null terminated pathname,
  62. limited to 255 characters. The 'ima-ng' measurement list
  63. template permits both larger hash digests and longer
  64. pathnames. The configured default template can be replaced
  65. by specifying "ima_template=" on the boot command line.
  66. config IMA_NG_TEMPLATE
  67. bool "ima-ng (default)"
  68. config IMA_SIG_TEMPLATE
  69. bool "ima-sig"
  70. endchoice
  71. config IMA_DEFAULT_TEMPLATE
  72. string
  73. default "ima-ng" if IMA_NG_TEMPLATE
  74. default "ima-sig" if IMA_SIG_TEMPLATE
  75. choice
  76. prompt "Default integrity hash algorithm"
  77. default IMA_DEFAULT_HASH_SHA1
  78. help
  79. Select the default hash algorithm used for the measurement
  80. list, integrity appraisal and audit log. The compiled default
  81. hash algorithm can be overwritten using the kernel command
  82. line 'ima_hash=' option.
  83. config IMA_DEFAULT_HASH_SHA1
  84. bool "SHA1 (default)"
  85. depends on CRYPTO_SHA1=y
  86. config IMA_DEFAULT_HASH_SHA256
  87. bool "SHA256"
  88. depends on CRYPTO_SHA256=y
  89. config IMA_DEFAULT_HASH_SHA512
  90. bool "SHA512"
  91. depends on CRYPTO_SHA512=y
  92. config IMA_DEFAULT_HASH_WP512
  93. bool "WP512"
  94. depends on CRYPTO_WP512=y
  95. config IMA_DEFAULT_HASH_SM3
  96. bool "SM3"
  97. depends on CRYPTO_SM3_GENERIC=y
  98. endchoice
  99. config IMA_DEFAULT_HASH
  100. string
  101. default "sha1" if IMA_DEFAULT_HASH_SHA1
  102. default "sha256" if IMA_DEFAULT_HASH_SHA256
  103. default "sha512" if IMA_DEFAULT_HASH_SHA512
  104. default "wp512" if IMA_DEFAULT_HASH_WP512
  105. default "sm3" if IMA_DEFAULT_HASH_SM3
  106. config IMA_WRITE_POLICY
  107. bool "Enable multiple writes to the IMA policy"
  108. default n
  109. help
  110. IMA policy can now be updated multiple times. The new rules get
  111. appended to the original policy. Have in mind that the rules are
  112. scanned in FIFO order so be careful when you design and add new ones.
  113. If unsure, say N.
  114. config IMA_READ_POLICY
  115. bool "Enable reading back the current IMA policy"
  116. default y if IMA_WRITE_POLICY
  117. default n if !IMA_WRITE_POLICY
  118. help
  119. It is often useful to be able to read back the IMA policy. It is
  120. even more important after introducing CONFIG_IMA_WRITE_POLICY.
  121. This option allows the root user to see the current policy rules.
  122. config IMA_APPRAISE
  123. bool "Appraise integrity measurements"
  124. default n
  125. help
  126. This option enables local measurement integrity appraisal.
  127. It requires the system to be labeled with a security extended
  128. attribute containing the file hash measurement. To protect
  129. the security extended attributes from offline attack, enable
  130. and configure EVM.
  131. For more information on integrity appraisal refer to:
  132. <http://linux-ima.sourceforge.net>
  133. If unsure, say N.
  134. config IMA_ARCH_POLICY
  135. bool "Enable loading an IMA architecture specific policy"
  136. depends on (KEXEC_SIG && IMA) || IMA_APPRAISE \
  137. && INTEGRITY_ASYMMETRIC_KEYS
  138. default n
  139. help
  140. This option enables loading an IMA architecture specific policy
  141. based on run time secure boot flags.
  142. config IMA_APPRAISE_BUILD_POLICY
  143. bool "IMA build time configured policy rules"
  144. depends on IMA_APPRAISE && INTEGRITY_ASYMMETRIC_KEYS
  145. default n
  146. help
  147. This option defines an IMA appraisal policy at build time, which
  148. is enforced at run time without having to specify a builtin
  149. policy name on the boot command line. The build time appraisal
  150. policy rules persist after loading a custom policy.
  151. Depending on the rules configured, this policy may require kernel
  152. modules, firmware, the kexec kernel image, and/or the IMA policy
  153. to be signed. Unsigned files might prevent the system from
  154. booting or applications from working properly.
  155. config IMA_APPRAISE_REQUIRE_FIRMWARE_SIGS
  156. bool "Appraise firmware signatures"
  157. depends on IMA_APPRAISE_BUILD_POLICY
  158. default n
  159. help
  160. This option defines a policy requiring all firmware to be signed,
  161. including the regulatory.db. If both this option and
  162. CFG80211_REQUIRE_SIGNED_REGDB are enabled, then both signature
  163. verification methods are necessary.
  164. config IMA_APPRAISE_REQUIRE_KEXEC_SIGS
  165. bool "Appraise kexec kernel image signatures"
  166. depends on IMA_APPRAISE_BUILD_POLICY
  167. default n
  168. help
  169. Enabling this rule will require all kexec'ed kernel images to
  170. be signed and verified by a public key on the trusted IMA
  171. keyring.
  172. Kernel image signatures can not be verified by the original
  173. kexec_load syscall. Enabling this rule will prevent its
  174. usage.
  175. config IMA_APPRAISE_REQUIRE_MODULE_SIGS
  176. bool "Appraise kernel modules signatures"
  177. depends on IMA_APPRAISE_BUILD_POLICY
  178. default n
  179. help
  180. Enabling this rule will require all kernel modules to be signed
  181. and verified by a public key on the trusted IMA keyring.
  182. Kernel module signatures can only be verified by IMA-appraisal,
  183. via the finit_module syscall. Enabling this rule will prevent
  184. the usage of the init_module syscall.
  185. config IMA_APPRAISE_REQUIRE_POLICY_SIGS
  186. bool "Appraise IMA policy signature"
  187. depends on IMA_APPRAISE_BUILD_POLICY
  188. default n
  189. help
  190. Enabling this rule will require the IMA policy to be signed and
  191. and verified by a key on the trusted IMA keyring.
  192. config IMA_APPRAISE_BOOTPARAM
  193. bool "ima_appraise boot parameter"
  194. depends on IMA_APPRAISE
  195. default y
  196. help
  197. This option enables the different "ima_appraise=" modes
  198. (eg. fix, log) from the boot command line.
  199. config IMA_APPRAISE_MODSIG
  200. bool "Support module-style signatures for appraisal"
  201. depends on IMA_APPRAISE
  202. depends on INTEGRITY_ASYMMETRIC_KEYS
  203. select PKCS7_MESSAGE_PARSER
  204. select MODULE_SIG_FORMAT
  205. default n
  206. help
  207. Adds support for signatures appended to files. The format of the
  208. appended signature is the same used for signed kernel modules.
  209. The modsig keyword can be used in the IMA policy to allow a hook
  210. to accept such signatures.
  211. config IMA_KEYRINGS_PERMIT_SIGNED_BY_BUILTIN_OR_SECONDARY
  212. bool "Permit keys validly signed by a built-in or secondary CA cert (EXPERIMENTAL)"
  213. depends on SYSTEM_TRUSTED_KEYRING
  214. depends on SECONDARY_TRUSTED_KEYRING
  215. depends on INTEGRITY_ASYMMETRIC_KEYS
  216. select INTEGRITY_TRUSTED_KEYRING
  217. default n
  218. help
  219. Keys may be added to the IMA or IMA blacklist keyrings, if the
  220. key is validly signed by a CA cert in the system built-in or
  221. secondary trusted keyrings.
  222. Intermediate keys between those the kernel has compiled in and the
  223. IMA keys to be added may be added to the system secondary keyring,
  224. provided they are validly signed by a key already resident in the
  225. built-in or secondary trusted keyrings.
  226. config IMA_BLACKLIST_KEYRING
  227. bool "Create IMA machine owner blacklist keyrings (EXPERIMENTAL)"
  228. depends on SYSTEM_TRUSTED_KEYRING
  229. depends on INTEGRITY_TRUSTED_KEYRING
  230. default n
  231. help
  232. This option creates an IMA blacklist keyring, which contains all
  233. revoked IMA keys. It is consulted before any other keyring. If
  234. the search is successful the requested operation is rejected and
  235. an error is returned to the caller.
  236. config IMA_LOAD_X509
  237. bool "Load X509 certificate onto the '.ima' trusted keyring"
  238. depends on INTEGRITY_TRUSTED_KEYRING
  239. default n
  240. help
  241. File signature verification is based on the public keys
  242. loaded on the .ima trusted keyring. These public keys are
  243. X509 certificates signed by a trusted key on the
  244. .system keyring. This option enables X509 certificate
  245. loading from the kernel onto the '.ima' trusted keyring.
  246. config IMA_X509_PATH
  247. string "IMA X509 certificate path"
  248. depends on IMA_LOAD_X509
  249. default "/etc/keys/x509_ima.der"
  250. help
  251. This option defines IMA X509 certificate path.
  252. config IMA_APPRAISE_SIGNED_INIT
  253. bool "Require signed user-space initialization"
  254. depends on IMA_LOAD_X509
  255. default n
  256. help
  257. This option requires user-space init to be signed.
  258. config IMA_MEASURE_ASYMMETRIC_KEYS
  259. bool
  260. depends on ASYMMETRIC_PUBLIC_KEY_SUBTYPE=y
  261. default y
  262. config IMA_QUEUE_EARLY_BOOT_KEYS
  263. bool
  264. depends on IMA_MEASURE_ASYMMETRIC_KEYS
  265. depends on SYSTEM_TRUSTED_KEYRING
  266. default y
  267. config IMA_SECURE_AND_OR_TRUSTED_BOOT
  268. bool
  269. depends on IMA_ARCH_POLICY
  270. help
  271. This option is selected by architectures to enable secure and/or
  272. trusted boot based on IMA runtime policies.
  273. config IMA_DISABLE_HTABLE
  274. bool "Disable htable to allow measurement of duplicate records"
  275. default n
  276. help
  277. This option disables htable to allow measurement of duplicate records.
  278. endif