mirror of
https://github.com/xcat2/confluent.git
synced 2026-10-20 14:45:45 +00:00
Change TPM reseal to be more generic
The crypttab in Ubuntu does not have that indication. Instead just iterate through crypttab devices and for any tpm2 sealed ones, reseal them.
This commit is contained in:
@@ -99,22 +99,25 @@ while IFS= read -r line; do
|
||||
[[ "$line" =~ ^[[:space:]]*# ]] && continue
|
||||
[[ -z "$line" ]] && continue
|
||||
|
||||
# Check if line contains tpm2-device
|
||||
if [[ "$line" =~ tpm2-device ]]; then
|
||||
# Extract the second column (device or UUID)
|
||||
device=$(echo "$line" | awk '{print $2}')
|
||||
|
||||
device=$(echo "$line" | awk '{print $2}')
|
||||
|
||||
# If it's a UUID, convert to device name
|
||||
if [[ "$device" =~ ^UUID= ]]; then
|
||||
device=$(blkid -U "${device#UUID=}")
|
||||
fi
|
||||
|
||||
if [ -e /bin/systemd-cryptenroll ]; then
|
||||
systemd-cryptenroll "$device" | grep -q "tpm2" || continue
|
||||
else
|
||||
clevis luks list -d "$device" | grep -q "tpm2" || continue
|
||||
fi
|
||||
|
||||
# If it's a UUID, convert to device name
|
||||
if [[ "$device" =~ ^UUID= ]]; then
|
||||
device=$(blkid -U "${device#UUID=}")
|
||||
fi
|
||||
|
||||
# Process the device
|
||||
if [[ -n "$device" ]]; then
|
||||
reseal_luks "$device"
|
||||
else
|
||||
echo "Warning: Could not determine device for line: $line" >&2
|
||||
fi
|
||||
# Process the device
|
||||
if [[ -n "$device" ]]; then
|
||||
reseal_luks "$device"
|
||||
else
|
||||
echo "Warning: Could not determine device for line: $line" >&2
|
||||
fi
|
||||
done < /etc/crypttab
|
||||
|
||||
|
||||
Reference in New Issue
Block a user