Filesystem encryption is an important security element of the overall physical security of a computer. Even in this day and age, multiuser systems and distributed environments hash only user's passwords. Everything else is either locally visible from the root account or sits unencrypted on a remote fileserver and in plain view of all administrators in the organization. The Linux filesystem encryption state of affairs has long been in limbo. A number of hacks were available to provide some encryption capabilities, but most of the time they were incompatible from platform to platform and even between Linux distributions. They also suffered from terrible performance, making it painful to use on production systems. Among the legacy Linux encryption systems are the loopbackfs device (also known as crypto-loop), the userspace encfs, cryptofs based on the Fuse filesystem, and truecrypt.
Included with Linux kernel 2.6 came a new infrastructure called the device-mapper, which provides users with the ability to create virtual layers of block devices. Among the applications built on top of this new kernel facility is the well-known Logical Volume Manager 2 (LVM2), which provides striping, mirroring, concatenation, and snapshotting of partitions. One of the latest device-mapper-based applications is dm-crypt. This new target provides transparent encryption/decryption using the new kernel 2.6 cryptoapi. The most difficult part in using dm-crypt is the partition's creation. To make it easier on end users, cryptsetup, a utility assisting in the creation of encrypted filesystems, was developed. The initial version of this tool did not include key management, making it problematic to support multiple user passwords and hard to move encrypted filesystems as atomic entities (because the master key was not included in the partition). Linux Unified Key Setup (LUKS) specifically addresses this issue. In effect, LUKS is an extension to the TKS1 standard and specifies the format of a partition header that includes all relevant information necessary to set up an encrypted partition, including:
Cipher
Keysize
Key slots, hosting multiple encrypted versions of the master key. This allows many users to decrypt the master key with their own passwords.
As previously mentioned, another advantage of LUKS over other crypto filesystems is portability. Indeed, it is possible to create a LUKS filesystem on Linux that Windows users can access using the FreeOTFE driver. You just need to select a partition that both systems understand, such as FAT, VFAT, or EXT3 (supported through the EXT2IFS Windows driver).
Here are quick step-by-step instructions to create a LUKS partition on Fedora Rawhide 2006:
Insert USB drive.
Manually Initialize the LUKS partition:
[emoret@simca-1000 ˜]$sudo cryptsetup --verify-passphrase
--cipher aes-cbc-essiv:sha256 create Enigma /dev/sdb
Enter passphrase: Verify passphrase:
Alternatively, you could use the gnome-luks-format tool, as shown in. Beware that this gnome utility currently does not allow the use of Encrypted Sector Salt Initial Value (ESSIV). Without salt, an encrypted partition is subject to brute force attacks!
In case you manually initialized LUKS, you need to create a filesystem on the encrypted partition:
[emoret@simca-1000 ˜]$ sudo mkfs -t ext3 /dev/mapper/Enigma
You can now mount your newly created LUKS partition with the following:
[emoret@simca-1000 ˜]$ sudo mount /dev/mapper/Enigma /mnt
dm-crypt is the up and coming standard to Linux end user filesystem encryption—but why should older schemes be dismissed?
cryptoloop is mainly outdated because it lacks salt in the encryption of data blocks. This can lead to brute force and watermark attacks.
loop-AES, on the other hand, uses salt in the same way as dm-crypt's ESSIV (Encrypted Sector Salt Initial Value). The problem with loop-AES is that it is currently not part of the mainline Linux kernel, thus custom kernel module, mount, and losetup are required. Because I like my system to be up to date with the latest packages, it is just too much of a hassle having to rebuild the patch set and replace the userspace utilities every time an upstream update is done by my upstream distribution on any of those packages.