-
Notifications
You must be signed in to change notification settings - Fork 388
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
T861: sign all Kernel modules with an ephemeral key
The shim review board (which is the secure boot base loader) recommends using ephemeral keys when signing the Linux Kernel. This commit enables the Kernel build system to generate a one-time ephemeral key that is used to: * sign all build-in Kernel modules * sign all other out-of-tree Kernel modules The key lives in /tmp and is destroyed after the build container exits and is named: "VyOS build time autogenerated kernel key". In addition the Kernel now uses CONFIG_MODULE_SIG_FORCE. This now makes it unable to load any Kernel Module to the image that is NOT signed by the ephemeral key.
- Loading branch information
Showing
29 changed files
with
392 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
#!/bin/sh | ||
|
||
echo I: Creating kernel symlinks. | ||
echo I: Creating Linux Kernel symbolic links | ||
cd /boot | ||
ln -s initrd.img-* initrd.img | ||
ln -s vmlinuz-* vmlinuz | ||
|
||
echo I: Remove Linux Kernel symbolic link to source folder | ||
rm -rf /lib/modules/*/build |
22 changes: 22 additions & 0 deletions
22
data/live-build-config/hooks/live/93-sb-sign-kernel.chroot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/sh | ||
SIGN_FILE=$(find /usr/lib -name sign-file) | ||
MOK_KEY="/var/lib/shim-signed/mok/MOK.key" | ||
MOK_CERT="/var/lib/shim-signed/mok/MOK.pem" | ||
VMLINUZ=$(readlink /boot/vmlinuz) | ||
|
||
# All Linux Kernel modules need to be cryptographically signed | ||
find /lib/modules -type f -name \*.ko | while read MODULE; do | ||
modinfo ${MODULE} | grep -q "signer:" | ||
if [ $? != 0 ]; then | ||
echo "E: Module ${MODULE} is not signed!" | ||
read -n 1 -s -r -p "Press any key to continue" | ||
fi | ||
done | ||
|
||
if [ ! -f ${MOK_KEY} ]; then | ||
echo "I: Signing key for Linux Kernel not found - Secure Boot not possible" | ||
else | ||
echo "I: Signing Linux Kernel for Secure Boot" | ||
sbsign --key ${MOK_KEY} --cert ${MOK_CERT} /boot/${VMLINUZ} --output /boot/${VMLINUZ} | ||
sbverify --list /boot/${VMLINUZ} | ||
fi |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,8 @@ | |
/QAT* | ||
*.tar.xz | ||
/*.postinst | ||
/ephemeral.key | ||
/ephemeral.pem | ||
|
||
# Intel Driver source | ||
i40e-*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/sh | ||
|
||
BASE_DIR=$(dirname $0) | ||
MODULE_DIR=$1 | ||
. ${BASE_DIR}/kernel-vars | ||
|
||
SIGN_FILE="${KERNEL_DIR}/scripts/sign-file" | ||
|
||
if [ -f ${EPHEMERAL_KEY} ] && [ -f ${EPHEMERAL_CERT} ]; then | ||
find ${MODULE_DIR} -type f -name \*.ko | while read MODULE; do | ||
echo "I: Signing ${MODULE} ..." | ||
${SIGN_FILE} sha512 ${EPHEMERAL_KEY} ${EPHEMERAL_CERT} ${MODULE} | ||
done | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.