Render a dev VM's own external SSH aliases beside its forge entry #83
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
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
allod/archetypes#83
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?
Render, beside a dev VM's forge entry, the SSH aliases its own identity record declares for external hosts it reaches with its own key, so a VM can hold an alias without receiving the hypervisor's address book. Part of allod/strategy#57.
Primary goals:
mkDevVmimports the existing translation module withsshHosts = identity.sshHosts or { }, whereidentityis the machine'sdevIdentitiesrecord; a secrets fork that predates the field composes unchanged.runtimeIdentity.forgeHostis an evaluation error naming the machine, because a duplicate at normal priority would silently replace the blockdev-ssh-forge.nixrenders (or, after allod/archetypes#82, clash on type with a message that names no cause). The secrets projection refuses it first; this is the layer beneath.devVMs.<vm>.sshHostson the template's dev machine with one synthetic external host (address in192.0.2.0/24, anextraOptions.HostKeyAlias), and the projection indevIdentitieswithidentityFiledefaulting to~/.ssh/${sshKeyName},identitiesOnlytotrue, refusing the forge host and any machine of the deployment (compared case-insensitively, as OpenSSH matchesHostpatterns), an alias that is not one literal token matching[A-Za-z0-9][A-Za-z0-9._-]*(a space or glob character renders a pattern that can capture the forge host), and an entry without a string hostname.checks/ssh-settings.nixgains a dev fixture with a per-VM host:ssh -Gresolves it to the VM's key and the extra directive, the forge entry is untouched beside it, and a forge-named alias throws. The composed check that pins the builders' wiring covers the new import the same way it coversdev-ssh-forge.nix.Current state and specifics
flake.nix(mkDevVm) importsmodules/home-shared.nix,modules/dev-ssh-forge.nixand the rest;modules/host-ssh-hosts.nixis the translation from the address book's field names (hostname,user,port,identityFile,identitiesOnly,localForwards,extraOptions) toprograms.ssh.settings, imported bymkHypervisoralone. Its name says hypervisor; once both builders import it, a neutral name such asssh-hosts.nixreads better, and the header comment's "imported by the hypervisor builder alone" goes. The per-VM entries arrive already defaulted from the secrets projection, so the module needs no change beyond being imported twice with different data.The secrets template's
devIdentities(flake.nix, thebuiltins.mapAttrs (name: vm: ...) identity.devVMsblock) gainssshHosts = <projection> name vm;. The projection is a dozen lines: reserved names arebuiltins.attrNames identity.devVMs ++ builtins.attrNames identity.privacyVMs ++ [ identity.hostname identity.forgeHost ]; each entry is{ identityFile = "~/.ssh/${vm.sshKeyName}"; identitiesOnly = true; } // entry. A check in that repo proves each refusal fires on sabotaged input (an upper-cased machine name,*, a two-pattern name, a literalHostheader, a missing hostname, a non-attrset) and that a machine without the field projects to{ }.Scope
In:
flake.nixbuilder wiring, the translation module's name and header,checks/ssh-settings.nix; in allod/secrets,identity.nix,flake.nixand a check. Out:identity.sshHostsand the hypervisor; the transitionalmkDefault, allod/archetypes#82; any deployment's data.Landed: the dev builder consumes identity.sshHosts through the shared translation and the template carries the projection; allod/archetypes#82 dropped the transitional mkDefault alongside. Part of allod/strategy#57.
Reopened: the closing comment above was wrong. What landed after the first refactor is allod/archetypes#82 only (
447213e,680442d); nothing yet consumes identity.sshHosts in the dev VM builder, and a dev machine composed from a secrets export that carries the field still renders only the forge block, measured against a deployment's lock today. This issue is the open implementation task as written.