You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit cf71c6e
Browse filesBrowse the repository at this point in the historyBrowse files
fix(init): read the state-key mode from the volume after the first boot (#305)
* fix(init): read the state-key mode from the volume after the first boot
A node whose state_key.mode came from its machine config and differed
from the image's build-time default could not come back from any reboot.
init resolved the mode before unlock from the ESP config stage only, and
the stage exists only on the first boot, so every later boot fell back to
the build-time mode and opened the volume with the wrong protector.
Later boots now derive the mode from the LUKS2 header the volume was
sealed with: a cryptos-tpm2 token means tpm, a cryptos-kms token means
kms (with the endpoint and trust it carries), and no protector token
means nodeid. The first boot still takes it from the staged config, else
the build-time default. The multi-token TPM header left by an upgrade
still reads as tpm.
The KMS token carried no type or keyslots, which LUKS2 requires, so
cryptsetup refused to import it and kms mode could not finish a first
boot. It now has type cryptos-kms and the state keyslot.
The mode is fixed at install. ApplyConfig on a running node and the
re-provision installer refuse a config naming another state_key.mode with
FailedPrecondition, and a boot whose persisted config disagrees logs it
and keeps the sealed mode.
Signed-off-by: Bugs5382 <12115015+Bugs5382@users.noreply.github.com>
* docs: the state-key mode is fixed at install and survives upgrades
Signed-off-by: Bugs5382 <12115015+Bugs5382@users.noreply.github.com>
* style: gofmt the new state-key files
Signed-off-by: Bugs5382 <12115015+Bugs5382@users.noreply.github.com>
---------
Signed-off-by: Bugs5382 <12115015+Bugs5382@users.noreply.github.com>
Co-authored-by: Bugs5382 <12115015+Bugs5382@users.noreply.github.com>
returnfmt.Errorf("config: state_key.mode %q: this node's state volume is sealed in %q mode, which is fixed at install; reinstall the node to change it",
162
+
sk.Mode, sealed)
163
+
}
164
+
153
165
// KmsStateKey configures the envelope-encryption KMS that seals/unseals the
154
166
// state key. Only first-boot provisioning reads this from the machine config;
155
167
// later boots recover the endpoint and sealed blob from the LUKS2 header token.
0 commit comments