Disk encryption recovery keys¶
LiMDM checks that the system disk is encrypted with LUKS (disk.encryption) and stores a
recovery key for every LUKS volume on the server, so IT can restore access when a user
forgets the passphrase. Encryption itself happens at installation; LiMDM cannot encrypt an
existing disk.
Enable¶
Library item com.limdm.diskencryption, assigned in a blueprint:
The compliance check disk.recovery fails while a LUKS volume has no escrowed key. With
require_all the check disk.encryption needs every local volume on LUKS except the mount
points in exclude (an entry covers everything below it); without it only / counts. Every
field with its limits: com.limdm.diskencryption.
Two kinds of volume never count, with or without exclude: the EFI system partition (GPT
type EFI system, or vfat mounted at /boot, /boot/efi or /efi), which the firmware reads
and which cannot be encrypted, and removable or hotplugged media such as USB sticks (lsblk
RM or HOTPLUG). The agent reports both in the inventory (role: esp, removable) and
the device page marks them not required and removable media instead of a red badge.
How the key is created¶
Adding a key slot needs an existing passphrase, which only the user knows. Therefore:
- The desktop helper
limdm-desktopasks the user at login, and then once a day while a key is missing, with a dialog showing the company name and logo: "Company needs a recovery key for the encrypted disk ...". The user can postpone. The menu entry "Disk recovery key" starts it at any time. - The user enters the current disk passphrase. The helper sends it over
/run/limdm/agent.sockto the agent. The agent accepts it only from a user with an active local session and allows five wrong passphrases per 15 minutes per user. - The agent generates a recovery key in the systemd format (64 characters in eight groups,
about 256 bits), adds it with
cryptsetup luksAddKey, verifies it withcryptsetup open --test-passphraseand sends it with the next check in. The passphrase is used once and never stored or sent; it only exists briefly in a private tmpfs file. - The user's passphrase stays unchanged.
Administrators can do the same in a terminal: sudo limdm-agent recovery-key.
If no desktop helper runs (no graphical session, no zenity or kdialog), the agent shows a desktop notification once a day pointing to the menu entry.
Storage and access¶
- The server seals each key with AES-256-GCM under a key derived from
LIMDM_SESSION_KEY; device ID and volume UUID are bound as additional data, so a sealed key cannot be moved to another device or volume. A session key rotation seals every key again with the new key (Session key). - Admins and helpdesk accounts (within their device scope) see the volumes on the device page (Hardware, Recovery keys) and reveal a key with Show key (a POST request with CSRF protection, the answer is not cached). Auditors cannot reveal keys.
- Every escrow (
recovery.escrow) and every view (recovery.view, with the viewer, the reason and the approval) is written to the audit log.
Enter the recovery key at the boot prompt instead of the passphrase.
Four eyes approval for key views¶
With Settings, Security, Four eyes approval on, the option "Also for recovery key views" makes every view wait for a second administrator (Four eyes approval):
- Show key opens Request access to the recovery key. The viewer enters a reason or ticket reference (required, one line up to 500 characters) and sends Request approval.
- The request appears under Approvals and is announced as
approval.request. Another administrator approves or rejects it; the requester can never decide their own request. Requests nobody decides expire after 24 hours. - After approval the requester opens the key with Show key again, once, within one hour. The audit entry names the approval number, the approver and the reason.
While a request is pending, Show key shows "Waiting for approval". With the option off, admins and helpdesk see the key directly.
Notification on every view¶
Every view raises the notification event recovery.view ("Recovery key viewed", severity
warning) with the viewer, the volume, the reason (or "none given") and a link to the device.
Subscribe a channel to it under Settings, Notifications
(Channels) to learn about each view at once.
Rotation after view¶
With rotate_after_view a key is replaced after someone viewed it:
- The server marks the key and sends the current key with the next check in.
- The agent adds a new generated key using the current one, verifies it and escrows it.
- Only after the server confirmed the new key, the agent removes the old key slot.
The device page shows "rotation pending" until then. If the device is offline, the viewed key keeps working until the device checks in again.
Limits¶
- Only volumes visible to
lsblkascrypto_LUKSare handled. - FIDO2 unlock is not managed; such slots are left alone, except in lost mode, which removes every slot but the recovery key.
- The agent's own mTLS key is kept in the TPM independent of LUKS binding (TPM bound device key).
- Replacing
LIMDM_SESSION_KEYoutright makes stored keys unreadable. Rotate it as described in Session key instead: the old key stays listed until every recovery key is sealed again.