Repository navigation
Recovery key decided by the boot package, encrypt.state kept on the kept slots - #553
Merged
Merged
Conversation
…n the kept slots Owner provisioning offers a recovery passphrase where the platform's boot package implements the new luks-slots dispatch operation, instead of asking omarchy-hw-apple-silicon: omarchy-mac-boot records the owner's and the recovery slot for its boot check, so Macs keep the key and x86 first boot is unchanged. The recovery key is added with the staged install key before the worker, journaled as reserved, added, shown and acknowledged, so a retry keeps an acknowledged key, replaces one that was never acknowledged, and may still choose a new password while the staged key opens the disk. The recovery key is refused as the password. The re-key records its final slots through luks-slots before it destroys the staged key, and omarchy-drive-password records the owner's slot after a system disk change before it drops its journal, so encrypt.state no longer goes stale when a key lands in another slot. The drive password change refuses the recovery key as the current password and a new password in its form.
… disk change A recovery slot the journal called acknowledged but the header lost is now journaled as unacknowledged before its replacement goes in, so a retry after a kill there replaces it again instead of keeping a key the owner never saw. omarchy-drive-password resolves luks-slots before it changes the system disk, so a boot package too old to record the slot stops the change up front rather than leaving a journal only an update can finish. Owner setup names the recovery key when it is typed as the password, and says why an attempt stops when dispatch cannot tell whether to add one.
…ing an acknowledged key
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ticket 33: recovery passphrase and temporary-key cleanup under interruption.
What changed
recovery_key_offered() { omarchy-hw-apple-silicon; }in owner provisioning. It now asks the boot package: a platform whose boot package implements the new dispatch operationluks-slotsgets a recovery passphrase.omarchy-mac-bootimplements it (its boot check proves an owner and a recovery slot), so Macs keep the key and x86 first boot is unchanged, with no extra screen. The mechanism (journal, screen, slot operations) stays core. I kept it out of x86 because the spec lists it as an mx-mac port rather than a generic improvement, and turning it on everywhere would change x86 OEM and factory-reset first boot and break the x86 provision VM gate's harness.prepare_luks_recoveryadds the key with the staged install key before the worker runs. The journal records the reserved slot, thenrecovery_shown=0once the key is added, thenrecovery_shown=1once the owner acknowledges it. On a retry an acknowledged key is kept. One that was added but never acknowledged is revoked and replaced in its slot, and the owner is told to replace any copy they wrote down. The owner's slot is now only the re-key's step, so a retry can still choose a new password while the staged key opens the disk, as on x86. The recovery key is refused as the password.luks-slots owner=<n> [recovery=<n>](required on Apple) rewritesowner_slot/recovery_slotin/boot/omarchy/encrypt.stateafter checking the LUKS header (Keyslots section only) holds them. The shared re-key calls it after it has verified the kept slots and before it destroys the staged key.omarchy-drive-passwordcalls it withsudoafter a system-disk change, and only when it resolves, before it drops its journal. Without this, a key that landed in another slot left the boot check failing. On cryptsetup 2.8.8,luksChangeKeymoves a LUKS1 key to the first free slot and keeps a LUKS2 key in place, and an interrupted change can also finish in the new slot.omarchy-drive-passwordrefuses the recovery key as the current system-disk password, and a new password in its form, so the recovery slot is never the one that changes. It resolvesluks-slotsbefore touching the system disk, so a boot package too old to record the slot stops the change up front. A Mac withoutomarchy-mac-bootat all (dispatch exit 3, as Post-update boot verification blocks update completion and the reboot #543 treats it) changes its password and records nothing.luks_slot_for/luks_dump_slots, which Security: keep enrolled LUKS2 tokens from passing LUKS key checks #549 moved to--token-type passphrase-only. The new luksDump parse inomarchy-mac-bootreads only the Keyslots section. Security: keep enrolled LUKS2 tokens from passing LUKS key checks #549's token tests are adapted to the new order: the owner's slot now comes from the re-key, not the recovery step.Version skew:
luks-slotsis required on Apple. With a runtime that has this change, anomarchy-mac-bootolder than it stops owner setup before the form and refuses a system-disk password change, both with the dispatcher's error naming the package. The published 20260925-2 needs a new build from this branch before the runtime ships to Macs.Testing
test/shell.d/luks-rekey-journal-test.shnow runs the whole setup attempt (recovery step, then worker) and kills it after every durable step: 17 steps on Apple, 11 on x86. It runs on the slot-table fake and on real file-backed LUKS2 and LUKS1 volumes (cryptsetup 2.8.8). Each kill is followed by retries with the same password, with a new one, and with the recovery key, which is refused. After every kill, an acknowledged recovery key opens its slot. Each finished run checks that the volume holds only the owner's slot and the last acknowledged recovery slot, that the recovery key unlocks the volume, that replaced keys, the staged key and the previous owner's key open nothing, that the staged key file and every boot-time unlock are gone, and that the recorded slots match the header. On x86 it checks that no slot is recorded and no recovery key is made.test/shell.d/drive-password-test.shreruns its kill-at-every-step matrix on an Apple fixture (fake, LUKS2, LUKS1) and checks that the recorded slot follows the owner's key. It also covers a failed record (the journal stays and the rerun finishes), an old boot package (refused before any change), a Mac without the boot package, recovery-key refusal, data drives, and x86 (no dispatch under sudo).packages/omarchy-mac/boot/test/mac-provision-test.shcovers the realluks-slotsentrypoint: it records and is idempotent, it refuses slots the header lacks (tokens included), bad arguments and unfinished conversions, and it does nothing on declined or unencrypted Macs.provision-owner-luks-test.shruns the real entrypoints end to end, including a retry after the commit that changes the password and movesowner_slot../test/allandpackages/omarchy-mac/boot/test/allas a non-root user in an arm64 Arch container: the same failures as base and nothing new: hermes-remove, snapper and the omarchy-iso-checkout check need files the container lacks, and system-sleep-ownership-migration is flaky (it failed 5 of 8 runs on base).packages/omarchy-mac/boot/test/allpasses. Merged with quattro-upstream at 89ef5df (Security: keep enrolled LUKS2 tokens from passing LUKS key checks #549, Post-update boot verification blocks update completion and the reboot #543, Early-load thunderbolt only where the kernel builds the module #551, Apple factory reset through lifecycle dispatch #552).sudo cryptsetup open --test-passphrase --token-type passphrase-only /dev/disk/by-uuid/<luks_uuid>with the recovery key,sudo omarchy-apple-silicon-boot-check, thenomarchy-drive-passwordfollowed by the boot check again.Second review: it found an acknowledged recovery slot that went missing, which a kill after the re-add could leave holding a key the owner never saw. It also found a disk password change that an old boot package could leave unfinishable, and a failed luksDump read as a missing key. All three are fixed, and the re-check confirmed the fixes with repro scripts. It judged x86 unchanged, no secrets in argv, the journal or logs, and the crash matrix sound. One product gap is left as a follow-up: an owner who has only the recovery key cannot set a new password, since sudo needs the forgotten one.