Skip to content

Commit e94c7a4

Browse files
author
CKI KWF Bot
committed
Merge: redhat: automotive: logic to defer signing at image composition
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/1213 JIRA: https://issues.redhat.com/browse/RHEL-78808 Amend the automotive configuration to allow certificate insertion in the kernel binary and amend the kernel.spec template to skip redundant signing and remove persistent trusted certificates from the keyring. This is intended to be used with atomic images only where the module signing is done at image composition, the trusted certificate is inserted into the system keyring and the kernel is then signed/measured. The result is an image containing a kernel only able to load a subset of the available modules in the kernel RPM set, based on the image configuration. The build-time signature of the modules is still done for debugging on non-atomic images where RPMs might be installed on their own in an already deployed rootfs. Signed-off-by: Eric Chanudet <echanude@redhat.com> Approved-by: Jared Kangas <jkangas@redhat.com> Approved-by: Jan Stancek <jstancek@redhat.com> Approved-by: Rafael Aquini <raquini@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: CKI GitLab Kmaint Pipeline Bot <26919896-cki-kmaint-pipeline-bot@users.noreply.gitlab.com>
2 parents a3c08da + cb1381d commit e94c7a4

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# CONFIG_MODULE_SIG_ALL is not set
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CONFIG_SYSTEM_EXTRA_CERTIFICATE=y
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CONFIG_SYSTEM_EXTRA_CERTIFICATE_SIZE=4096

redhat/kernel.spec.template

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ Summary: The Linux kernel
111111
# Sign modules on all arches
112112
%global signmodules 1
113113

114+
# Add additional rhel certificates to system trusted keys.
115+
%global rhelkeys 1
116+
114117
# Compress modules only for architectures that build modules
115118
%ifarch noarch
116119
%global zipmodules 0
@@ -460,6 +463,9 @@ Summary: The Linux kernel
460463
%define with_kabichk 0
461464
%define with_kernel_abi_stablelists 0
462465
%define with_kabidw_base 0
466+
%define signkernel 0
467+
%define signmodules 1
468+
%define rhelkeys 0
463469
%endif
464470

465471

@@ -767,9 +773,8 @@ BuildRequires: libnl3-devel
767773
BuildRequires: python3-pyyaml python3-jsonschema python3-pip python3-setuptools python3-wheel
768774
%endif
769775

770-
%if %{with_tools} || %{signmodules} || %{signkernel}
771776
BuildRequires: openssl-devel
772-
%endif
777+
773778
%if %{with_selftests}
774779
BuildRequires: clang llvm-devel fuse-devel zlib-devel binutils-devel python3-docutils python3-jsonschema
775780
%ifarch x86_64 riscv64
@@ -2046,12 +2051,16 @@ done
20462051
%if %{signkernel}%{signmodules}
20472052

20482053
# Add DUP and kpatch certificates to system trusted keys for RHEL
2054+
truncate -s0 ../certs/rhel.pem
20492055
%if 0%{?rhel}
2056+
%if %{rhelkeys}
20502057
%{log_msg "Add DUP and kpatch certificates to system trusted keys for RHEL"}
20512058
openssl x509 -inform der -in %{SOURCE100} -out rheldup3.pem
20522059
openssl x509 -inform der -in %{SOURCE101} -out rhelkpatch1.pem
20532060
openssl x509 -inform der -in %{SOURCE102} -out nvidiagpuoot001.pem
2054-
cat rheldup3.pem rhelkpatch1.pem nvidiagpuoot001.pem > ../certs/rhel.pem
2061+
cat rheldup3.pem rhelkpatch1.pem nvidiagpuoot001.pem >> ../certs/rhel.pem
2062+
# rhelkeys
2063+
%endif
20552064
%if %{signkernel}
20562065
%ifarch s390x ppc64le
20572066
openssl x509 -inform der -in %{secureboot_ca_0} -out secureboot.pem

0 commit comments

Comments
 (0)