Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qubes luks is not using the TPM for disk keys #29

Closed
osresearch opened this issue Sep 16, 2016 · 7 comments
Closed

Qubes luks is not using the TPM for disk keys #29

osresearch opened this issue Sep 16, 2016 · 7 comments

Comments

@osresearch
Copy link
Collaborator

The disk key should be a combination of the user password and the TPM secret, currently it is just the user password.

@osresearch osresearch added the bug label Sep 16, 2016
@osresearch osresearch added this to the measuredboot milestone Sep 16, 2016
@tlaurion
Copy link
Collaborator

tlaurion commented Sep 17, 2016

Not sure about this. The Luks container should be verified against
tampering. The disk shouldn't be bound to a single computer.

@osresearch
Copy link
Collaborator Author

My concern with not tying the disk key to the TPM is the ease of surreptitiously cloning the disk on the x230 -- one phillips screw and the SSD slides out -- followed by an offline (or shoulder-surfing) attack on the passphrase. If the key is derived from both the user passphrase and the TPM, then the attacker would need possession of the machine and the TPM can enforce rate limiting, etc.

@osresearch
Copy link
Collaborator Author

Hackish way to test it out -- extract Qubes initrd into /tmp/, chroot into it and activate the disk:

chroot /tmp/initrd
mount -t proc none /proc
mount -t sysfs none /sys
mount -t devtmpfs none /dev
lvm lvchange -a y qubes_dom0
lvm lvscan
cryptsetup luksDump /dev/dm-0
cryptsetup luksAddKey /dev/dm-0 /secret.key

The setup fails since the Heads kernel doesn't have aes-xts-plain64 cipher support. (Issue #44)

The secret key is not the right size since sealfile2 fails on larger than 128 byte files. (Issue #45)

@osresearch
Copy link
Collaborator Author

Once the kernel has been rebuilt, add the keys as before. Then check that it can be mounted with:

cryptsetup --keyfile /secret.key luksOpen /dev/dm-1 qubes-root
mount -o ro /dev/dm-3 /root

The key can be sealed and the stored in the NVRAM. The NVRAM space with the key should be password protected, which will require the user to input a password before the key can be unlocked. This will provide rate limiting.

On boot up the official initramfs can be copied to Heads' /tmp, the key can be retrieved from the NVRAM (with the password) and unsealed (based on the PCRs). This can be put into a cpio file and appended to the official initramfs -- http://unix.stackexchange.com/questions/243657/appending-files-to-initramfs-image-reliable

The kernel boot parameters need to be amended to specify the rd.luks.keyfile= for the partitions. This didn't work the first time; need to try again.

@osresearch
Copy link
Collaborator Author

The initramfs file doesn't seem to be handled the way that I had hoped -- it doesn't decompress all of the pieces, so it is necessary to append to it. The wrap-cpio program will merge multiple cpio files to install the ones that we want, but the other parts still need to be written.

@osresearch
Copy link
Collaborator Author

The keyfile parameter might be fixed in systemd: systemd/systemd@c802a73

osresearch added a commit that referenced this issue Apr 3, 2017
This also adds a set of files in the qubes/ directory that
are meant to be copied to the /boot partition.

Issue #154: for ease of upgrading Qubes, the script should
live on /boot instead of in the ROM.  This requires a GPG
signature on the startup script to avoid attacks by modifying
the boot script.

Issue #123: this streamlines the boot process for Qubes, although
the disk password is still not passed in correctly to the initrd
(issue #29).

This does not address issues #110 of how to find the root device.
The best approach is probably disk labels, which will require
special installation instructions.
osresearch added a commit that referenced this issue Apr 3, 2017
Issue #123: This streamline Qubes startup experience by
making it possible to have a single-password decryption.

Issue #29: The disk keys in `/secret.key` are passed to the systemd
in initramfs through `/etc/crypttab`, which is generated on each boot.
This is slow; need to look at alternate ways.

Issue #110: By using LVM instead of partitions it is now
possible to find the root filesystem in a consistent way.

Issue #80: LVM is now included in the ROM.
@osresearch
Copy link
Collaborator Author

The systemd fix doesn't actually work -- only the root partition is decrypted with that parameter. Instead I've modified /boot/boot.sh to generate /etc/crypttab on every boot with a reference to /secret.key. This is slow but effective.

osresearch added a commit that referenced this issue Apr 12, 2017
This adds support for seamless booting of Qubes with a TPM disk key,
as well as signing of qubes files in /boot with a Yubikey.

The signed hashes also includes a TPM counter, which is incremented
when new hashes are signed.  This prevents rollback attacks against
the /boot filesystem.

The TPMTOTP value is presented to the user at the time of entering
the disk encryption keys.  Hitting enter will generate a new code.

The LUKS headers are included in the TPM sealing of the disk
encryption keys.
tlaurion pushed a commit to tlaurion/heads that referenced this issue May 3, 2024
issue linuxboot#29 and issue linuxboot#30

Also improve tag list output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants