Skip to content

Commit ace5205

Browse files
committed
Fix: check segments in addition to keyslots in LUKS header
1 parent 63268f4 commit ace5205

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

pkg/mount_luks.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,16 @@ case $? in
2626
NULL_CIPHERS=$(echo "$LUKS_DUMP" | jq '[.keyslots.[].area.encryption] | select(any(contains("null")))')
2727

2828
if [ -n "$NULL_CIPHERS" ]; then
29-
echo "cipher_null is not allowed in LUKS header"
29+
echo "cipher_null in keyslots is not allowed in LUKS header"
3030
exit 3
31-
fi
31+
fi
32+
33+
NULL_CIPHERS=$(echo "$LUKS_DUMP" | jq '[.segments.[].encryption] | select(any(contains("null")))')
34+
35+
if [ -n "$NULL_CIPHERS" ]; then
36+
echo "cipher_null in segments is not allowed in LUKS header"
37+
exit 4
38+
fi
3239

3340
# unlock the partition
3441
/lib/systemd/systemd-cryptsetup attach cosmian_vm_container /var/lib/cosmian_vm/container - tpm2-device=auto,headless=true,header=/var/lib/cosmian_vm/header || exit 1

0 commit comments

Comments
 (0)