Skip to content

Commit 6f4b4f8

Browse files
committed
Fix: check for cipher_null before attaching LUKS container
1 parent 1eb0934 commit 6f4b4f8

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

pkg/mount_luks.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ case $? in
1515
;;
1616
# failure; the directory is not a mountpoint, or device is not a block device on --devno
1717
32)
18+
NULL_CIPHERS=$(cryptsetup luksDump --dump-json-metadata /home/cosmian/header | jq '[.keyslots.[].area.encryption] | select(any(contains("null")))')
19+
20+
if [ -n "$NULL_CIPHERS" ]; then
21+
echo "cipher_null is not allowed in LUKS header"
22+
exit 2
23+
fi
24+
1825
# unlock the partition
1926
/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
2027
# mount the partition

0 commit comments

Comments
 (0)