hub + installer (unreleased): fixes after an independent review of the night's code — per-thing mail cooldown, a box's input bounded and checked, both off-site account types on a reset, a quiet first run, strict-mode installer

Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
admin committed 2026-11-14 19:08:55 +01:00
1 parent a044eb8c16
commit f618c591eb
31 files changed
+796 -88

No files matched your search

@@ -1003,6 +1003,18 @@ a box that is fully blind sends no host report at all, so that case still reache
LAST, in the same write that sets `ca_file`; the installer writes a fingerprint only when the copy was not proven; and
a config that holds both is a pinned box — the agent treats it as „not moved" and runs the move.
**6. What an independent review changed (2026-11-14 night, built, not released).** (a) **The copy holds one or two
certificates.** The root step writes the new root FIRST and keeps the copy's previous first certificate behind it:
the copy is replaced before anything can be proven with the new root, and Proxmox serves its old certificate until
pveproxy is reloaded — without the old root, an agent that restarted in that window had no root that verified the
served certificate and no fingerprint. Never more than two; an ended one verifies nothing. (b) **One run at a time**
(`Ensure` is called from the start, the timer, a failed collect and a bundle install), and the root step has a
90-second deadline — it runs on the daemon's start path and inside the report loop. (c) **One lock for every writer
of `agent.json`** in the process (`config.FileMu`: the trust move, the PBS seed, the backup-target move): each reads
the whole file and writes the whole file. **Left open, low:** the write is in place (not a rename), and nothing reads
the parked copy `agent.json.pre-pve-trust` back by itself — on a full disk a failed write and a failed put-back can
leave an empty config; the hand repair is to copy the parked file back.
**What changes for a pinned box when Proxmox makes a new certificate:** the first failed call names
`pinned_cert_changed`, runs the order above, and the next call works — the box is blind for one report cycle at most,
not until a person repairs it. `runbooks/RUNBOOK-agent-proxmox-pin-repair.md` stays the hand repair for an agent older
@@ -432,6 +432,10 @@ label (`audits/RETIRE-peti-2026-09-25.md` A3). `runbooks/household-leaves.md`,
its descriptor (`enabled:false`, coordinates kept — `TestPBSDR_DisableKeepsTenancy`), and RESET and delete take it
down by the customer id, ticked or not.
**After review (2026-11-14):** a tick with the OTHER type (shared, then dedicated) makes a second account, so the
first account's record stays, and a RESET takes down every account type the config knows; the record is dropped only
after a provider leg that really ran — a leg skipped because this hub has no provider token leaves the record.
**Not proven:** on a deployed hub, or against the real provider. The tests run the real save, the real RESET and the
repository's fake provider (`hetznerapi.Fake`); 9 mutations seen red, one of them only after a missing test case was
added (`audits/night-build-2026-11-14/B/redproof-hub-offsite-record.txt`).
@@ -724,6 +728,11 @@ Four cases, the four the ruling names. Each leaves an event row and mails the op
queue, so a box cannot make operator mails by clearing job ids it invents; the give-up list is read only for guests
the same report lists (not running), 16 entries at most.
**The mails (after review, 2026-11-14):** each of these events tells one thing once and keeps a mark, so its mail
cooldown is keyed per thing (`notify.perSubjectCooldownEvents`) — with the plain per-type key the second job, guest or
skipped check inside the hour was suppressed and never told. The lost-mail scan tells only mails that failed before
this hub process started (one that failed since still has its retry). One box holds at most 8 give-up marks.
**Not proven on a box or a deployed hub:** all five. The tests use fakes for the mail service and the real gate
and verifier for the signed jobs (`audits/night-build-2026-11-14/B/`, 43 mutations seen red).
@@ -791,7 +791,10 @@ the product warns 14 days before the two it can read itself; the rest stays a li
What it does not do: a box with NO certificate in the store (no ACME e-mail: Traefik serves its own certificate) is not
told — the field is absent. A box that is switched off is judged on its last report: the warning is still true (an off
box cannot renew). A token or certificate that ended more than 14 days ago raises nothing at the first run (no news).
**Not proven:** on a box or a deployed hub; a real failed renewal has never been seen.
After review (2026-11-14): the FIRST run after a deploy marks what has already ended and does not mail it; the box
reports only certificates of the household's current domain; a name is told again only for an end date at least a
day later than the one told, and one household holds at most 24 marks — a box cannot make mails or marks by sending
another date or new names each hour. **Not proven:** on a box or a deployed hub; a real failed renewal has never been seen.
### 12.2 The other sixteen `[DESIGN — proposed, not built]`
+4 -1
View File
@@ -734,7 +734,10 @@ so the box's last refresh is still told after an agent restart), and `last_ask`
this agent process ended (refreshed · not_needed · failed · refused · no_answer). The agent reads one small file and
does not call the wrapper for it; a name that is not a plain unit name is dropped. The System page's cell
**„Security profiles”** reads „7.0.14-28-pve · 2 rewritten · 18 h ago · restarted chrony.service”; amber, and under
„Needs attention”, when the last ask failed or got no answer. A refused ask (an older wrapper, a BYO host) is not a
„Needs attention”, when the last ask failed or got no answer. **After review (2026-11-14):** the wrapper's record lies in a
folder that is root-only on a box where a signed job made the folder first (read in source; to be read on a box), so
the agent takes the last refresh from the wrapper's ANSWER to its own ask — the wrapper answers its record at every
ask, also „not needed” — and the file only adds the detail where it can be read; `rewritten` is absent when not known. A refused ask (an older wrapper, a BYO host) is not a
fault. No alarm is raised for a restart: it is shown, not mailed. Not seen on a box or a deployed hub.
**Measured on demo-hp, both guests running** (`audits/profile-refresh-spike-2026-11-14/`): the fault was reproduced