Lion Cipher Lab
Encrypt a volume with LUKS in a loopback file and prove it is unreadable when closed
- Cyber / Security Engineer
- Intermediate
- ~55 min
- Free · no account required
Why it matters
Encrypting data at rest protects it when a laptop is lost, a disk is sold or a backup tape goes missing. LUKS is the standard Linux way to do it, and the mechanics are simple once you have done them: a header with keyslots, a key that exists in memory only while the volume is open, and ordinary ciphertext on disk. Doing it inside a file lets you break things safely. You will also learn the two judgment calls that catch real teams: proving the protection with a test, and treating the header backup as a secret.
What you'll learn
- creating an encrypted LUKS2 volume inside an ordinary file
- opening, mounting, unmounting and closing it, and saying where the key lives while it is open
- proving encryption works by searching the raw file for a known marker, with a plaintext volume as the control
- reading a LUKS header with luksDump
- backing up a LUKS header, surviving a wiped header, and explaining why the backup is itself a secret
Steps in this lab
- What LUKS is, and why a file is a safe place to learn
- Create the image file and attach it as a loop device
- Format it as LUKS2, open it, and make a filesystem
- Mount it, write a marker, then unmount and close
- Prove it: search the raw image, with a plaintext control
- Read the header: luksDump
- Back up the header, then wipe it on purpose
- Restore the header and read the data back
- What LUKS protects, and what it does not
- Clean up
Open the full interactive lab →