ArticleslgStudy

computer science

Linux Unified Key Setup

Linux Unified Key Setup is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Linux Unified Key Setup rather than just read about it. In short: The Linux Unified Key Setup (LUKS) is a disk encryption specification created by Clemens Fruhwirth in 2004 and originally intended for Linux. LUKS implements a platform-independent standard on-disk format for use in various tools.

Linux Unified Key Setup — main illustration
Linux Unified Key Setup — illustration

Key takeaways

  • Linux Unified Key Setup belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Linux Unified Key Setup to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Linux Unified Key Setup from memory before moving on to harder problems.

Reference excerpt

The Linux Unified Key Setup (LUKS) is a disk encryption specification created by Clemens Fruhwirth in 2004 and originally intended for Linux. LUKS implements a platform-independent standard on-disk format for use in various tools. This facilitates compatibility and interoperability among different programs and operating systems, and assures that they all implement password management in a secure and documented manner.

Description LUKS is used to encrypt a block device. The contents of the encrypted device are arbitrary, and therefore any filesystem can be encrypted, including swap partitions. There is an unencrypted header at the beginning of an encrypted volume, which allows up to 8 (LUKS1) or 32 (LUKS2) encryption keys to be stored along with encryption parameters such as cipher type and key size. The presence of this header is a major difference between LUKS and dm-crypt, since the header allows multiple different passphrases to be used, with the ability to change and remove them. If the header is lost or corrupted, the device will no longer be decryptable. Encryption is done with a multi-layer approach. First, the block device is encrypted using a master key. This master key is encrypted with each active user key. User keys are derived from passphrases, FIDO2 security keys, TPMs or smart cards. The multi-layer approach allows users to change their passphrase without re-encrypting the whole block device. Key slots can contain information to verify user passphrases or other types of keys. There are two versions of LUKS, with LUKS2 featuring resilience to header corruption, and using the Argon2 key derivation function by default, whereas LUKS1 uses PBKDF2. Conversion between both versions of LUKS is possible in certain situations, but some features may not be available with LUKS1 such as Argon2. LUKS2 uses JSON as a metadata format. Available cryptographic algorithms depend on individual kernel support of the host. Libgcrypt can be used as a backend for hashing, which supports all of its algorithms. It is up to the operating system vendor to choose the default algorithm. LUKS1 makes use of an anti-forensics technique called AFsplitter, allowing for secure data erasure and protection.

LUKS with LVM Logical Volume Management can be used alongside LUKS.

LVM on LUKS When LVM is used on an unlocked LUKS container, all underlying partitions (which are LVM logical volumes) can be encrypted with a single key. This is akin to splitting a LUKS container into multiple partitions. The LVM structure is not visible until the disk is decrypted. LUKS on LVM When LUKS is used to encrypt LVM logical volumes, an encrypted volume can span multiple devices. The underlying LVM volume group is visible without decrypting the encrypted volumes.

Full disk encryption

A common usage of LUKS is to provide full disk encryption, which involves encrypting the root partition of an operating system installation, which protects the operating system files from being tampered with or read by unauthorized parties. On a Linux system, the boot partition (/boot) may be encrypted if the bootloader itself supports LUKS (e.g. GRUB). This is undertaken to prevent tampering with the Linux kernel. However, the first stage bootloader or an EFI system partition cannot be encrypted (see Full disk encryption#The boot key problem). On mobile Linux systems, postmarketOS has developed osk-sdl to allow a full disk encrypted system to be unlocked using a touch screen. For systems running systemd, the systemd-homed component can be used to encrypt individual home directories.

Operating system support The reference implementation for LUKS operates on Linux and is based on an enhanced version of cryptsetup, using dm-crypt as the disk encryption backend. Under Microsoft Windows, LUKS-encrypted disks can be used via the Windows Subsystem for Linux. (Formerly, this was possible with LibreCrypt, which currently has fundamental security holes, and which succeeded FreeOTFE, formerly DoxBox.) DragonFly BSD supports LUKS. On macOS, anylinuxfs provides access to LUKS-formatted disks, as well as other formats.

Installer support Several Linux distributions allow the root device to be encrypted upon OS installation. These installers include Calamares, Ubiquity, Debian-Installer, and more.

On-disk format LUKS headers are backward compatible; newer versions of LUKS are able to read headers of previous versions.

LUKS1

LUKS2 The LUKS2 header has a binary area and a JSON area, a second binary and JSON area, and a keyslots area. The binary and JSON areas are repeated two times with minor variations.

Binary area The size of the binary areas is always 4kiB. The size of binary plus JSON area can be a power-of-two number of bytes between 16 kiB and 4 MiB, making the size of the JSON areas between 12 kiB and 4092 kiB each.

JSON area The base LUKS2 JSON metadata object has 5 keys: config, keyslots, digests, segments, and tokens. Config contains general settings and information of the LUKS header, and persistent mount options. Segments describe areas on the disk than contain data and can be decrypted. They also describe the algorithm with which a segment is encrypted. Digests describe what keyslots contain encrypted keys able to decrypt which segments. They contain a hash of the decrypted key of the keyslot that functions as a checksum and to verify correctness of the password. Keyslots contain encrypted keys. The method of encryption varies, a combination of passwords, keyfiles, hardware keys, and other methods can be uses to decrypt the contained master-keys. The tokens object can hold additional for external systems integrating with LUKS. Userdata, segments, are encrypted with a large master-key and an efficient encryption algorithm. The master key can then be encrypted with a more expensive algorithm and potentially weaker user-provided keys, these encrypted master-keys are then stored in Keyslots. This slows brute-force attempts at guessing the password, and also allows changing decryption methods and passwords without having to reencrypt the entire data section, by only needing to rewrite the same master-key encrypted differently into the keyslots. A typical LUKS2 JSON area, with added indentation and line-breaks:

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Linux Unified Key Setup

Start with the simplest possible case. Write down what Linux Unified Key Setup claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Linux Unified Key Setup before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Linux Unified Key Setup ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Linux Unified Key Setup

In research
Linux Unified Key Setup appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Linux Unified Key Setup in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Linux Unified Key Setup is common in secondary-school and first-year university syllabi. It links to neighbouring topics Cryptographic software, Disk encryption, Linux security software, so understanding it makes those chapters shorter.
In everyday life
Look for Linux Unified Key Setup outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Linux Unified Key Setup in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Linux Unified Key Setup means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Linux Unified Key Setup out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Linux Unified Key Setup in simple terms?

The Linux Unified Key Setup (LUKS) is a disk encryption specification created by Clemens Fruhwirth in 2004 and originally intended for Linux. LUKS implements a platform-independent standard on-disk format for use in various tools.

Why does Linux Unified Key Setup matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Linux Unified Key Setup?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Linux Unified Key Setup.

Tags

  • Cryptographic software
  • Disk encryption
  • Linux security software

Keep exploring