Clevis

clevis allows binding a LUKS volume to a system by creating a key and encrypting it using the TPM, and sealing the key using PCR values which represent the system state at the time of the Clevis pin creation.

Passwords manually entered by a user is a traditional and widely used way to unlock encrypted LUKS partitions. But it has a few disadvantages:

  • It requires manual intervention and thus does not work with setups that require automatic boot (e.g. a large server farm).
  • An average human brain is capable of remembering relatively simple passwords (~20-30 bits of entropy) that are much weaker than keys used for modern block ciphers (128/256 bits).

A solution for it would be encrypting data with a strong key stored securely somewhere else, for example at your TPM chip or YubiKey or some network service. Clevis is a framework that implements this idea. It allows to encrypt (in terms of clevis bind) data with a pluggable pin. Currently clevis implements 3 pins:

Warning: If you use this method on your root volume, this means that, as long as the previously mentioned certain conditions are met, your computer will unlock automatically at boot without needing to enter an encryption password.
  • This means that access to data is not protected in case the hardware gets stolen.
  • Be aware that this method makes you more vulnerable to cold boot attacks, because even if your computer has been powered off for a long time (ensuring the memory is completely cleared), an attacker could simply turn it on and wait for the TPM to load the key automatically. This may be a concern for high-value targets.

Installation

To use clevis install package.

Bind some data

Here is an example of data binding with TPM2:

This long base64-encoded message is our text encrypted with an internal TPM key. It can be decrypted at the current computer only. Trying to decrypt it from another computer (or rather with another TPM chip) will return an error.

Bind a LUKS volume

To bind a LUKS volume to the TPM, use:

# clevis luks bind -d /dev/sdX tpm2 '{}'

where '{}' contains the configuration: even with no parameters the drive cannot be decrypted from another computer, unless the attacker knows the backup password.

To generate a new Clevis pin after changes in system configuration that result in different PCR values, for example updating the UEFI when PCR 0 is used, run

to find the slot used for the Clevis pin, then

# clevis luks regen -d /dev/sdX -s keyslot

To remove the Clevis binding, run:

# clevis luks unbind -d /dev/sdX -s keyslot 
Warning: Double check you have chosen the right slot, or you might lose access to your volume.

You can unlock a TPM-bound volume using:

# clevis luks unlock -d /dev/sdX

For automated decryption of volumes in /etc/crypttab, enable .

For automated decryption of the root volume, we should make some changes to our Initramfs generators:

Mkinitcpio hook

Install the package. Then enable the clevis hook editing mkinitcpio.conf:

At the end regenerate the initramfs.

Booster

Luckily Booster automatically decrypts LUKS volumes bound using Clevis out of the box!

Booster is also able to read the LUKS tokens, decode clevis information, reconstruct the password and unlock the partition automatically.

Tang (network binding) pin requires network enabled. Please refer to Booster#Configuration section for more information on network configuration with booster.

Dracut

Dracut needs the following extra packages:

Followed by an initramfs regeneration:

# dracut -f

Tips and tricks

YubiKey binding

Clevis allows binding a LUKS partition using YubiKey's challenge-response mode. To bind a LUKS partition, run

# clevis luks bind -d /dev/sdX yubikey '{"slot":1}'

Install yubikey-personalization. Edit the configuration file and add following option:

Regenerate the booster images. Booster will detect this configuration during boot and use the present YubiKey to unlock the drive.

See also

This article is issued from Archlinux. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.