Hello,

I’ve an HP EliteBook 840 G5 that I’ve been using up until now with Windows 10. I want to replace it with Debian 12 however since this is a laptop I would like to have my disk fully encrypted as well as the boot stage (initramfs etc).

My threat model: make sure if someone stoles the laptop, powered off, they won’t be able to access my data. I would also like to avoid evil maid attacks and make sure I’m not booting into some modified kernel / system with spyware or that will leak my TPM keys.

I’ve found some information online but I’m unsure of how secure those setups are and/or if it isn’t even possible to have the same level of security that Windows provides.

Here are a few of my questions:

  • Anyone around here that has a similar HP laptop and did this?
  • What about enrolling secure boot keys on the UEFI? From what I read simply using the typical Linux shim makes things more secure but it doesn’t fix the problem. Enrolling keys seems to break some motherboards
  • Even if I use --tpm2-pcrs=1,4,5,7,9 how secure is that, should I add more?
  • What is the impact of this in system upgrades? How do I deal with those?
  • If I want to proceed with this what I should know / what typically fails or can be problematic / security issue?

Some of the information I found:

Thank you.

  • spiffeeroo@programming.dev
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    I think pcr 7+8 (for grub) or pcr 7+12 (for systemd-boot) should be okay. The more pcr you add, the higher likelihood you need to re-enroll after updates.

    https://www.freedesktop.org/software/systemd/man/systemd-cryptenroll.html

    The reason why using your own keys can be a problem is if you exclude the Microsoft certificates, then oproms from graphics cards stop working. You have to add the Microsoft certs after using your own key for the top level platform key.

    For Debian, if you use out of kernel modules like Nvidia, you have create signing keys and edit a config file so dkms to sign those modules for those modules to work with Secure Boot. Instructions are on the Debian wiki.

    https://wiki.debian.org/SecureBoot#MOK_-_Machine_Owner_Key

    • TCB13@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      The more pcr you add, the higher likelihood you need to re-enroll after updates

      So that means if I run upgrades and forget to re-enroll I’ll get a broken system that I won’t be able to boot to and fix it?

      • spiffeeroo@programming.dev
        link
        fedilink
        English
        arrow-up
        2
        ·
        edit-2
        1 year ago

        That just means the TPM will not auto unlock the encrypted disk. You would have to unlock with whatever LUKS password (or key file) you set for that drive. There is optionally a TPM master key you can export that is similar to the Microsoft Bitlocker password (40 digit number iirc), that Lennart mentioned in his blog. If you deleted any other key slots and do not have that TPM master key, you will not be able to unlock the LUKS drive.

        If you look at that freedesktop manpage I linked, it states some of the PCR values and what each one measures. When you enroll a PCR, that value is stored in the TPM. If anything differs between the system and the TPM, the TPM will refuse to unlock that encrypted drive.

        For example, PCR 0 measures your motherboard UEFI firmware. If you update the firmware, the TPM will not unlock your LUKS drive until you re-enroll the drive once again. Is is a personal choice, but enrolling certain PCR into the TPM can be more inconvenient.

  • gobbling871@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    arrow-down
    1
    ·
    edit-2
    1 year ago

    While I don’t know how well your hardware can work with secure boot, this is a good guide to get started on Arch. https://swsnr.de/2022/01/06/install-arch-with-secure-boot-tpm2-based-luks-encryption-and-systemd-homed.html Don’t know how well Debian supports any of the mentioned tools but you probably shouldn’t be going with Debian’s implementation of secure boot as it uses Microsoft’s keys.

    I use TPM pcrs 0,1 and 7 with no issues across reboots and zero prompts to unlock LUKS as dracut resigns my kernel images on every update.

    • TCB13@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      From what I can understand Debian uses a generic shim that is signed with Microsoft’s keys and then it delegates the rest to the system. Apparently this is a fast way to get secure boot to work but “SHIM only checks signatures of the boot loader and kernel, but not the GRUB config file or initramfs, which opens your machine to attacks”. This is why I was looking for a more detailed guide from someone who actually understands this from start to end.

      • gobbling871@lemmy.world
        link
        fedilink
        English
        arrow-up
        1
        arrow-down
        1
        ·
        edit-2
        1 year ago

        fast way to get secure boot to work

        vs best use of secure boot. Your pick.

        Your GRUB can be encrypted behind FDE and iirc there is also an option to create a password for grub. So far I haven’t seen cases of bootloaders being compromised/bypassed so we are not there yet.

        Pretty sure there’s not a lack of guides for setting up secure boot on Ubuntu/Debian, unless you are looking for something specific.

        • TCB13@lemmy.worldOP
          link
          fedilink
          English
          arrow-up
          1
          ·
          1 year ago

          Yes, there are but they mostly assume the use of the SHIM. That was the reason why I posted this.