Author Topic: Petite boot and encrypting /boot  (Read 1248 times)

Borley

  • Full Member
  • ***
  • Posts: 133
  • Karma: +10/-0
    • View Profile
Petite boot and encrypting /boot
« on: July 04, 2020, 04:45:14 pm »
Can Petite boot work with an encrypted /boot directory? I have seen several methods for setting this up but it looks like they go through GRUB. I may not understand this correctly, but doesn't Petite boot stand in for GRUB, when using Raptor systems?
Blackbird C1P9S01, CPU 02CY650, 2x 8GB 2666 RAM, 1024GB M.2 SSD, AMD RX 560X, 2U heatsink, 500W SFX PSU, Debian 11

Skirmisher

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Petite boot and encrypting /boot
« Reply #1 on: August 14, 2020, 12:46:26 pm »
Nominally, yes: petitboot can detect LUKS volumes and will prompt the user to unlock them with a password if selected. It then reads the GRUB (or other bootloader) configs stored on the encrypted volume the same as the unencrypted ones, executing the entries itself instead of starting another bootloader. Note that once booted, the host OS still needs to unlock the volume itself (petitboot `kexec`s the installed kernel, so nothing is preserved). Existing FDE guides cover how to include a keyfile in the initrd, to avoid having to input the password a second time.

However, as it stands, none of the Raptor firmware images include the necessary support for unlocking encrypted devices. I believe some of them may include the `cryptsetup` binary, but (I think) there are still missing kernel modules that provide the necessary crypto algorithms. Unfortunately, even upstream op-build doesn't have a functioning config for this either, and no one has done the work to figure out what changes need to be made, as far as I know. I would love to see this working one day, though!

Corvidae

  • Newbie
  • *
  • Posts: 12
  • Karma: +2/-0
    • View Profile
Re: Petite boot and encrypting /boot
« Reply #2 on: September 06, 2022, 09:18:01 pm »
I know this thread is a bit old, but I figured I'd share how I managed to get cryptsetup working properly in petitboot. It does require custom firmware right now, though.

First, the firmware kernel is missing modules needed for decrypting LUKS volumes. Attached is a patch to add all of the possible cryptography configurations needed to the kernel config, based on blackbird-op-build. If you know the algorithms used for your specific setup, you can trim down some of the algorithms you don't need. You can also run "cryptsetup benchmark" in petitboot to test things - if it says "N/A" instead of a number, it's not working.

Also, I'm not sure if this is true or not, but the cryptsetup version shipped in the current firmware might not support LUKS2 headers - the output of the newer versions mention LUKS2 while the firmware version doesn't. I ended up updating that to the latest version as I thought that might have been the problem before I investigated the kernel config. Another patch is attached for that. There is also a change to point the lvm2 sources to sourceware.org instead of sources.redhat.com, as the latter seems to be down (?). If that's not the case, feel free to remove that as well.

I am a complete novice at using patches for git, so please let me know if I messed something up.

ClassicHasClass

  • Sr. Member
  • ****
  • Posts: 353
  • Karma: +27/-0
  • Talospace Earth Orbit
    • View Profile
    • Floodgap
Re: Petite boot and encrypting /boot
« Reply #3 on: September 07, 2022, 10:45:52 pm »
Nice work.