Disk encryption

From ArchWiki
Revision as of 20:12, 18 June 2012 by Sas (Talk | contribs) (Why use encryption?)

Jump to: navigation, search

Template:Moveto

Tango-document-new.pngThis article is a stub.Tango-document-new.png

Notes: please merge here the generic parts of the related articles on system encryption. (Discuss in Talk:Disk encryption#)
Template:Article summary start

Template:Article summary text Template:Article summary heading Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary end

This article discusses common techniques available in Arch Linux for transparently encrypting / decrypting all data that is written to / read from a disk, or a logical part of a disk.

Why use encryption?

Disk encryption makes sure that (all or some of) your files are always stored on disk in encrypted form, and only "magically" become available to the operating system and applications in readable form while the system is running and unlocked by you (or someone you trust). Anyone who tries to boot your hardware with a live CD or USB stick without your consent, will only see garbled random-looking data on the protected parts of your disk instead of your actual files.

This can, for example, prevent unauthorized persons from viewing your data (documents / emails / locally store passwords / ...) when your computer or hard-disk is...

  • lost (in case of laptops/netbooks or external hard drives)
  • stolen
  • in the repair shop
  • located in a place (e.g. office / living room) to which non-trusted people might gain access while you're away (but see warning below)
  • discarded after its end-of-life
  • ...
Warning: Disk encryption does not protect you against:
  • Attackers who can break into your system (e.g. over the Internet) while it is running, after you've already unlocked and mounted the encrypted parts of your hard drive.
  • Attackers who are able to gain physical access to the computer while (or very shortly after) it is running, and have the resources to perform a Cold boot attack.
  • Attackers who are able to gain physical access to the computer before you use it, and have the resources to e.g. install a hidden key logger or Trojan horse in a non-encrypted part of the disk, like the boot partition.
    (Encrypting the whole system disk and keeping the boot partition on an external USB stick that you carry around with yourself can add more security in that regard, but the only true remidy would be something like hardware-supported Trusted Computing.)
  • The government.
    In addition to having the resources to easily pull off the above attacks, governments may simply force you to give up your keys/passphrases using various techniques of coercion. In most non-democratic countries around the world as well as in the USA and UK, it is legal for law enforcement agencies to do so if they have suspicions that you might be hiding something of interest.

Data encryption vs system encryption

Disk encryption can serve as a means for both data encryption, and (partial or full) system encryption.

Data encryption, defined as encrypting only the user's data itself (often located within the /home directory), can already provide a certain level of security, but has some significant drawbacks. In modern computing systems, there are many background processes that may (temporarily) store information about encrypted data or parts of the encrypted data itself in non-encrypted areas of the hard drive, thus reducing the effectiveness of any data encryption system in place. Depending on the type of data and applications used, it might be possible to avoid/circumvent all cases where this is happening, but it takes extra diligence on the side of the user.

Places outside of the home directory where fragments of user data might end up, include (but are not limited to):

  • swap partitions
    • (potential remedy: disable swapping)
  • /tmp (temporary files created by user applications)
    • (potential remedies: avoid such applications; mount /tmp inside a ramdisk)
  • /var (log files and such; for example, mlocate stores an index of all file names in /var/lib/mlocate/mlocate.db)

In addition, mere data encryption will leave the system vulnerable to system tampering attacks like keyloggers (see warning above).


System encryption, defined as the encryption of (part of) the operating system and user data, helps to address some of the inadequacies of data encryption. The benefits of system encryption over data encryption alone include:

  • Preventing unauthorized physical access to operating system files
  • Preventing unauthorized physical access to private data that may cached by the system.

Despite the use of system encryption, there are still points of physical insecurity (see warning above). However, it is presently the best way to minimize the loss of data privacy by physical attempts at invasion.

From a usability perspective, a potential disadvantage of full system encryption over mere data encryption is that unlocking/locking of encrypted parts of the disk can no longer coincide with user login/logout (sharing the same password), because now the unlocking already needs to happen before or during boot.


In practice, there not always a clear line between data encryption and system encryption, and many different compromises and customized setups are possible.

In any case, disk encryption should only be viewed as an adjunct to the existing security mechanisms of the operating system - focused on securing offline physical access, while relying on other parts of the system to provide things like network security and user-based access control.

System encryption methods

Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

Reason: introduce the available methods for system ecnryption. (Discuss in Talk:Disk encryption#)

Comparison table

summary
Loop-AES dm-crypt + LUKS Truecrypt eCryptfs EncFs

type

block device encryption stacked filesystem encryption

main selling points

longest-exiting one; possibly the fastest; works on legacy systems de-facto standard for block device encryption on Linux; very flexible very portable, well-polished, self-contained solution slightly faster than EncFS; individual encrypted files portable between systems easiest one to use; supports non-root administration

availability in Arch Linux

must manually compile custom kernel kernel modules: already shipped with default kernel; tools: device-mapper, cryptsetup [core] truecrypt [extra] kernel module: already shipped with default kernel; tools: ecryptfs-utilsAUR [AUR] encfs [community]

license

GPL GPL custom[1] GPL GPL
basic classification
Loop-AES dm-crypt + LUKS Truecrypt eCryptfs EncFs

encrypts...

whole block device files

container for encrypted data may be...

  • a disk partition
  • a file acting as a virtual partition
  • a directory in an existing file system

relation to filesystem

operates below the filesystem layer - doesn't care whether the content of the encrypted block device is a filesystem, a partition table, a LVM setup, or anything else adds an additional layer to an existing filesystem, to automatically encrypt/decrypt files whenever they're written/read

encryption implemented in...

kernelspace kernelspace kernelspace kernelspace userspace
(using FUSE)

cryptographic metadata stored in...

 ?  ?  ? header of each encrypted file control file at the top level of each EncFs container

wrapped encryption key stored in...

 ?  ?  ? key file that can be stored anywhere control file at the top level of each EncFs container
practical implications
Loop-AES dm-crypt + LUKS Truecrypt eCryptfs EncFs

file metadata (number of files, dir structure, file sizes, permissions, mtimes, etc.) is encrypted


(file and dir names can be encrypted though)

can be used to encrypt whole hard drives (including partition tables)

can be used to encrypt swap space

no need to allocate a fixed amount of space in advance for the encrypted data container

can be used to protect existing filesystems without block device access, e.g. NFS or Samba shares, cloud storage, etc.

    [2]

allows offline file-based backups of encrypted files

usability features
Loop-AES dm-crypt + LUKS Truecrypt eCryptfs EncFs

support for automounting on login

 ?  ?  ?  ?

support for automatic unmounting in case of inactivity

 ?  ?  ?  ?

non-root users can create/destroy containers for encrypted data

provides a GUI

security features
Loop-AES dm-crypt + LUKS Truecrypt eCryptfs EncFs

supported ciphers

AES  ?  ? AES, blowfish, twofish...  ?

support for salting

 ?
(with LUKS)
 ?

support for chaining multiple ciphers

 ?  ?  ?  ?

support for key-slot diffusion

 ?
(with LUKS)
 ?  ?  ?

protection against key scrubbing

 ?  ?  ?  ?

support for multiple (independently revokable) keys for the same encrypted data

 ?
(with LUKS)
 ?  ?  ?
performance features
Loop-AES dm-crypt + LUKS Truecrypt eCryptfs EncFs

multithreading support

 ?  ?  ?

hardware-accelerated encryption support

 ?  ?  ?

optimised handling of sparse files

 ?  ?  ?  ?
block device encryption specific
Loop-AES dm-crypt + LUKS Truecrypt

support for (manually) resizing the encrypted block device in-place

 ?
stacked filesystem encryption specific
eCryptfs EncFs

supported file systems

ext3, ext4, xfs (with caveats), jfs, nfs...  ?

ability to encrypt filenames

ability to not encrypt filenames

compatibility & prevalence
Loop-AES dm-crypt + LUKS Truecrypt eCryptfs EncFs

supported Linux kernel versions

2.0 or newer  ?  ?  ? 2.4 or newer
encrypted data can also be accessed from... Windows (with [3]) (with [4])  ?  ?
Mac OS X  ?  ?  ?     [5]
FreeBSD  ?  ?  ?     [6]

used by

 ?
  • Arch Linux installer (system encryption)
  • Ubuntu alternate installer (system encryption)
 ?
  • Ubuntu installer (home dir encryption)
  • Chromium OS (encryption of cached user data[7])
 ?

Notes & References

  1. ^ see http://www.truecrypt.org/legal/license
  2. ^ well, a single file in those filesystems could be used as a container (virtual loop-back device!) but then one wouldn't actually be using the filesystem (and the features it provides) anymore
  3. ^ CrossCrypt - Open Source AES and TwoFish Linux compatible on the fly encryption for Windows XP and Windows 2000
  4. ^ FreeOTFE - supports Windows 2000 and later (for PC), and Windows Mobile 2003 and later (for PDA)
  5. ^ see EncFs build instructions for Mac
  6. ^ see http://www.freshports.org/sysutils/fusefs-encfs/
  7. ^ see http://www.chromium.org/chromium-os/chromiumos-design-docs/protecting-cached-user-data