3 ms·
The usual reason for a lot of those boil down to "poor driver support", but this is the same hardware with what I would presume is the same Linux kernel so same
by yjftsjthsd-h 4y ago
The usual reason for a lot of those boil down to "poor driver support", but this is the same hardware with what I would presume is the same Linux kernel so same drivers, so what's the difference?
- duped 4y agoThe usual reason is that you can't enable hibernate with disk encryption
- cbsmith 4y agoIt tends to specifically be an issue with encrypted swap, because encrypted swap uses a random ephemeral encryption key. Honestly, I think in a lot of cases it makes sense to simply There are solutions for this: https://help.ubuntu.com/community/EnableHibernateWithEncryptedSwap https://help.ubuntu.com/community/EnableHibernateWithEncrypt... I think the real challenge here is for distro vendors to figure out how to provide a better user experience around this. There's no reason that the ephemeral key can't be stored in a sealed state that can be recovered as the machine wakes. There are obviously some security implications to this, but I think it's fair to say that a lot of users would prefer making that trade-off.
- r2binx 4y agoWhy use another encrypted partition instead of putting a swap partition/file on the same with LVM/btrfs?
- cbsmith 4y agoThere's a lot of security models that rely on RAM being more difficult for an attacker to access than disk (as you can imagine it is much easier to ensure things stored to disk are resistant to compromise than to ensure that nothing in working memory is usable by an attacker). Swap is that in between case where storage is memory, so that creates a unique challenge. What you want is that if someone steals your hibernated laptop, that absent a way to securely authenticate themselves as you, they can't restore the working memory of your laptop. If you think about it, if they could, much of the point of many security precautions would be lost.
- saltcured 4y agoI think you may have missed what was being asked? I think they assume that an LVM PV is encrypted and could contain the block filesystem and swap volumes as LVs. There is already a boot-time process to unlock such an LVM setup. Why should the swap require a separate encryption key? As a Fedora user, this is how my disks have been setup for many years, and I don't understand why Fedora have disabled hibernation. During wake from hibernation, the kernel and boot ramdisk would need user input to unlock the PV and to decode the LVs. Then, the hibernation state would be visible at the same time as the other filesystem state, and the kernel could decide whether to load the hibernation image or continue a normal boot sequence. This seems to provide the protection of content needed for theft of a hibernated machine. I don't know whether there is some unhappy sequencing flaw in the dracut-generated ramdisk (between when the wake-versus-boot decision has to be made and the LVM decryption is done), or, whether someone at Fedora has decided that the threat model is different than we discuss above?
- cbsmith 4y ago> I think they assume that an LVM PV is encrypted and could contain the block filesystem and swap volumes as LVs. There is already a boot-time process to unlock such an LVM setup. Why should the swap require a separate encryption key? Again, the reason why it's different is the security model for memory is different from the filesystem. This is exactly what I was getting at: the fixed key. Encrypted swap volumes typically are set up to use ephemeral keys that are "forgotten" when you power down. The idea is that you only have access to that memory while the computer is running. When you boot up again, whatever data is in the swap partition is just noise. As mentioned in the link I provided (https://help.ubuntu.com/community/EnableHibernateWithEncryptedSwap https://help.ubuntu.com/community/EnableHibernateWithEncrypt...), the current solution is to switch to using a fixed key, much as you described. That fundamentally changes the security model, and not in a subtle way. I think there's a solution that more closely approximates the security model, with only a minor compromise: when you boot up, you generate an ephemeral key in the secure enclave, and use that to encrypt your swap. When you hibernate, the secure enclave encrypts all the metadata (including the ephemeral key) into a sealed state that is stored on disk with the swap information. When you restore, the sealed data is read back into the secure enclave (and erased) and it can then decrypt swap as needed. This still means the hibernated memory state is fully recoverable by whomever is able to authenticate with the enclave, but that's what everyone wants. On the upside, if you shut down the machine (rather than hibernate), the ephemeral key is lost, so there's no way anyone can recover what's on your swap, even if they have access to whatever fixed key(s) you have used for your LVM volumes. If you're really paranoid, you could even generate a new ephemeral key on restore and reencrypt the entire swap volume with the new ephemeral key, though I'd question what realistic threat model that would really address.
- r2binx 4y agoYou definitely can. Actually relatively simple if you know your way around Linux. This is a good guide for Arch [1]. I think there's a couple more steps on Fedora or if you're using zram in general but it's definitely doable. I've even got it working with secure boot using my own keys. [1]: https://gist.github.com/RobFisher/abd9b2b9fca4194ac8df112715045b61 https://gist.github.com/RobFisher/abd9b2b9fca4194ac8df112715...
- kxyvr 4y agoI just went through this process with Gentoo on a framework laptop. Here are some random, likely incomplete notes to make this work. It uses a swap file on an encrypted filesystem 1. Create a swap file. Our rule of thumb is ram + sqrt(ram) for hibernate fallocate -l 72GiB swapfile chmod 600 swapfile mkswap swapfile swapon swapfile swapon --show 2. emerge suspend 3. Get the number to use with resume_offset later. In the current case, it was 125798400 swap-offset /swapfile emerge sys-boot/grub grub-install --target=x86_64-efi --efi-directory=/boot vim /boot/grub/grub.cfg timeout=5 menuentry 'Gentoo Linux 5.18.19' { root=hd0,1 insmod all_video linux /kernel-5.18.19 root=/dev/mapper/root resume=/dev/mapper/root resume_offset=125798400 } 4. Fix suspend.conf vim /etc/suspend.conf resume device = /dev/mapper/root resume offset = 125798400 5. Setup an initramfs cd /usr/src mkdir initramfs cd initramfs mkdir -p bin dev etc proc sys new-root cp -a /dev/{null,console,tty} /usr/src/initramfs/dev/ cp -a /bin/busybox ./bin cd bin for i in `./busybox --list` do ln -s ./busybox $i done cd .. cp -a /sbin/cryptsetup ./bin mkdir -p ./run/cryptsetup lddtree -l /sbin/cryptsetup Copy in all of those files until the local cryptsetup works appropriately vim init #!/bin/sh # Define a rescue shell rescue_shell() { echo "Error in boot process, dropping to a shell" exec /bin/sh }· # Mount our devices. We sleep prior to dev to hopefully finish loading. mount -t proc none /proc mount -t sysfs none /sys sleep 2 && mount -t devtmpfs none /dev # Decrypt the root partition cryptsetup --allow-discards luksOpen /dev/nvme0n1p2 root || rescue_shell # Attempt to resume printf '%u:%u\n' $(stat -L -c '0x%t 0x%T' /dev/mapper/root) > /sys/power/resume # If we're not resuming, mount the new root mount -o noatime,discard -t ext4 /dev/mapper/root /new-root # Unmount (cleanup) our devices umount /proc umount /sys umount /dev # Boot from the unencrypted partition exec switch_root /new-root /sbin/init 6. Suspend should be working with: echo shutdown > /sys/power/disk echo disk > /sys/power/state or preferably loginctl hibernate Anyway, there's a lot of missing detail in there, but the idea is that there's a swapfile inside the normal encrypted root partition. For me, I've enough ram where I don't really use swap unless hibernating, so a swapfile versus a separate encrypted swap partition suffices.