s390x: add LUKS keyfile to 'sd-boot'

This allows to use Secure Execution with LUKS encrypted boot disk,
key and cryptab are stored only in 'sd-boot' encrypted image.

Signed-off-by: Nikita Dubrovskii <nikita@linux.ibm.com>
This commit is contained in:
Nikita Dubrovskii committed 2022-02-11 09:02:42 +01:00
1 parent c27b98a2cb
commit d1ab18f327
3 files changed
+77 -4

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
#!/usr/bin/bash
# This script creates new initramdisk with LUKS config within
set -euo pipefail
old_initrd=$1
new_initrd=$2
# Unpacking existing initramdisk
workdir=$(mktemp -d -p /tmp se-initramfs-XXXXXX)
cd ${workdir}
gzip -cd ${old_initrd} | cpio -imd --quiet
# Adding LUKS root key and crypttab config
mkdir -p etc/luks
cp -f /etc/luks/root etc/luks/
cp -f /etc/crypttab etc/
# Creating new initramdisk image
find . | cpio --quiet -H newc -o | gzip -9 -n >> ${new_initrd}
# Cleanup
rm -rf ${workdir}