An ENDO_EXTRA setup can fail silently forever: the forgejo credential seeder has never run #29
Loading…
Add table
Add a link
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?
A setup listed in
ENDO_EXTRAthat fails leaves no trace anyone on this host can read, and at least one of them has been failing silently for as long as the records go back.What was observed
packages/space-nixos-admin/setup-forgejo-credential.jsis in the daemon'sENDO_EXTRAand should provisionforgejo-credentialon every start. That name has never been bound in the host inventory. After deploying046bfeb(which changed the setup to rotate an existing credential in place instead of re-minting it) and applying it as generation 42, the restart still left bothforgejo-credentialandforgejo-credential-httpsat{ available: false, revoked: true }. No rotation happened.Everything the setup needs is present:
ENDO_FORGEJO_FLOOT_PWandENDO_FORGEJO_URLare both in the daemon process environment (read from/proc/<MainPID>/environ; the password is 21 bytes).systemctl show -p Environmentconfirms the setup is inENDO_EXTRA, and the file is present in the current release.So the setup either never runs or throws before reaching the credential, and there is no way to tell which.
Why it is invisible
packages/daemon/src/manager-node.jsruns each extra in a try/catch and reports failure withconsole.error:That goes to the journal, and the
endouser is not inadm,wheelorsystemd-journal, sojournalctl -u endo-daemon.serviceanswers "No journal files were opened due to insufficient permissions". An agent administering this host cannot read the one place the answer exists.Wanted
{ specifier, ok, error, at }per start. A setup that silently does nothing for weeks should not be possible.Related: #21 (a revoked git credential only surfaces when a push fails). This is why the re-provisioning meant to prevent that never happened.
Answered, by the record this issue asked for
Generation 43 wrote the first
extras.json, and the seeder is not failing at all:All fifteen extras report
ok: true. Yet immediately after that boot,forgejo-credentialin the machine-admin inventory is{ available: false, revoked: true }, and a fetch through a remote holding it fails with "has been revoked".Two different inventories
ENDO_EXTRA setups run against the daemon's ROOT host -
E(endoBootstrap).host()inmanager-node.js. The machine-admin session'sendois a different host:So the seeder provisions and rotates
forgejo-credentialin the root inventory, where nothing that pushes can see it, while the credentials the machine-admin host actually holds are never touched and stay revoked from the restart onward. That also explains the older half of the mystery:forgejo-credentialhas never appeared in the machine-admin inventory because it was never written there.The rotate-in-place change in
046bfebis correct but inert for the same reason - it rotates the root's copy.Proposed fix
Grant the credential the way
nixos-adminis already granted.floot-factory-setup.jshasgrantNixosAdmin(agent, factoryProfilePath), which locates a name in the root inventory andstoreLocators it onto the factory profile. The same three lines forforgejo-credentialwould put a live, boot-rotated credential in the inventory the machine-admin host reads, and because a GitRemote holds the credential cap, remotes wired to it would then survive every restart without being rebuilt.Worth noting the diagnostic worked exactly as intended: the record turned a four-hour guess into one file read.
Fixed in
949c3af(generation 43) and it paid for itself immediately.<stateDir>/extras.jsonnow records every ENDO_EXTRA setup per start - specifier, ok, timestamp, error message on failure - and failing to write it never fails the daemon.The first record answered the question this issue was opened to answer: the seeder was not failing, it was writing to the root inventory while the machine-admin session read its own. Fixed in
9dd1371by granting the credential to the factory profile; generation 44 came up with a live credential and no manual rotation.The second bullet - journal read access for the daemon user - is not done and is a separate concern; reopen or split it out if it is still wanted.