0001 # SPDX-License-Identifier: GPL-2.0
0002 menu "Certificates for signature checking"
0003
0004 config MODULE_SIG_KEY
0005 string "File name or PKCS#11 URI of module signing key"
0006 default "certs/signing_key.pem"
0007 depends on MODULE_SIG || (IMA_APPRAISE_MODSIG && MODULES)
0008 help
0009 Provide the file name of a private key/certificate in PEM format,
0010 or a PKCS#11 URI according to RFC7512. The file should contain, or
0011 the URI should identify, both the certificate and its corresponding
0012 private key.
0013
0014 If this option is unchanged from its default "certs/signing_key.pem",
0015 then the kernel will automatically generate the private key and
0016 certificate as described in Documentation/admin-guide/module-signing.rst
0017
0018 choice
0019 prompt "Type of module signing key to be generated"
0020 depends on MODULE_SIG || (IMA_APPRAISE_MODSIG && MODULES)
0021 help
0022 The type of module signing key type to generate. This option
0023 does not apply if a #PKCS11 URI is used.
0024
0025 config MODULE_SIG_KEY_TYPE_RSA
0026 bool "RSA"
0027 help
0028 Use an RSA key for module signing.
0029
0030 config MODULE_SIG_KEY_TYPE_ECDSA
0031 bool "ECDSA"
0032 select CRYPTO_ECDSA
0033 help
0034 Use an elliptic curve key (NIST P384) for module signing. Consider
0035 using a strong hash like sha256 or sha384 for hashing modules.
0036
0037 Note: Remove all ECDSA signing keys, e.g. certs/signing_key.pem,
0038 when falling back to building Linux 5.14 and older kernels.
0039
0040 endchoice
0041
0042 config SYSTEM_TRUSTED_KEYRING
0043 bool "Provide system-wide ring of trusted keys"
0044 depends on KEYS
0045 depends on ASYMMETRIC_KEY_TYPE
0046 depends on X509_CERTIFICATE_PARSER = y
0047 help
0048 Provide a system keyring to which trusted keys can be added. Keys in
0049 the keyring are considered to be trusted. Keys may be added at will
0050 by the kernel from compiled-in data and from hardware key stores, but
0051 userspace may only add extra keys if those keys can be verified by
0052 keys already in the keyring.
0053
0054 Keys in this keyring are used by module signature checking.
0055
0056 config SYSTEM_TRUSTED_KEYS
0057 string "Additional X.509 keys for default system keyring"
0058 depends on SYSTEM_TRUSTED_KEYRING
0059 help
0060 If set, this option should be the filename of a PEM-formatted file
0061 containing trusted X.509 certificates to be included in the default
0062 system keyring. Any certificate used for module signing is implicitly
0063 also trusted.
0064
0065 NOTE: If you previously provided keys for the system keyring in the
0066 form of DER-encoded *.x509 files in the top-level build directory,
0067 those are no longer used. You will need to set this option instead.
0068
0069 config SYSTEM_EXTRA_CERTIFICATE
0070 bool "Reserve area for inserting a certificate without recompiling"
0071 depends on SYSTEM_TRUSTED_KEYRING
0072 help
0073 If set, space for an extra certificate will be reserved in the kernel
0074 image. This allows introducing a trusted certificate to the default
0075 system keyring without recompiling the kernel.
0076
0077 config SYSTEM_EXTRA_CERTIFICATE_SIZE
0078 int "Number of bytes to reserve for the extra certificate"
0079 depends on SYSTEM_EXTRA_CERTIFICATE
0080 default 4096
0081 help
0082 This is the number of bytes reserved in the kernel image for a
0083 certificate to be inserted.
0084
0085 config SECONDARY_TRUSTED_KEYRING
0086 bool "Provide a keyring to which extra trustable keys may be added"
0087 depends on SYSTEM_TRUSTED_KEYRING
0088 help
0089 If set, provide a keyring to which extra keys may be added, provided
0090 those keys are not blacklisted and are vouched for by a key built
0091 into the kernel or already in the secondary trusted keyring.
0092
0093 config SYSTEM_BLACKLIST_KEYRING
0094 bool "Provide system-wide ring of blacklisted keys"
0095 depends on KEYS
0096 help
0097 Provide a system keyring to which blacklisted keys can be added.
0098 Keys in the keyring are considered entirely untrusted. Keys in this
0099 keyring are used by the module signature checking to reject loading
0100 of modules signed with a blacklisted key.
0101
0102 config SYSTEM_BLACKLIST_HASH_LIST
0103 string "Hashes to be preloaded into the system blacklist keyring"
0104 depends on SYSTEM_BLACKLIST_KEYRING
0105 help
0106 If set, this option should be the filename of a list of hashes in the
0107 form "<hash>", "<hash>", ... . This will be included into a C
0108 wrapper to incorporate the list into the kernel. Each <hash> must be a
0109 string starting with a prefix ("tbs" or "bin"), then a colon (":"), and
0110 finally an even number of hexadecimal lowercase characters (up to 128).
0111 Certificate hashes can be generated with
0112 tools/certs/print-cert-tbs-hash.sh .
0113
0114 config SYSTEM_REVOCATION_LIST
0115 bool "Provide system-wide ring of revocation certificates"
0116 depends on SYSTEM_BLACKLIST_KEYRING
0117 depends on PKCS7_MESSAGE_PARSER=y
0118 help
0119 If set, this allows revocation certificates to be stored in the
0120 blacklist keyring and implements a hook whereby a PKCS#7 message can
0121 be checked to see if it matches such a certificate.
0122
0123 config SYSTEM_REVOCATION_KEYS
0124 string "X.509 certificates to be preloaded into the system blacklist keyring"
0125 depends on SYSTEM_REVOCATION_LIST
0126 help
0127 If set, this option should be the filename of a PEM-formatted file
0128 containing X.509 certificates to be included in the default blacklist
0129 keyring.
0130
0131 config SYSTEM_BLACKLIST_AUTH_UPDATE
0132 bool "Allow root to add signed blacklist keys"
0133 depends on SYSTEM_BLACKLIST_KEYRING
0134 depends on SYSTEM_DATA_VERIFICATION
0135 help
0136 If set, provide the ability to load new blacklist keys at run time if
0137 they are signed and vouched by a certificate from the builtin trusted
0138 keyring. The PKCS#7 signature of the description is set in the key
0139 payload. Blacklist keys cannot be removed.
0140
0141 endmenu