From fb11260b860d337cbd1954c36c54cf756c3c4f8e Mon Sep 17 00:00:00 2001 From: Steven Brudenell Date: Sun, 6 Feb 2022 02:56:30 -0900 Subject: [PATCH 1/2] Add luksuuid= and lukskeydesc= --- initramfs-init.in | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/initramfs-init.in b/initramfs-init.in index 7118dad..8582a53 100755 --- a/initramfs-init.in +++ b/initramfs-init.in @@ -347,7 +347,7 @@ myopts="alpine_dev autodetect autoraid chart cryptroot cryptdm cryptheader crypt cryptdiscards cryptkey debug_init dma init init_args keep_apk_new modules ovl_dev pkgs quiet root_size root usbdelay ip alpine_repo apkovl alpine_start splash blacklist overlaytmpfs overlaytmpfsflags rootfstype rootflags nbd resume s390x_net - dasd ssh_key BOOTIF zfcp" + dasd ssh_key BOOTIF zfcp luksuuid lukskeydesc" for opt; do case "$opt" in @@ -364,7 +364,7 @@ for opt; do for i in $myopts; do case "$opt" in - $i=*) eval "KOPT_${i}"='${opt#*=}';; + $i=*) eval "KOPT_${i}=\${KOPT_${i}:+\$KOPT_${i} }${opt#*=}";; $i) eval "KOPT_${i}=yes";; no$i) eval "KOPT_${i}=no";; esac @@ -492,6 +492,18 @@ if [ -n "$KOPT_cryptroot" ]; then fi fi +if [ -n "$KOPT_lukskeydesc" ]; then + read -s -p "Passphrase for key $KOPT_lukskeydesc: " + echo -n "$REPLY" | /bin/keyctl padd user "$KOPT_lukskeydesc" @u +fi + +for uuid in $KOPT_luksuuid; do + nlplug-findfs $cryptopts -p /sbin/mdev ${KOPT_debug_init:+-d} UUID=$uuid + dev=$(findfs UUID=$uuid) + echo "Unlocking $dev as luks-$uuid" + /sbin/cryptsetup open $dev luks-$uuid +done + if [ -n "$KOPT_nbd" ]; then # TODO: Might fail because nlplug-findfs hasn't plugged eth0 yet configure_ip From 51728e8225c93c00f6d80934f9cee008f9a0c4f5 Mon Sep 17 00:00:00 2001 From: Steven Brudenell Date: Sun, 6 Feb 2022 16:06:14 -0900 Subject: [PATCH 2/2] Add keyctl feature --- features.d/keyctl.files | 1 + 1 file changed, 1 insertion(+) create mode 100644 features.d/keyctl.files diff --git a/features.d/keyctl.files b/features.d/keyctl.files new file mode 100644 index 0000000..6792707 --- /dev/null +++ b/features.d/keyctl.files @@ -0,0 +1 @@ +/bin/keyctl