I want to use a swap drive that is encrypted by a random key on boot. I'm not sure if I am doing it safely, though.
I currently have /etc/crypttab based off of the example on arch wiki. Unlike their article, I got my swap's UUID from mkswap. It wouldn't allow me to put my swap in the unallocated space past a 1MB ext2 partition, as was shown in the arch wiki example. I'm a bit wary of the arch wiki example because of this.
My current crypttab is:
cryptswap UUID=... /dev/urandom swap,cipher=aes-cbc-essiv:sha256,size=256,offset=2048
Is this the proper way to set up an encrypted swap? I'm not sure how offset behaves if it tries to write to the last 1MB of the drive.
Probably worth noting that I'm doing all of this in a VM to test, before doing this on my hardware.
update:
this is the error message that shows up when I try to use an ext2 formatted drive, doing it exactly as shown in the arch tutorial:
sudo /etc/init.d/cryptdisks reload
[ ok ] Stopping remaining crypto disks...cryptswap (stopped)...done.
[....] Starting remaining crypto disks...[info] cryptswap (starting)...
[....] cryptswap: the precheck for '/dev/disk/by-label/cryptswap' failed: - The [warne /dev/disk/by-label/cryptswap contains a filesystem type ext2. ... (warning).
[FAILswap (failed)...failed.
precheck
, this probably doesn't exist in ArchLinux; updated my answer. – frostschutz Mar 20 '16 at 18:41