1ec8f24b7SThomas Gleixner# SPDX-License-Identifier: GPL-2.0-only 23323eec9SMimi Zohar# IBM Integrity Measurement Architecture 33323eec9SMimi Zohar# 43323eec9SMimi Zoharconfig IMA 53323eec9SMimi Zohar bool "Integrity Measurement Architecture(IMA)" 63323eec9SMimi Zohar select SECURITYFS 73323eec9SMimi Zohar select CRYPTO 83323eec9SMimi Zohar select CRYPTO_HMAC 93323eec9SMimi Zohar select CRYPTO_SHA1 10c7c8bb23SDmitry Kasatkin select CRYPTO_HASH_INFO 11644f1741SRandy Dunlap select TCG_TPM if HAS_IOMEM 12a69f1589SRandy Dunlap select TCG_TIS if TCG_TPM && X86 13fac37c62SJiandi An select TCG_CRB if TCG_TPM && ACPI 1463a0eb78SMichael Ellerman select TCG_IBMVTPM if TCG_TPM && PPC_PSERIES 152afd020aSStefan Berger select INTEGRITY_AUDIT if AUDIT 163323eec9SMimi Zohar help 173323eec9SMimi Zohar The Trusted Computing Group(TCG) runtime Integrity 183323eec9SMimi Zohar Measurement Architecture(IMA) maintains a list of hash 193323eec9SMimi Zohar values of executables and other sensitive system files, 203323eec9SMimi Zohar as they are read or executed. If an attacker manages 213323eec9SMimi Zohar to change the contents of an important system file 223323eec9SMimi Zohar being measured, we can tell. 233323eec9SMimi Zohar 243323eec9SMimi Zohar If your system has a TPM chip, then IMA also maintains 253323eec9SMimi Zohar an aggregate integrity value over this list inside the 263323eec9SMimi Zohar TPM hardware, so that the TPM can prove to a third party 273323eec9SMimi Zohar whether or not critical system files have been modified. 28c9fecf50SAlexander A. Klimov Read <https://www.usenix.org/events/sec04/tech/sailer.html> 293323eec9SMimi Zohar to learn more about IMA. 303323eec9SMimi Zohar If unsure, say N. 313323eec9SMimi Zohar 32d158847aSMimi Zoharconfig IMA_KEXEC 33d158847aSMimi Zohar bool "Enable carrying the IMA measurement list across a soft boot" 34d158847aSMimi Zohar depends on IMA && TCG_TPM && HAVE_IMA_KEXEC 35d158847aSMimi Zohar default n 36d158847aSMimi Zohar help 37d158847aSMimi Zohar TPM PCRs are only reset on a hard reboot. In order to validate 38d158847aSMimi Zohar a TPM's quote after a soft boot, the IMA measurement list of the 39d158847aSMimi Zohar running kernel must be saved and restored on boot. 40d158847aSMimi Zohar 41d158847aSMimi Zohar Depending on the IMA policy, the measurement list can grow to 42d158847aSMimi Zohar be very large. 43d158847aSMimi Zohar 443323eec9SMimi Zoharconfig IMA_MEASURE_PCR_IDX 453323eec9SMimi Zohar int 463323eec9SMimi Zohar depends on IMA 473323eec9SMimi Zohar range 8 14 483323eec9SMimi Zohar default 10 493323eec9SMimi Zohar help 503323eec9SMimi Zohar IMA_MEASURE_PCR_IDX determines the TPM PCR register index 513323eec9SMimi Zohar that IMA uses to maintain the integrity aggregate of the 523323eec9SMimi Zohar measurement list. If unsure, use the default 10. 533323eec9SMimi Zohar 544af4662fSMimi Zoharconfig IMA_LSM_RULES 554af4662fSMimi Zohar bool 561768215aSTyler Hicks depends on IMA && AUDIT && (SECURITY_SELINUX || SECURITY_SMACK || SECURITY_APPARMOR) 574af4662fSMimi Zohar default y 584af4662fSMimi Zohar help 59b53fab9dSRandy Dunlap Disabling this option will disregard LSM based policy rules. 602fe5d6deSMimi Zohar 614286587dSMimi Zoharchoice 624286587dSMimi Zohar prompt "Default template" 634286587dSMimi Zohar default IMA_NG_TEMPLATE 644286587dSMimi Zohar depends on IMA 654286587dSMimi Zohar help 664286587dSMimi Zohar Select the default IMA measurement template. 674286587dSMimi Zohar 684286587dSMimi Zohar The original 'ima' measurement list template contains a 694286587dSMimi Zohar hash, defined as 20 bytes, and a null terminated pathname, 704286587dSMimi Zohar limited to 255 characters. The 'ima-ng' measurement list 714286587dSMimi Zohar template permits both larger hash digests and longer 72891163adSGUO Zihua pathnames. The configured default template can be replaced 73891163adSGUO Zihua by specifying "ima_template=" on the boot command line. 744286587dSMimi Zohar 754286587dSMimi Zohar config IMA_NG_TEMPLATE 764286587dSMimi Zohar bool "ima-ng (default)" 77bcbc9b0cSMimi Zohar config IMA_SIG_TEMPLATE 78bcbc9b0cSMimi Zohar bool "ima-sig" 794286587dSMimi Zoharendchoice 804286587dSMimi Zohar 814286587dSMimi Zoharconfig IMA_DEFAULT_TEMPLATE 824286587dSMimi Zohar string 834286587dSMimi Zohar depends on IMA 844286587dSMimi Zohar default "ima-ng" if IMA_NG_TEMPLATE 85bcbc9b0cSMimi Zohar default "ima-sig" if IMA_SIG_TEMPLATE 864286587dSMimi Zohar 87e7a2ad7eSMimi Zoharchoice 88e7a2ad7eSMimi Zohar prompt "Default integrity hash algorithm" 89e7a2ad7eSMimi Zohar default IMA_DEFAULT_HASH_SHA1 90e7a2ad7eSMimi Zohar depends on IMA 91e7a2ad7eSMimi Zohar help 92e7a2ad7eSMimi Zohar Select the default hash algorithm used for the measurement 93e7a2ad7eSMimi Zohar list, integrity appraisal and audit log. The compiled default 94e7a2ad7eSMimi Zohar hash algorithm can be overwritten using the kernel command 95e7a2ad7eSMimi Zohar line 'ima_hash=' option. 96e7a2ad7eSMimi Zohar 97e7a2ad7eSMimi Zohar config IMA_DEFAULT_HASH_SHA1 98e7a2ad7eSMimi Zohar bool "SHA1 (default)" 9938d19268SBen Hutchings depends on CRYPTO_SHA1=y 100e7a2ad7eSMimi Zohar 101e7a2ad7eSMimi Zohar config IMA_DEFAULT_HASH_SHA256 102e7a2ad7eSMimi Zohar bool "SHA256" 103891163adSGUO Zihua depends on CRYPTO_SHA256=y 104e7a2ad7eSMimi Zohar 105e7a2ad7eSMimi Zohar config IMA_DEFAULT_HASH_SHA512 106e7a2ad7eSMimi Zohar bool "SHA512" 107891163adSGUO Zihua depends on CRYPTO_SHA512=y 108e7a2ad7eSMimi Zohar 109e7a2ad7eSMimi Zohar config IMA_DEFAULT_HASH_WP512 110e7a2ad7eSMimi Zohar bool "WP512" 111891163adSGUO Zihua depends on CRYPTO_WP512=y 1125780b9abSTianjia Zhang 1135780b9abSTianjia Zhang config IMA_DEFAULT_HASH_SM3 1145780b9abSTianjia Zhang bool "SM3" 115b6018af4STianjia Zhang depends on CRYPTO_SM3_GENERIC=y 116e7a2ad7eSMimi Zoharendchoice 117e7a2ad7eSMimi Zohar 118e7a2ad7eSMimi Zoharconfig IMA_DEFAULT_HASH 119e7a2ad7eSMimi Zohar string 120e7a2ad7eSMimi Zohar depends on IMA 121e7a2ad7eSMimi Zohar default "sha1" if IMA_DEFAULT_HASH_SHA1 122e7a2ad7eSMimi Zohar default "sha256" if IMA_DEFAULT_HASH_SHA256 123e7a2ad7eSMimi Zohar default "sha512" if IMA_DEFAULT_HASH_SHA512 124e7a2ad7eSMimi Zohar default "wp512" if IMA_DEFAULT_HASH_WP512 1255780b9abSTianjia Zhang default "sm3" if IMA_DEFAULT_HASH_SM3 126e7a2ad7eSMimi Zohar 12738d859f9SPetko Manolovconfig IMA_WRITE_POLICY 12838d859f9SPetko Manolov bool "Enable multiple writes to the IMA policy" 12938d859f9SPetko Manolov depends on IMA 13038d859f9SPetko Manolov default n 13138d859f9SPetko Manolov help 13238d859f9SPetko Manolov IMA policy can now be updated multiple times. The new rules get 13338d859f9SPetko Manolov appended to the original policy. Have in mind that the rules are 13438d859f9SPetko Manolov scanned in FIFO order so be careful when you design and add new ones. 13538d859f9SPetko Manolov 13638d859f9SPetko Manolov If unsure, say N. 13738d859f9SPetko Manolov 13880eae209SPetko Manolovconfig IMA_READ_POLICY 13980eae209SPetko Manolov bool "Enable reading back the current IMA policy" 14080eae209SPetko Manolov depends on IMA 14180eae209SPetko Manolov default y if IMA_WRITE_POLICY 14280eae209SPetko Manolov default n if !IMA_WRITE_POLICY 14380eae209SPetko Manolov help 14480eae209SPetko Manolov It is often useful to be able to read back the IMA policy. It is 14580eae209SPetko Manolov even more important after introducing CONFIG_IMA_WRITE_POLICY. 14680eae209SPetko Manolov This option allows the root user to see the current policy rules. 14780eae209SPetko Manolov 1482fe5d6deSMimi Zoharconfig IMA_APPRAISE 1492fe5d6deSMimi Zohar bool "Appraise integrity measurements" 1502fe5d6deSMimi Zohar depends on IMA 1512fe5d6deSMimi Zohar default n 1522fe5d6deSMimi Zohar help 1532fe5d6deSMimi Zohar This option enables local measurement integrity appraisal. 1542fe5d6deSMimi Zohar It requires the system to be labeled with a security extended 1552fe5d6deSMimi Zohar attribute containing the file hash measurement. To protect 1562fe5d6deSMimi Zohar the security extended attributes from offline attack, enable 1572fe5d6deSMimi Zohar and configure EVM. 1582fe5d6deSMimi Zohar 1592fe5d6deSMimi Zohar For more information on integrity appraisal refer to: 1602fe5d6deSMimi Zohar <http://linux-ima.sourceforge.net> 1612fe5d6deSMimi Zohar If unsure, say N. 1627d2ce232SMimi Zohar 163d958083aSEric Richterconfig IMA_ARCH_POLICY 164d958083aSEric Richter bool "Enable loading an IMA architecture specific policy" 165aefcf2f4SLinus Torvalds depends on (KEXEC_SIG && IMA) || IMA_APPRAISE \ 1669e1e5d43SNayna Jain && INTEGRITY_ASYMMETRIC_KEYS 167d958083aSEric Richter default n 168d958083aSEric Richter help 169d958083aSEric Richter This option enables loading an IMA architecture specific policy 170d958083aSEric Richter based on run time secure boot flags. 171d958083aSEric Richter 172ef96837bSMimi Zoharconfig IMA_APPRAISE_BUILD_POLICY 173ef96837bSMimi Zohar bool "IMA build time configured policy rules" 174ef96837bSMimi Zohar depends on IMA_APPRAISE && INTEGRITY_ASYMMETRIC_KEYS 175ef96837bSMimi Zohar default n 176ef96837bSMimi Zohar help 177ef96837bSMimi Zohar This option defines an IMA appraisal policy at build time, which 178ef96837bSMimi Zohar is enforced at run time without having to specify a builtin 179ef96837bSMimi Zohar policy name on the boot command line. The build time appraisal 180ef96837bSMimi Zohar policy rules persist after loading a custom policy. 181ef96837bSMimi Zohar 182ef96837bSMimi Zohar Depending on the rules configured, this policy may require kernel 183ef96837bSMimi Zohar modules, firmware, the kexec kernel image, and/or the IMA policy 184ef96837bSMimi Zohar to be signed. Unsigned files might prevent the system from 185ef96837bSMimi Zohar booting or applications from working properly. 186ef96837bSMimi Zohar 187ef96837bSMimi Zoharconfig IMA_APPRAISE_REQUIRE_FIRMWARE_SIGS 188ef96837bSMimi Zohar bool "Appraise firmware signatures" 189ef96837bSMimi Zohar depends on IMA_APPRAISE_BUILD_POLICY 190ef96837bSMimi Zohar default n 191ef96837bSMimi Zohar help 192ef96837bSMimi Zohar This option defines a policy requiring all firmware to be signed, 193ef96837bSMimi Zohar including the regulatory.db. If both this option and 194ef96837bSMimi Zohar CFG80211_REQUIRE_SIGNED_REGDB are enabled, then both signature 195ef96837bSMimi Zohar verification methods are necessary. 196ef96837bSMimi Zohar 197ef96837bSMimi Zoharconfig IMA_APPRAISE_REQUIRE_KEXEC_SIGS 198ef96837bSMimi Zohar bool "Appraise kexec kernel image signatures" 199ef96837bSMimi Zohar depends on IMA_APPRAISE_BUILD_POLICY 200ef96837bSMimi Zohar default n 201ef96837bSMimi Zohar help 202ef96837bSMimi Zohar Enabling this rule will require all kexec'ed kernel images to 203ef96837bSMimi Zohar be signed and verified by a public key on the trusted IMA 204ef96837bSMimi Zohar keyring. 205ef96837bSMimi Zohar 206ef96837bSMimi Zohar Kernel image signatures can not be verified by the original 207ef96837bSMimi Zohar kexec_load syscall. Enabling this rule will prevent its 208ef96837bSMimi Zohar usage. 209ef96837bSMimi Zohar 210ef96837bSMimi Zoharconfig IMA_APPRAISE_REQUIRE_MODULE_SIGS 211ef96837bSMimi Zohar bool "Appraise kernel modules signatures" 212ef96837bSMimi Zohar depends on IMA_APPRAISE_BUILD_POLICY 213ef96837bSMimi Zohar default n 214ef96837bSMimi Zohar help 215ef96837bSMimi Zohar Enabling this rule will require all kernel modules to be signed 216ef96837bSMimi Zohar and verified by a public key on the trusted IMA keyring. 217ef96837bSMimi Zohar 218ef96837bSMimi Zohar Kernel module signatures can only be verified by IMA-appraisal, 219ef96837bSMimi Zohar via the finit_module syscall. Enabling this rule will prevent 220ef96837bSMimi Zohar the usage of the init_module syscall. 221ef96837bSMimi Zohar 222ef96837bSMimi Zoharconfig IMA_APPRAISE_REQUIRE_POLICY_SIGS 223ef96837bSMimi Zohar bool "Appraise IMA policy signature" 224ef96837bSMimi Zohar depends on IMA_APPRAISE_BUILD_POLICY 225ef96837bSMimi Zohar default n 226ef96837bSMimi Zohar help 227ef96837bSMimi Zohar Enabling this rule will require the IMA policy to be signed and 228ef96837bSMimi Zohar and verified by a key on the trusted IMA keyring. 229ef96837bSMimi Zohar 230e1f5e01fSMimi Zoharconfig IMA_APPRAISE_BOOTPARAM 231e1f5e01fSMimi Zohar bool "ima_appraise boot parameter" 232311aa6aaSBruno Meneguele depends on IMA_APPRAISE 233e1f5e01fSMimi Zohar default y 234e1f5e01fSMimi Zohar help 235e1f5e01fSMimi Zohar This option enables the different "ima_appraise=" modes 236e1f5e01fSMimi Zohar (eg. fix, log) from the boot command line. 237e1f5e01fSMimi Zohar 2389044d627SThiago Jung Bauermannconfig IMA_APPRAISE_MODSIG 2399044d627SThiago Jung Bauermann bool "Support module-style signatures for appraisal" 2409044d627SThiago Jung Bauermann depends on IMA_APPRAISE 24139b07096SThiago Jung Bauermann depends on INTEGRITY_ASYMMETRIC_KEYS 24239b07096SThiago Jung Bauermann select PKCS7_MESSAGE_PARSER 24339b07096SThiago Jung Bauermann select MODULE_SIG_FORMAT 2449044d627SThiago Jung Bauermann default n 2459044d627SThiago Jung Bauermann help 2469044d627SThiago Jung Bauermann Adds support for signatures appended to files. The format of the 2479044d627SThiago Jung Bauermann appended signature is the same used for signed kernel modules. 2489044d627SThiago Jung Bauermann The modsig keyword can be used in the IMA policy to allow a hook 2499044d627SThiago Jung Bauermann to accept such signatures. 2509044d627SThiago Jung Bauermann 2517d2ce232SMimi Zoharconfig IMA_TRUSTED_KEYRING 252f4dc3778SDmitry Kasatkin bool "Require all keys on the .ima keyring be signed (deprecated)" 2537d2ce232SMimi Zohar depends on IMA_APPRAISE && SYSTEM_TRUSTED_KEYRING 2547d2ce232SMimi Zohar depends on INTEGRITY_ASYMMETRIC_KEYS 255f4dc3778SDmitry Kasatkin select INTEGRITY_TRUSTED_KEYRING 2567d2ce232SMimi Zohar default y 2577d2ce232SMimi Zohar help 2587d2ce232SMimi Zohar This option requires that all keys added to the .ima 2597d2ce232SMimi Zohar keyring be signed by a key on the system trusted keyring. 260fd5f4e90SDmitry Kasatkin 261f4dc3778SDmitry Kasatkin This option is deprecated in favor of INTEGRITY_TRUSTED_KEYRING 262f4dc3778SDmitry Kasatkin 26356104cf2SDavid Howellsconfig IMA_KEYRINGS_PERMIT_SIGNED_BY_BUILTIN_OR_SECONDARY 26456104cf2SDavid Howells bool "Permit keys validly signed by a built-in or secondary CA cert (EXPERIMENTAL)" 26556104cf2SDavid Howells depends on SYSTEM_TRUSTED_KEYRING 26656104cf2SDavid Howells depends on SECONDARY_TRUSTED_KEYRING 26756104cf2SDavid Howells depends on INTEGRITY_ASYMMETRIC_KEYS 26856104cf2SDavid Howells select INTEGRITY_TRUSTED_KEYRING 26956104cf2SDavid Howells default n 27056104cf2SDavid Howells help 27156104cf2SDavid Howells Keys may be added to the IMA or IMA blacklist keyrings, if the 27256104cf2SDavid Howells key is validly signed by a CA cert in the system built-in or 273*90f6f691SEric Snowberg secondary trusted keyrings. The key must also have the 274*90f6f691SEric Snowberg digitalSignature usage set. 27556104cf2SDavid Howells 27656104cf2SDavid Howells Intermediate keys between those the kernel has compiled in and the 27756104cf2SDavid Howells IMA keys to be added may be added to the system secondary keyring, 27856104cf2SDavid Howells provided they are validly signed by a key already resident in the 27956104cf2SDavid Howells built-in or secondary trusted keyrings. 28056104cf2SDavid Howells 28156104cf2SDavid Howellsconfig IMA_BLACKLIST_KEYRING 28256104cf2SDavid Howells bool "Create IMA machine owner blacklist keyrings (EXPERIMENTAL)" 28341c89b64SPetko Manolov depends on SYSTEM_TRUSTED_KEYRING 28441c89b64SPetko Manolov depends on IMA_TRUSTED_KEYRING 28541c89b64SPetko Manolov default n 28641c89b64SPetko Manolov help 28756104cf2SDavid Howells This option creates an IMA blacklist keyring, which contains all 28856104cf2SDavid Howells revoked IMA keys. It is consulted before any other keyring. If 28956104cf2SDavid Howells the search is successful the requested operation is rejected and 29056104cf2SDavid Howells an error is returned to the caller. 29141c89b64SPetko Manolov 292fd5f4e90SDmitry Kasatkinconfig IMA_LOAD_X509 293fd5f4e90SDmitry Kasatkin bool "Load X509 certificate onto the '.ima' trusted keyring" 294fd5f4e90SDmitry Kasatkin depends on IMA_TRUSTED_KEYRING 295fd5f4e90SDmitry Kasatkin default n 296fd5f4e90SDmitry Kasatkin help 297fd5f4e90SDmitry Kasatkin File signature verification is based on the public keys 298fd5f4e90SDmitry Kasatkin loaded on the .ima trusted keyring. These public keys are 299fd5f4e90SDmitry Kasatkin X509 certificates signed by a trusted key on the 300fd5f4e90SDmitry Kasatkin .system keyring. This option enables X509 certificate 301fd5f4e90SDmitry Kasatkin loading from the kernel onto the '.ima' trusted keyring. 302fd5f4e90SDmitry Kasatkin 303fd5f4e90SDmitry Kasatkinconfig IMA_X509_PATH 304fd5f4e90SDmitry Kasatkin string "IMA X509 certificate path" 305fd5f4e90SDmitry Kasatkin depends on IMA_LOAD_X509 306fd5f4e90SDmitry Kasatkin default "/etc/keys/x509_ima.der" 307fd5f4e90SDmitry Kasatkin help 308fd5f4e90SDmitry Kasatkin This option defines IMA X509 certificate path. 309c57782c1SDmitry Kasatkin 310c57782c1SDmitry Kasatkinconfig IMA_APPRAISE_SIGNED_INIT 311c57782c1SDmitry Kasatkin bool "Require signed user-space initialization" 312c57782c1SDmitry Kasatkin depends on IMA_LOAD_X509 313c57782c1SDmitry Kasatkin default n 314c57782c1SDmitry Kasatkin help 315c57782c1SDmitry Kasatkin This option requires user-space init to be signed. 316ea78979dSLakshmi Ramasubramanian 317ea78979dSLakshmi Ramasubramanianconfig IMA_MEASURE_ASYMMETRIC_KEYS 318ea78979dSLakshmi Ramasubramanian bool 319ea78979dSLakshmi Ramasubramanian depends on IMA 320ea78979dSLakshmi Ramasubramanian depends on ASYMMETRIC_PUBLIC_KEY_SUBTYPE=y 321ea78979dSLakshmi Ramasubramanian default y 3229f81a2edSLakshmi Ramasubramanian 3239f81a2edSLakshmi Ramasubramanianconfig IMA_QUEUE_EARLY_BOOT_KEYS 3249f81a2edSLakshmi Ramasubramanian bool 3259f81a2edSLakshmi Ramasubramanian depends on IMA_MEASURE_ASYMMETRIC_KEYS 3269f81a2edSLakshmi Ramasubramanian depends on SYSTEM_TRUSTED_KEYRING 3279f81a2edSLakshmi Ramasubramanian default y 3289e2b4be3SNayna Jain 3299e2b4be3SNayna Jainconfig IMA_SECURE_AND_OR_TRUSTED_BOOT 3309e2b4be3SNayna Jain bool 3319e2b4be3SNayna Jain depends on IMA_ARCH_POLICY 3329e2b4be3SNayna Jain help 3339e2b4be3SNayna Jain This option is selected by architectures to enable secure and/or 3349e2b4be3SNayna Jain trusted boot based on IMA runtime policies. 33552c20839STushar Sugandhi 33652c20839STushar Sugandhiconfig IMA_DISABLE_HTABLE 33752c20839STushar Sugandhi bool "Disable htable to allow measurement of duplicate records" 33852c20839STushar Sugandhi depends on IMA 33952c20839STushar Sugandhi default n 34052c20839STushar Sugandhi help 34152c20839STushar Sugandhi This option disables htable to allow measurement of duplicate records. 342