Thursday, 3 April 2008

Encrypting RAID0 swap

In my previous blog post I've talked about how to setup encrypted system though i skipped the part on how to encrypt swap. So here it is now.

As you remember we left /dev/md1 reserved for swap now it's time to use it:
sudo cryptsetup create swap /dev/md1
and add this line to your /etc/crypttab
swap        /dev/md1    /dev/urandom swap
since i don't want to enter pass phrase for swap partition I'm going to use new key on each boot. Setting key file to /dev/urandom does exactly that. That's it now reboot your system or simply
swapon -a
sudo swapon /dev/mapper/swap

Cheers!