Skip to content

luks: FileVault-model password unlock for the aurora-sep token - #21

Merged
RyanTheTide merged 5 commits into
mainfrom
sepfde/fde-password
Nov 11, 2026
Merged

RyanTheTide merged 5 commits into
mainfrom
sepfde/fde-password

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Adds password mode to the aurora-sep LUKS2 token: the keyslot secret is sealed by the Secure Enclave to a key under a per-user key bag that only the user's password unlocks (linux#1339 on top of #921). The enclave checks the password, entangles it with its UID key and counts failed attempts; the token keeps the wrapped bag, the key record and the sealed secret, none of which opens without the password on this Mac. This is the FileVault model: unlock tied to the user's password.

  • aurora-sep-fde: enrol a password authority and a FileVault-style recovery key (each its own bag + keyslot); change the password without touching the keyslot or re-encrypting; reset a forgotten password with the recovery key; remove the installer passphrase once a password and a recovery key both exist (the FileVault end state).
  • token plugin: takes the password (or recovery key) as the LUKS2 token PIN, so cryptsetup/systemd-cryptsetup prompt for it (TTY + plymouth). A recovery-key-shaped entry only reaches recovery tokens, so it never costs the user's bag an attempt.

tests/test-fde.sh runs every flow on LUKS2 file images against a file-backed enclave double (SEP_FDE_MOCK, one directory per Mac): 31/31 on x86_64 (cryptsetup 2.8.6) and aarch64 Fedora 44 (2.8.8), incl. the enclave refusing to unseal while the bag is locked (gate-check), wrong-password refusal + counting, reboot survival, recovery, password change with anti-rollback, a copied volume refused on another Mac, and a tampered sealed secret refused.

Draft until the kernel side merges and the Neo hardware proof passes. dracut module + distro packaging + SELinux follow once proven.

RyanTheTide and others added 5 commits November 10, 2026 00:58
The keyslot secret is sealed by the Secure Enclave to a key under a
per-user key bag that only the user's password unlocks; the enclave
checks the password, entangles it with its UID key and counts failed
attempts. The token keeps the wrapped bag, the key record and the sealed
secret, none of which opens without the password on this Mac.

aurora-sep-fde enrols a password and a FileVault-style recovery key
(each its own bag and keyslot), changes the password without touching
the keyslot, resets a forgotten password with the recovery key, and
removes the installer passphrase once both exist. The token plugin
takes the password (or recovery key) as the LUKS2 token PIN, so
cryptsetup and systemd-cryptsetup prompt for it; a recovery-key-shaped
entry only reaches recovery tokens, so it never costs the user's bag an
attempt.

tests/test-fde.sh runs every flow on LUKS2 file images against a
file-backed enclave double (SEP_FDE_MOCK), one directory per Mac:
32/32 on x86_64 (cryptsetup 2.8.6) and aarch64 Fedora 44 (2.8.8).
Kernel side: linux branch sepfde/fde-seal (SEP_BIO_FDE_*) on #921.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…g is locked

For hardware qualification: with the user's bag locked, ask the enclave
to open the sealed secret and require a refusal; unlock with the
password and require the same request to succeed. The secret is never
printed. test-fde.sh gains the row (31/31 on x86_64 and aarch64).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A fresh variant-5 user bag wraps to 1504 bytes; the kernel raised
SEP_KEYBAG_BLOB_MAX to 4096. The ioctl numbers encode the struct size,
so match it and assert the layout.

Assisted-by: LLM
The existing LUKS passphrase from --unlock-key-file is a key file in the
cryptsetup sense: every byte counts, a trailing newline included. It was
read like a password file, newline stripped, so a slot made by
"cryptsetup luksFormat DEV FILE" from a file ending in a newline did not
open (EPERM when adding the keyslot). The test now writes its installer
key file with a trailing newline.

Assisted-by: LLM
…ag locked

After the lock transition the key store keeps the bag in its locking
phase, its class keys usable, for a grace period (about 40 s on the Neo,
for every lock reason) and then reports it locked. gate-check now unlocks
the bag first, locks it, waits up to 120 s for lock_phase 1, reports how
long that took, and only then requires the unseal to be refused.

Assisted-by: LLM
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Hardware rows on the Neo: real SEP, kernel from linux#1339, LUKS2 container file only. enroll, gate, reboot, recovery, change and reset pass. Two rows fail: replay (an old header with the old password opens after a reboot) and the other-OS lane (it still opens). Full table in linux#1339.

Changes from the run:

  • 684fc93: BAG_MAX goes to 4096 to match SEP_KEYBAG_BLOB_MAX, because a fresh bag wraps to 1504 B. A static assert pins the struct sep_keybag_blob size, which is encoded in the ioctl number.
  • 6ad4615: --unlock-key-file is now read as a cryptsetup key file, every byte counted. Before, it dropped a trailing newline, so a keyslot made by cryptsetup luksFormat DEV FILE failed with EPERM. The test key file now ends in a newline.
  • 5067539: gate-check unlocks the bag, locks it, and waits up to 120 s for the enclave to report lock_phase 1 before it requires the refusal. The key store keeps class keys usable for about 40 s after a lock, whatever the reason.

make check (test-seal, test-luks, test-fde) has 0 failures on aarch64 Fedora 44 with cryptsetup 2.8.8.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Cross-Mac row on the J616s: the Neo's container is refused there (the token import fails with EPERM, and the volume does not open). PASS. Kit fixes only, no tool change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant