linuxboot / heads-wiki

Documentation for the Heads firmware project
85 stars 44 forks source link

Document how to reseal disk encryption key in the TPM #118

Open rbreslow opened 1 year ago

rbreslow commented 1 year ago

From https://github.com/osresearch/heads/pull/1282:

I had trouble after reflashing because it wasn't obvious how to reseal the disk encryption key in the TPM. For posterity: You have to navigate Options -->Boot Options -->Show OS boot menuQubes,_with_Xen_hypervisorMake default and then Heads will prompt Do you want to reseal a disk key to the TPM [y/N]:.

We should document things that could lead to this. For example, flashing an updated Heads that changes TPM measurements. Perhaps it belongs in the upgrade guide or an FAQ?

Edit: Soon as I posted this, I found https://osresearch.net/Updating#re-owning-the-states:

  • Sign /boot content (GPG User PIN required)
  • Select a new boot default through Boot Options (GPG User PIN required to sign the new default)
    • Optionally set a TPM Disk Unlock Key (Disk Recovery Key passphrase and GPG User PIN required)

I don't think this is clear, and it doesn't explicitly mention resealing the disk encryption key.

tlaurion commented 1 year ago

@rbreslow yes.

I am playing with TPM disk unlock sealing/unsealing right now under https://github.com/osresearch/heads/issues/1283 and i'm realizing as part of qemu-coreboot-fbwhiptail-tpm1 testings that

if:

With that in place, selecting default boot could pick up on the differences in TCPA log (afterall, reflashing requires resealing measurements for TPMTOTP/HOTP because unsealing wasn't possible because measurements wee inconsistent).

The reasoning of this proposition is that two mechanisms are at play under Heads:

When comes the time to unseal, we ask the user to reseal if TPM measurements are inconsistent. But we do not ask the user to recreate hashes and resign (those should not be inconsistent and should not matter). The only place where that matters is at default boot, where the disk unlock key will not unseal if additional things changed. For the matter, if the LUKS header changed, unsealing will fail since measured and sealed for TPM disk unlock key.

With the above proposed change, at time of unsealing, the user could be made aware that what was part of coreboot measured boot changed (maybe show diff even if technically valid but not relevant for non-technical users).

Other thoughts


tlaurion commented 1 year ago

@rbreslow counter thought?