Creating a Secondary LUKS Passphrase and LUKS Header Backup

30 minutes
  • 2 Learning Objectives

About this Hands-on Lab

In this hands-on lab, we will create a secondary passphrase for a LUKS-encrypted volume, which can be used to recover the volume’s encrypted data if the primary passphrase ever becomes corrupted. Then we’ll create a backup of the entire LUKS header, which can be used to recover the encrypted data if the entire LUKS header ever becomes corrupted.

*This course is not approved or sponsored by Red Hat.*

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Create a Secondary LUKS Passphrase
  1. We first need to identify what volume group the patient_lv volume is part of. When a LUKS-encrypted volume is created, its original name includes the volume group name. Run the following command, and look for the device name in the output:
    cryptsetup -v status patient_lv
  2. Next, check the LUKS header for the next available key slot (it should be key slot 1).
    cryptsetup luksDump /dev/mapper/luks_vg-patient_lv
  3. Add the new secondary passphrase using the following command:
    cryptsetup luksAddKey --key-slot 1 /dev/mapper/luks_vg-patient_lv
  4. Enter the primary passphrase (Pinehead1!) at the prompt.
  5. Next, enter the secondary passphrase (BackupsRGood!) at the prompt.
  6. Confirm the new secondary passphrase by entering BackupsRGood! at the passphrase confirmation prompt.
  7. Run the following command, and verify that there is now a value in key slot 1:
    cryptsetup luksDump /dev/mapper/luks_vg-patient_lv
Create a Backup of the LUKS Header
  1. Run the following command:
    cryptsetup luksHeaderBackup /dev/mapper/luks_vg-patient_lv --header-backup-file /root/luks_vg-patient_lv-LUKS-header.backup

Additional Resources

Last week, your organization experienced a loss of data due to a corrupted LUKS header. In an effort to prevent this unfortunate incident from happening again, your supervisor has tasked you with creating a secondary LUKS passphrase and a LUKS header backup for the LUKS-encrypted logical volume patient_lv.

The primary LUKS passphrase is Pinehead1!, and the new secondary LUKS passphrase should be BackupsRGood!. The LUKS header backup should be stored in /root/ and named luks_vg-patient_lv-LUKS-header.backup.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?