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