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