1 # SPDX-License-Identifier: GPL-2.0-only
2 # IBM Integrity Measurement Architecture
5 bool "Integrity Measurement Architecture(IMA)"
10 select CRYPTO_HASH_INFO
12 select TCG_TPM if HAS_IOMEM
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
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.
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 <https://www.usenix.org/events/sec04/tech/sailer.html>
30 to learn more about IMA.
36 bool "Enable carrying the IMA measurement list across a soft boot"
37 depends on TCG_TPM && HAVE_IMA_KEXEC
40 TPM PCRs are only reset on a hard reboot. In order to validate
41 a TPM's quote after a soft boot, the IMA measurement list of the
42 running kernel must be saved and restored on boot.
44 Depending on the IMA policy, the measurement list can grow to
47 config IMA_MEASURE_PCR_IDX
52 IMA_MEASURE_PCR_IDX determines the TPM PCR register index
53 that IMA uses to maintain the integrity aggregate of the
54 measurement list. If unsure, use the default 10.
58 depends on AUDIT && (SECURITY_SELINUX || SECURITY_SMACK || SECURITY_APPARMOR)
61 Disabling this option will disregard LSM based policy rules.
64 prompt "Default template"
65 default IMA_NG_TEMPLATE
67 Select the default IMA measurement template.
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. The configured default template can be replaced
74 by specifying "ima_template=" on the boot command line.
76 config IMA_NG_TEMPLATE
77 bool "ima-ng (default)"
78 config IMA_SIG_TEMPLATE
82 config IMA_DEFAULT_TEMPLATE
84 default "ima-ng" if IMA_NG_TEMPLATE
85 default "ima-sig" if IMA_SIG_TEMPLATE
88 prompt "Default integrity hash algorithm"
89 default IMA_DEFAULT_HASH_SHA1
91 Select the default hash algorithm used for the measurement
92 list, integrity appraisal and audit log. The compiled default
93 hash algorithm can be overwritten using the kernel command
94 line 'ima_hash=' option.
96 config IMA_DEFAULT_HASH_SHA1
98 depends on CRYPTO_SHA1=y
100 config IMA_DEFAULT_HASH_SHA256
102 depends on CRYPTO_SHA256=y
104 config IMA_DEFAULT_HASH_SHA512
106 depends on CRYPTO_SHA512=y
108 config IMA_DEFAULT_HASH_WP512
110 depends on CRYPTO_WP512=y
112 config IMA_DEFAULT_HASH_SM3
114 depends on CRYPTO_SM3_GENERIC=y
117 config IMA_DEFAULT_HASH
119 default "sha1" if IMA_DEFAULT_HASH_SHA1
120 default "sha256" if IMA_DEFAULT_HASH_SHA256
121 default "sha512" if IMA_DEFAULT_HASH_SHA512
122 default "wp512" if IMA_DEFAULT_HASH_WP512
123 default "sm3" if IMA_DEFAULT_HASH_SM3
125 config IMA_WRITE_POLICY
126 bool "Enable multiple writes to the IMA policy"
129 IMA policy can now be updated multiple times. The new rules get
130 appended to the original policy. Have in mind that the rules are
131 scanned in FIFO order so be careful when you design and add new ones.
135 config IMA_READ_POLICY
136 bool "Enable reading back the current IMA policy"
137 default y if IMA_WRITE_POLICY
138 default n if !IMA_WRITE_POLICY
140 It is often useful to be able to read back the IMA policy. It is
141 even more important after introducing CONFIG_IMA_WRITE_POLICY.
142 This option allows the root user to see the current policy rules.
145 bool "Appraise integrity measurements"
148 This option enables local measurement integrity appraisal.
149 It requires the system to be labeled with a security extended
150 attribute containing the file hash measurement. To protect
151 the security extended attributes from offline attack, enable
154 For more information on integrity appraisal refer to:
155 <http://linux-ima.sourceforge.net>
158 config IMA_ARCH_POLICY
159 bool "Enable loading an IMA architecture specific policy"
160 depends on (KEXEC_SIG && IMA) || IMA_APPRAISE \
161 && INTEGRITY_ASYMMETRIC_KEYS
164 This option enables loading an IMA architecture specific policy
165 based on run time secure boot flags.
167 config IMA_APPRAISE_BUILD_POLICY
168 bool "IMA build time configured policy rules"
169 depends on IMA_APPRAISE && INTEGRITY_ASYMMETRIC_KEYS
172 This option defines an IMA appraisal policy at build time, which
173 is enforced at run time without having to specify a builtin
174 policy name on the boot command line. The build time appraisal
175 policy rules persist after loading a custom policy.
177 Depending on the rules configured, this policy may require kernel
178 modules, firmware, the kexec kernel image, and/or the IMA policy
179 to be signed. Unsigned files might prevent the system from
180 booting or applications from working properly.
182 config IMA_APPRAISE_REQUIRE_FIRMWARE_SIGS
183 bool "Appraise firmware signatures"
184 depends on IMA_APPRAISE_BUILD_POLICY
187 This option defines a policy requiring all firmware to be signed,
188 including the regulatory.db. If both this option and
189 CFG80211_REQUIRE_SIGNED_REGDB are enabled, then both signature
190 verification methods are necessary.
192 config IMA_APPRAISE_REQUIRE_KEXEC_SIGS
193 bool "Appraise kexec kernel image signatures"
194 depends on IMA_APPRAISE_BUILD_POLICY
197 Enabling this rule will require all kexec'ed kernel images to
198 be signed and verified by a public key on the trusted IMA
201 Kernel image signatures can not be verified by the original
202 kexec_load syscall. Enabling this rule will prevent its
205 config IMA_APPRAISE_REQUIRE_MODULE_SIGS
206 bool "Appraise kernel modules signatures"
207 depends on IMA_APPRAISE_BUILD_POLICY
210 Enabling this rule will require all kernel modules to be signed
211 and verified by a public key on the trusted IMA keyring.
213 Kernel module signatures can only be verified by IMA-appraisal,
214 via the finit_module syscall. Enabling this rule will prevent
215 the usage of the init_module syscall.
217 config IMA_APPRAISE_REQUIRE_POLICY_SIGS
218 bool "Appraise IMA policy signature"
219 depends on IMA_APPRAISE_BUILD_POLICY
222 Enabling this rule will require the IMA policy to be signed and
223 and verified by a key on the trusted IMA keyring.
225 config IMA_APPRAISE_BOOTPARAM
226 bool "ima_appraise boot parameter"
227 depends on IMA_APPRAISE
230 This option enables the different "ima_appraise=" modes
231 (eg. fix, log) from the boot command line.
233 config IMA_APPRAISE_MODSIG
234 bool "Support module-style signatures for appraisal"
235 depends on IMA_APPRAISE
236 depends on INTEGRITY_ASYMMETRIC_KEYS
237 select PKCS7_MESSAGE_PARSER
238 select MODULE_SIG_FORMAT
241 Adds support for signatures appended to files. The format of the
242 appended signature is the same used for signed kernel modules.
243 The modsig keyword can be used in the IMA policy to allow a hook
244 to accept such signatures.
246 config IMA_KEYRINGS_PERMIT_SIGNED_BY_BUILTIN_OR_SECONDARY
247 bool "Permit keys validly signed by a built-in, machine (if configured) or secondary"
248 depends on SYSTEM_TRUSTED_KEYRING
249 depends on SECONDARY_TRUSTED_KEYRING
250 depends on INTEGRITY_ASYMMETRIC_KEYS
251 select INTEGRITY_TRUSTED_KEYRING
254 Keys may be added to the IMA or IMA blacklist keyrings, if the
255 key is validly signed by a CA cert in the system built-in,
256 machine (if configured), or secondary trusted keyrings. The
257 key must also have the digitalSignature usage set.
259 Intermediate keys between those the kernel has compiled in and the
260 IMA keys to be added may be added to the system secondary keyring,
261 provided they are validly signed by a key already resident in the
262 built-in, machine (if configured) or secondary trusted keyrings.
264 config IMA_BLACKLIST_KEYRING
265 bool "Create IMA machine owner blacklist keyrings (EXPERIMENTAL)"
266 depends on SYSTEM_TRUSTED_KEYRING
267 depends on INTEGRITY_TRUSTED_KEYRING
270 This option creates an IMA blacklist keyring, which contains all
271 revoked IMA keys. It is consulted before any other keyring. If
272 the search is successful the requested operation is rejected and
273 an error is returned to the caller.
276 bool "Load X509 certificate onto the '.ima' trusted keyring"
277 depends on INTEGRITY_TRUSTED_KEYRING
280 File signature verification is based on the public keys
281 loaded on the .ima trusted keyring. These public keys are
282 X509 certificates signed by a trusted key on the
283 .system keyring. This option enables X509 certificate
284 loading from the kernel onto the '.ima' trusted keyring.
287 string "IMA X509 certificate path"
288 depends on IMA_LOAD_X509
289 default "/etc/keys/x509_ima.der"
291 This option defines IMA X509 certificate path.
293 config IMA_APPRAISE_SIGNED_INIT
294 bool "Require signed user-space initialization"
295 depends on IMA_LOAD_X509
298 This option requires user-space init to be signed.
300 config IMA_MEASURE_ASYMMETRIC_KEYS
302 depends on ASYMMETRIC_PUBLIC_KEY_SUBTYPE=y
305 config IMA_QUEUE_EARLY_BOOT_KEYS
307 depends on IMA_MEASURE_ASYMMETRIC_KEYS
308 depends on SYSTEM_TRUSTED_KEYRING
311 config IMA_SECURE_AND_OR_TRUSTED_BOOT
313 depends on IMA_ARCH_POLICY
315 This option is selected by architectures to enable secure and/or
316 trusted boot based on IMA runtime policies.
318 config IMA_DISABLE_HTABLE
319 bool "Disable htable to allow measurement of duplicate records"
322 This option disables htable to allow measurement of duplicate records.