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