mirror of
https://github.com/linuxboot/heads.git
synced 2024-12-29 17:28:54 +00:00
40c34453df
Exception: scripts sourcing/calls within etc/ash_functions continues to use old TRACE functions until we switch to bash completely getting rid of ash. This would mean getting rid of legacy boards (flash + legacy boards which do not have enough space for bash in flash boards) once and for all. Signed-off-by: Thierry Laurion <insurgo@riseup.net>
25 lines
829 B
Bash
Executable File
25 lines
829 B
Bash
Executable File
#!/bin/bash
|
|
# Measure all of the LUKS Disk Encryption headers into
|
|
# a PCR so that we can detect disk swap attacks.
|
|
. /etc/functions
|
|
|
|
TRACE_FUNC
|
|
DEBUG "Arguments passed to qubes-measure-luks: $@"
|
|
|
|
# Measure the LUKS headers into PCR 6
|
|
for dev in "$@"; do
|
|
DEBUG "Storing LUKS header for $dev into /tmp/lukshdr-$(echo "$dev" | sed 's/\//_/g')"
|
|
cryptsetup luksHeaderBackup $dev \
|
|
--header-backup-file /tmp/lukshdr-$(echo "$dev" | sed 's/\//_/g') ||
|
|
die "$dev: Unable to read LUKS header"
|
|
done
|
|
|
|
DEBUG "Hashing LUKS headers into /tmp/luksDump.txt"
|
|
sha256sum /tmp/lukshdr-* >/tmp/luksDump.txt || die "Unable to hash LUKS headers"
|
|
DEBUG "Removing /tmp/lukshdr-*"
|
|
rm /tmp/lukshdr-*
|
|
|
|
DEBUG "Extending TPM PCR 6 with hash of LUKS headers from /tmp/luksDump.txt"
|
|
tpmr extend -ix 6 -if /tmp/luksDump.txt ||
|
|
die "Unable to extend PCR"
|