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

docs: Document TPM-backed rootfs encryption #317

Merged
merged 1 commit into from
Apr 11, 2024
Merged

docs: Document TPM-backed rootfs encryption #317

merged 1 commit into from
Apr 11, 2024

Conversation

pothos
Copy link
Member

@pothos pothos commented Apr 8, 2024

A long-requested feature is disk encryption. In the next Alpha we have everything in place for TPM-backed disk encryption with systemd-cryptenroll and Clevis, and with a network-backed disk secret store with Tang.
Document the limitations, implications and the Ignition configs.

Preview URL suffix: /docs/latest/setup/security/luks/

Copy link

github-actions bot commented Apr 8, 2024

Azure Static Web Apps: Your stage site is ready! Visit it here: https://lemon-wave-085522403-317.westeurope.1.azurestaticapps.net

@pothos
Copy link
Member Author

pothos commented Apr 9, 2024

I've added a helper service for stronger PCR binding when updates are disabled

Copy link

github-actions bot commented Apr 9, 2024

Azure Static Web Apps: Your stage site is ready! Visit it here: https://lemon-wave-085522403-317.westeurope.1.azurestaticapps.net

@pothos
Copy link
Member Author

pothos commented Apr 9, 2024

I've added a helper service for stronger PCR binding when updates are disabled

Also added a more advanced setup that can do rebinding on updates.
While testing I noticed that the current use of GRUB in Flatcar doesn't measure anything in PCR 8, we should fix that to make stronger binding possible.

Copy link

github-actions bot commented Apr 9, 2024

Azure Static Web Apps: Your stage site is ready! Visit it here: https://lemon-wave-085522403-317.westeurope.1.azurestaticapps.net

@pothos
Copy link
Member Author

pothos commented Apr 9, 2024

While testing I noticed that the current use of GRUB in Flatcar doesn't measure anything in PCR 8, we should fix that to make stronger binding possible.

What I found was insmod tpm and tpm_record_pcrs 0-9 but it sometimes doesn't directly work and I didn't find any docs on that…

Copy link

github-actions bot commented Apr 9, 2024

Azure Static Web Apps: Your stage site is ready! Visit it here: https://lemon-wave-085522403-317.westeurope.1.azurestaticapps.net

Copy link

github-actions bot commented Apr 9, 2024

Azure Static Web Apps: Your stage site is ready! Visit it here: https://lemon-wave-085522403-317.westeurope.1.azurestaticapps.net

Copy link

github-actions bot commented Apr 9, 2024

Azure Static Web Apps: Your stage site is ready! Visit it here: https://lemon-wave-085522403-317.westeurope.1.azurestaticapps.net

Copy link

github-actions bot commented Apr 9, 2024

Azure Static Web Apps: Your stage site is ready! Visit it here: https://lemon-wave-085522403-317.westeurope.1.azurestaticapps.net

Copy link

github-actions bot commented Apr 9, 2024

Azure Static Web Apps: Your stage site is ready! Visit it here: https://lemon-wave-085522403-317.westeurope.1.azurestaticapps.net

@pothos
Copy link
Member Author

pothos commented Apr 9, 2024

What I found was insmod tpm and tpm_record_pcrs 0-9 but it sometimes doesn't directly work and I didn't find any docs on that…

I think I now have a setup that should work, it's the last Butane example. One more reboot was needed after an update is booted because grub reads the GPT flags and takes a different code path to reduce the tries to 0.

Copy link

github-actions bot commented Apr 9, 2024

Azure Static Web Apps: Your stage site is ready! Visit it here: https://lemon-wave-085522403-317.westeurope.1.azurestaticapps.net

Copy link

github-actions bot commented Apr 9, 2024

Azure Static Web Apps: Your stage site is ready! Visit it here: https://lemon-wave-085522403-317.westeurope.1.azurestaticapps.net

Copy link

github-actions bot commented Apr 9, 2024

Azure Static Web Apps: Your stage site is ready! Visit it here: https://lemon-wave-085522403-317.westeurope.1.azurestaticapps.net

append:
- inline: |
insmod tpm
tpm_record_pcrs 8-9
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think tpm_record_pcrs is not needed, but not really sure yet.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it doesn't hurt I guess we could keep it but if it's a no-op we can also remove it again.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would remove this and make sure grub does the measuring by default. we don't want everyone to run a different configuration that we risk breaking

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prepared a change here: flatcar/scripts#1861

Example for TPM2-backed rootfs encryption with systemd-cryptenroll and stronger PCR binding (requires UEFI), with a added unbinding while the update reboot is pending (Butane YAML):

```yaml
variant: flatcar
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested also on Hyper-V with TPM2 functionality, works as expected.

ader1990
ader1990 previously approved these changes Apr 9, 2024
pothos added a commit to flatcar/scripts that referenced this pull request Apr 9, 2024
For binding a secret to the OS we need TPM PCRs that measure the kernel
and boot configuration. Used for:
flatcar/flatcar-website#317
@pothos
Copy link
Member Author

pothos commented Apr 9, 2024

By removing the PCR 5 binding the additional update reboot can be removed and I think this has no security implications.

Copy link

github-actions bot commented Apr 9, 2024

Azure Static Web Apps: Your stage site is ready! Visit it here: https://lemon-wave-085522403-317.westeurope.1.azurestaticapps.net

pothos added a commit to flatcar/scripts that referenced this pull request Apr 9, 2024
For binding a secret to the OS we need TPM PCRs that measure the kernel
and boot configuration (UEFI). Used for:
flatcar/flatcar-website#317
pothos added a commit to flatcar/scripts that referenced this pull request Apr 9, 2024
For binding a secret to the OS we need TPM PCRs that measure the kernel
and boot configuration (UEFI). Used for:
flatcar/flatcar-website#317
Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://lemon-wave-085522403-317.westeurope.1.azurestaticapps.net

pothos added a commit to flatcar/mantle that referenced this pull request Apr 10, 2024
As documented in flatcar/flatcar-website#317
we can use PCR binding in Flatcar with some limitations and workarounds.
I think we should be able to get rid of the first boot PCR difference
by handling the first-boot flag detection in userspace and if we can
guarantee that the outcome of setting the first boot or not is the same,
i.e., we would have to always measure the effective Ignition config.
For the rebinding on update the best bet we have is to create a Flatcar
variant with sd-boot for signed PCR policies. Anyway, these are future
topics and it's already good that we can make some encryption setups
work.
pothos added a commit to flatcar/mantle that referenced this pull request Apr 10, 2024
As documented in flatcar/flatcar-website#317
we can use PCR binding in Flatcar with some limitations and workarounds.
I think we should be able to get rid of the first boot PCR difference
by handling the first-boot flag detection in userspace and if we can
guarantee that the outcome of setting the first boot or not is the same,
i.e., we would have to always measure the effective Ignition config.
For the rebinding on update the best bet we have is to create a Flatcar
variant with sd-boot for signed PCR policies. Anyway, these are future
topics and it's already good that we can make some encryption setups
work.
pothos added a commit to flatcar/mantle that referenced this pull request Apr 10, 2024
As documented in flatcar/flatcar-website#317
we can use PCR binding in Flatcar with some limitations and workarounds.
I think we should be able to get rid of the first boot PCR difference
by handling the first-boot flag detection in userspace and if we can
guarantee that the outcome of setting the first boot or not is the same,
i.e., we would have to always measure the effective Ignition config.
For the rebinding on update the best bet we have is to create a Flatcar
variant with sd-boot for signed PCR policies. Anyway, these are future
topics and it's already good that we can make some encryption setups
work.
pothos added a commit to flatcar/mantle that referenced this pull request Apr 10, 2024
As documented in flatcar/flatcar-website#317
we can use PCR binding in Flatcar with some limitations and workarounds.
I think we should be able to get rid of the first boot PCR difference
by handling the first-boot flag detection in userspace and if we can
guarantee that the outcome of setting the first boot or not is the same,
i.e., we would have to always measure the effective Ignition config.
For the rebinding on update the best bet we have is to create a Flatcar
variant with sd-boot for signed PCR policies. Anyway, these are future
topics and it's already good that we can make some encryption setups
work.
pothos added a commit to flatcar/mantle that referenced this pull request Apr 10, 2024
As documented in flatcar/flatcar-website#317
we can use PCR binding in Flatcar with some limitations and workarounds.
I think we should be able to get rid of the first boot PCR difference
by handling the first-boot flag detection in userspace and if we can
guarantee that the outcome of setting the first boot or not is the same,
i.e., we would have to always measure the effective Ignition config.
For the rebinding on update the best bet we have is to create a Flatcar
variant with sd-boot for signed PCR policies. Anyway, these are future
topics and it's already good that we can make some encryption setups
work.
pothos added a commit to flatcar/mantle that referenced this pull request Apr 10, 2024
As documented in flatcar/flatcar-website#317
we can use PCR binding in Flatcar with some limitations and workarounds.
I think we should be able to get rid of the first boot PCR difference
by handling the first-boot flag detection in userspace and if we can
guarantee that the outcome of setting the first boot or not is the same,
i.e., we would have to always measure the effective Ignition config.
For the rebinding on update the best bet we have is to create a Flatcar
variant with sd-boot for signed PCR policies. Anyway, these are future
topics and it's already good that we can make some encryption setups
work.
pothos added a commit to flatcar/mantle that referenced this pull request Apr 10, 2024
As documented in flatcar/flatcar-website#317
we can use PCR binding in Flatcar with some limitations and workarounds.
I think we should be able to get rid of the first boot PCR difference
by handling the first-boot flag detection in userspace and if we can
guarantee that the outcome of setting the first boot or not is the same,
i.e., we would have to always measure the effective Ignition config.
For the rebinding on update the best bet we have is to create a Flatcar
variant with sd-boot for signed PCR policies. Anyway, these are future
topics and it's already good that we can make some encryption setups
work.
pothos added a commit to flatcar/mantle that referenced this pull request Apr 10, 2024
As documented in flatcar/flatcar-website#317
we can use PCR binding in Flatcar with some limitations and workarounds.
I think we should be able to get rid of the first boot PCR difference
by handling the first-boot flag detection in userspace and if we can
guarantee that the outcome of setting the first boot or not is the same,
i.e., we would have to always measure the effective Ignition config.
For the rebinding on update the best bet we have is to create a Flatcar
variant with sd-boot for signed PCR policies. Anyway, these are future
topics and it's already good that we can make some encryption setups
work.
@pothos
Copy link
Member Author

pothos commented Apr 10, 2024

yes, we definitely need PCR binding tests in mantle too

Tests added in flatcar/mantle#521

I also think we could try to unify the PCR values for the first boot and the other boots by not using a kernel parameter for first-boot or not but measure the effective Ignition config on every boot.

pothos added a commit to flatcar/scripts that referenced this pull request Apr 10, 2024
For binding a secret to the OS we need TPM PCRs that measure the kernel
and boot configuration (UEFI). Used for:
flatcar/flatcar-website#317
A long-requested feature is disk encryption. In the next Alpha we have
everything in place for TPM-backed disk encryption with
systemd-cryptenroll and Clevis, and with a network-backed disk secret
store with Tang.
Document the limitations, implications and the Ignition configs.
@pothos
Copy link
Member Author

pothos commented Apr 11, 2024

I also think we could try to unify the PCR values for the first boot and the other boots by not using a kernel parameter for first-boot or not but measure the effective Ignition config on every boot.

That won't happen for this release, I'll merge it as is now and hope we can get rid of the first reboot soon.

Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://lemon-wave-085522403-317.westeurope.1.azurestaticapps.net

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants