allod secret declare hardcodes the hostKey recipient binding #271
Labels
No labels
blocked
bug
decision
duplicate
enhancement
help wanted
invalid
landed?
question
ready-to-merge
stale
wontfix
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
allod/tools#271
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
allod secret declarewrites asecrets.nixrecipient line that only evaluates in a checkout defininghostKey; it should take the host recipient name from the checkout it edits instead of hardcoding it.Primary goals:
declareappends uses whatever binding the targetsecrets.nixalready uses for the hypervisor's keys, so a fork that names it differently gets a linenix flake checkaccepts.secrets.nixhas no recognisable host-recipient binding,declarerefuses with the file and the names it looked for, instead of writing a line that fails evaluation atcreatetime.Current state and specifics
cmd/allod/secret_declare.godeclareSecretsRecipientswrites the literal[ hostKey ](b.WriteString("[ hostKey ]")) followed by++ vmKeys "<vm>"per guest target. The public template'ssecrets.nixbindshostKey = identity.hostPublicKey;, so the line evaluates there. A fork that derives the hypervisor recipient set differently — for example a list holding the active and a staged host key under another name, with nohostKeybinding at all — gets a line that fails evaluation withundefined variable 'hostKey'.declareitself succeeds and prints the three paths, so the failure surfaces only when the operator runsallod secret createon the host, which runs the repository's checks after writing the ciphertext and then restores the files.The other two pieces
declarewrites are already derived from the checkout (machines.<name>.typefrom the inventory flake,lib.credentialEncodingsfrom the secrets flake), so the recipient binding is the one hardcoded name left.Scope
In:
declareSecretsRecipientsreads the recipient binding name from the targetsecrets.nix(the name bound to the hypervisor keys, which the existing lines in that file already use), and refuses when none is found. Out: changing the public template's binding name; any change tocreate,rekeyorrotate.Closed in favour of allod/secrets#46, by the owner's decision. Reading the fork's binding name out of secrets.nix (allod/tools#275, closed unmerged) fixes the symptom and keeps the cause: declare hand-writes a recipient line into a data file whose naming a fork owns. allod/secrets#46 derives those recipients from the rotation registry inside the secrets repo, after which declare writes no secrets.nix line at all; the tools half is filed as its own issue when that lands, and each deployment fork adopts the derivation in its own repo first.