From: Felix Moessbauer <felix.moessbauer@siemens.com>
To: isar-users@googlegroups.com
Cc: tobias.preclik@siemens.com, christian.storm@siemens.com,
Felix Moessbauer <felix.moessbauer@siemens.com>
Subject: [PATCH 05/10] add support to sign kernel modules
Date: Fri, 23 Dec 2022 08:40:53 +0000 [thread overview]
Message-ID: <20221223084058.1899957-6-felix.moessbauer@siemens.com> (raw)
In-Reply-To: <20221223084058.1899957-1-felix.moessbauer@siemens.com>
This patchs extends the module.inc class to add support to sign the
compiled kernel modules. If the module is signed or not is controlled
via a build profile named pkg.sign. When enabled, the kernels sign-file
is executed. The path to the keyfile inside the schroot has to be
provided in SIGNATURE_KEYFILE, the path to the corresponding cert in
SIGNATURE_CERTFILE. The used hash-function can be controlled using
SIGNATURE_HASHFN. All modules in the current build directory are
signed.
The implementation - by design - does not specify how to provide the
keys in the schroot inside the sbuild. This gives some flexibility, e.g.
the keys can be provided in a package, added as build dependency or
alternatively via a mountpoint.
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
meta/recipes-kernel/linux-module/files/debian/rules.tmpl | 3 +++
meta/recipes-kernel/linux-module/module.inc | 7 +++++++
2 files changed, 10 insertions(+)
diff --git a/meta/recipes-kernel/linux-module/files/debian/rules.tmpl b/meta/recipes-kernel/linux-module/files/debian/rules.tmpl
index c1c2560..7d950e3 100755
--- a/meta/recipes-kernel/linux-module/files/debian/rules.tmpl
+++ b/meta/recipes-kernel/linux-module/files/debian/rules.tmpl
@@ -50,6 +50,9 @@ override_dh_auto_clean:
override_dh_auto_build:
$(MAKE) -C $(KDIR) M=$(PWD) $(PARALLEL_MAKE) modules
+ifneq ($(filter pkg.sign,$(DEB_BUILD_PROFILES)),)
+ find . -name "*.ko" -print -exec $(KDIR)/scripts/sign-file ${SIGNATURE_HASHFN} ${SIGNATURE_KEYFILE} ${SIGNATURE_CERTFILE} {} \;
+endif
override_dh_auto_install:
$(MAKE) -C $(KDIR) M=$(PWD) INSTALL_MOD_PATH=$(PWD)/debian/${PN} modules_install
diff --git a/meta/recipes-kernel/linux-module/module.inc b/meta/recipes-kernel/linux-module/module.inc
index cfc6d20..a9e5d3d 100644
--- a/meta/recipes-kernel/linux-module/module.inc
+++ b/meta/recipes-kernel/linux-module/module.inc
@@ -18,6 +18,10 @@ KERNEL_HEADERS_PKG ??= "linux-headers-${KERNEL_NAME}"
DEPENDS += "${KERNEL_HEADERS_PKG}"
DEBIAN_BUILD_DEPENDS = "${KERNEL_HEADERS_PKG}"
+SIGNATURE_KEYFILE ??= ""
+SIGNATURE_CERTFILE ??= ""
+SIGNATURE_HASHFN ??= "sha256"
+
SRC_URI += "file://debian/"
AUTOLOAD ?= ""
@@ -33,6 +37,9 @@ TEMPLATE_VARS += " \
KERNEL_IMAGE_PKG \
KERNEL_HEADERS_PKG \
DEBIAN_BUILD_DEPENDS \
+ SIGNATURE_KEYFILE \
+ SIGNATURE_CERTFILE \
+ SIGNATURE_HASHFN \
PN"
do_prepare_build() {
--
2.34.1
next prev parent reply other threads:[~2022-12-23 8:41 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-23 8:40 [PATCH 00/10] Add support for secureboot using Debian boot chain Felix Moessbauer
2022-12-23 8:40 ` [PATCH 01/10] wic: add option to use debian EFI shim Felix Moessbauer
2022-12-23 8:40 ` [PATCH 02/10] add debian sb chain bootloader dependencies Felix Moessbauer
2022-12-23 8:40 ` [PATCH 03/10] add example wic file for sb debian boot chain Felix Moessbauer
2022-12-23 8:40 ` [PATCH 04/10] style: split overlong line in module.inc Felix Moessbauer
2022-12-23 8:40 ` Felix Moessbauer [this message]
2022-12-23 8:40 ` [PATCH 06/10] add example to generated and distribute MOK data Felix Moessbauer
2023-02-03 6:05 ` Jan Kiszka
2022-12-23 8:40 ` [PATCH 07/10] add signed variant of example-module Felix Moessbauer
2022-12-23 8:40 ` [PATCH 08/10] add new machine qemuamd64-sb and corresponding mc Felix Moessbauer
2022-12-23 8:40 ` [PATCH 09/10] fix: only append kargs and extra_kargs if set Felix Moessbauer
2022-12-23 8:40 ` [PATCH 10/10] start_vm: add support for secureboot Felix Moessbauer
2023-01-27 5:07 ` Uladzimir Bely
2023-01-27 8:11 ` Moessbauer, Felix
2023-01-27 8:41 ` Florian Bezdeka
2023-01-27 9:10 ` Uladzimir Bely
2023-01-25 7:17 ` [PATCH 00/10] Add support for secureboot using Debian boot chain Uladzimir Bely
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221223084058.1899957-6-felix.moessbauer@siemens.com \
--to=felix.moessbauer@siemens.com \
--cc=christian.storm@siemens.com \
--cc=isar-users@googlegroups.com \
--cc=tobias.preclik@siemens.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox