Skip to content

Commit 0165f4c

Browse files
naynajainmimizohar
authored andcommitted
ima: enable signing of modules with build time generated key
The kernel build process currently only signs kernel modules when MODULE_SIG is enabled. Also, sign the kernel modules at build time when IMA_APPRAISE_MODSIG is enabled. Signed-off-by: Nayna Jain <[email protected]> Acked-by: Stefan Berger <[email protected]> Signed-off-by: Mimi Zohar <[email protected]>
1 parent b31f2a4 commit 0165f4c

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

certs/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ menu "Certificates for signature checking"
44
config MODULE_SIG_KEY
55
string "File name or PKCS#11 URI of module signing key"
66
default "certs/signing_key.pem"
7-
depends on MODULE_SIG
7+
depends on MODULE_SIG || IMA_APPRAISE_MODSIG
88
help
99
Provide the file name of a private key/certificate in PEM format,
1010
or a PKCS#11 URI according to RFC7512. The file should contain, or

certs/Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ endif # CONFIG_SYSTEM_TRUSTED_KEYRING
3232
clean-files := x509_certificate_list .x509.list
3333

3434
ifeq ($(CONFIG_MODULE_SIG),y)
35+
SIGN_KEY = y
36+
endif
37+
38+
ifeq ($(CONFIG_IMA_APPRAISE_MODSIG),y)
39+
SIGN_KEY = y
40+
endif
41+
42+
ifdef SIGN_KEY
3543
###############################################################################
3644
#
3745
# If module signing is requested, say by allyesconfig, but a key has not been

init/Kconfig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2164,7 +2164,7 @@ config MODULE_SIG_FORCE
21642164
config MODULE_SIG_ALL
21652165
bool "Automatically sign all modules"
21662166
default y
2167-
depends on MODULE_SIG
2167+
depends on MODULE_SIG || IMA_APPRAISE_MODSIG
21682168
help
21692169
Sign all modules during make modules_install. Without this option,
21702170
modules must be signed manually, using the scripts/sign-file tool.
@@ -2174,7 +2174,7 @@ comment "Do not forget to sign required modules with scripts/sign-file"
21742174

21752175
choice
21762176
prompt "Which hash algorithm should modules be signed with?"
2177-
depends on MODULE_SIG
2177+
depends on MODULE_SIG || IMA_APPRAISE_MODSIG
21782178
help
21792179
This determines which sort of hashing algorithm will be used during
21802180
signature generation. This algorithm _must_ be built into the kernel
@@ -2206,7 +2206,7 @@ endchoice
22062206

22072207
config MODULE_SIG_HASH
22082208
string
2209-
depends on MODULE_SIG
2209+
depends on MODULE_SIG || IMA_APPRAISE_MODSIG
22102210
default "sha1" if MODULE_SIG_SHA1
22112211
default "sha224" if MODULE_SIG_SHA224
22122212
default "sha256" if MODULE_SIG_SHA256

0 commit comments

Comments
 (0)