Of backups, re-installs and encrypted disks (tummy.com, ltd. Journal Entry)
tummy.com: we do linux

Sunday November 11, 2007 at 13:50
Subject: Of backups, re-installs and encrypted disks
Keywords: Fedora Linux Tech Encrypted-root F8
Posted by: Kevin Fenzi

Related entries:
   Setting Up Encrypted root Partition on Fedora 7. by Sean Reifschneider, Sunday August 26, 2007 at 01:37
   Recipe for setting up Encrypted root+swap on Fedora 8. by Sean Reifschneider, Saturday November 24, 2007 at 15:37

Last Thursday several big events occurred:

  • Fedora 8 - Werewolf was released on the world. This was a pretty smooth and good release cycle I think. If you haven't tried a Fedora release in a while, this would be one to check out.
  • My laptop drive started having uncorrectable read errors, which made it less than happy running. It would hit one of those sectors, and then go into a infinite loop of resets and drive access.

Clearly this was a sign that I should do a fresh F8 install on a new drive, and also try out Sean's root encryption HOWTO. Read on for more information about encrypted root filesystem installs.

Sean wrote up a HOWTO a while back on making your install run totally from an encrypted drive. See the HOWTO here. I've been running with an encrypted /home for a while, but it's nice to just have everything encrypted so there is no information leakage from /home to the rest of the unencrypted disk.

The above HOWTO worked pretty nicely with F8, although I did things slightly differently. The new drive (200GB) was partitioned like so:

  • /boot (unencrypted because you need to read initrd from it) - 250MB
  • / (unencrypted at first because you need to do a F8 install to it) - 5GB.
  • the rest of the drive unallocated - 195GB.

Next, do a regular install to the 5GB partition. Boot up on it, and modify the files as mentioned in the link above and create the crypted partition that will become the encrypted root. Then, reboot with 'init=/bin/sh' and copy the 5GB / over to the crypted partition. Make a new initrd and reboot to the crypted kernel entry. Everything came up nicely.

Finally, I setup the old 5GB partition I made for installing to be a encrypted swap partition. Simply add to /etc/crypttab: "cryptswap /dev/sda2 /dev/urandom swap,cipher=aes-cbc-essiv:sha256", and then add to your /etc/fstab: "/dev/mapper/cryptswap swap swap defaults 0 0" Which will give you a encrypted swap that gets a new random key on each boot.

Everything seems to be running along fine with the encrypted / after this setup. I am sure hoping there will be some progress in the Fedora 9 cycle to make anaconda able to create encrypted / partitions. There is a feature page for this feature, but it doesn't seem to have gotten much progress of late: http://fedoraproject.org/wiki/Releases/FeatureEncryptedFilesystems. I would even think that we should make Encrypted / the default at least on laptop type systems. The solution above works, but most people aren't going to go through the pain of setting it up.

There is also another nice HOWTO attached to a bug about encrypted / support: (See bug 124789)

Congrats to everyone on Fedora 8's release, and lets hope we can make progress on encrypted root filesystems for Fedora 9!


(Post Reply)
Comment
anon
Subject: Fedora encrypted disks
The aforementioned bug 124789 has a recently consolidated patch to support both encrypted PVs (as you've done) and encrypted LVs. It's worth explicitly noting that an encrypted PV allows suspend and resume from a swap LV in the PV, while still only requiring one passphrase to unlock the whole system; the current Fedora encrypted swap partition is randomised on boot which borks suspend.

You can also use LVM tools - pvmove - to transfer the system from the unencrypted partition to the encrypted PV, as described in this HOWTO (this may have been the HOWTO you reference, though there are a couple attached to the bug).

I too am surprised this isn't being pushed as an install option, especially for laptops. There seems to be quite some resistance to including this feature in Fedora.