Repository navigation
fix(homelab): skip unprovable join candidates and stop trusting a bare k0s token - #591
Conversation
attempt() ended the whole round on the first ErrNotProven. mDNS answers are unauthenticated, so a rogue advertiser, or a second cluster's control plane on the same LAN, listed before the real control plane made every round stop there: the node backed off and asked the same peer first again, never reaching the control plane that knows its passphrase. The loop (now tryCandidates, with the join call injected for tests) skips the rest of a candidate that failed to prove the passphrase and moves on to the next one. Its other addresses are not tried: they would only spend guesses on the same answer. The guess budget is unchanged and still shared by every candidate (charged before each PAKE, refunded only after the peer proved the passphrase), so ErrBudget still ends the round and a rogue advertiser gets no more guesses than before. Assisted-by: Claude Opus 5.5 via GitHub Copilot Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
joined() returned true as soon as /etc/k0s/token existed. ops.Join writes that token before it starts k0s-first-boot.service, so when the start failed, or k0sworker could not use the token before its 15-minute expiry, a restarted bluefin-cluster join logged "already joined", wrote the joined marker and never asked for a fresh token: the node stayed out of the cluster for good. A node now counts as joined only on the marker or on the kubelet kubeconfig written after bootstrapping: /etc/kubernetes/kubelet.conf for kubeadm (unchanged) and /var/lib/k0s/kubelet.conf for a k0s worker (k0s's KubeletAuthConfigPath, which k0s itself checks first). joined() honours ops.Root so it can be tested. Assisted-by: Claude Opus 5.5 via GitHub Copilot Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The cmd package had no Go tests; the only checks on its passphrase handling and its mDNS advertisement were source-text assertions in test_homelab_cluster.py. Add table-driven tests for: - controlPlanePassphrase: operator-chosen passphrase normalised, stored 0600 and preferred over a stored one; weak or non-ASCII ones refused without echoing them; a stored one reused unchanged; a 4-word one generated on first start and stored for the next. - nodePassphrase: homelab.conf before the credential, the credential, neither, and non-ASCII input. - the DNS-SD body, exactly, so the TXT record keeps carrying no secrets. Minimal seams: the DNS-SD text moves into dnssdBody(), and the stored passphrase is read under ops.Root like every other ops path. The Python check now follows the body into dnssdBody() and still asserts the same TXT format and that neither function mentions a passphrase or token. Assisted-by: Claude Opus 5.5 via GitHub Copilot Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Needs approval from an approver in each of these files:Approvers can indicate their approval by writing |
…test.go #591 adds cmd/bluefin-cluster/main_test.go with its own nodePassphrase cases, so this file moves to join_test.go and drops the three cases that duplicate them (conf beats credential, credential fallback, non-ASCII). Kept: the missing-passphrase error naming its sources and the manual-control-plane joins against a loopback join.Server. Assisted-by: Claude Opus 5.5 via GitHub Copilot Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Needs approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Needs approval from an approver in each of these files:Approvers can indicate their approval by writing |
Danathar
left a comment
There was a problem hiding this comment.
Reviewed head 9d93459: the join loop skips a candidate that cannot prove the passphrase (ErrNotProven moves to the next candidate, ErrBudget still ends the round) and joined() no longer trusts a bare /etc/k0s/token; Go tests cover both.
/approve
|
Ready for a human merge: verdict approved @9d93459, 25/25 checks green, soak 30m0s elapsed, labels: hold. Held: the Confirm the intent (resolve the sentinel alert or lift the hold), then Updated 2026-11-14 23:36 UTC. |
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: danathar The full list of commands accepted by this bot can be found here. Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/hold Holding until the BuildStream cache root-cause fix #664 lands. Do not enqueue pre-fix builds. |
|
/hold Cache repair order: #664 first; then #669 (payload-completeness correction, retargeted to main after #664 lands). Keep this PR out of the queue until both are merged, both main seed variants have actually succeeded, and the GCC payload can be pulled from the project CAS. Then resume #640 before #591, one at a time. #667 and #665 are closed as superseded; do not re-enqueue them. |
|
Sequencing correction: #665, #667 and #669 are now closed because every correction is consolidated directly into #664 at 47ce75e, including the verified systemd clock-epoch fix. Keep this PR held until #664 passes the full queue and merges, both main seed variants succeed and a real project-CAS GCC payload pull succeeds. Then resume #640 before #591, one at a time; no separate #669 merge is required. |
|
/hold cancel #664 is merged and passed its main build, all four boot buckets and publication. The additional dependency on #670 was unnecessary: its cache-producer completeness and advisory-warming improvements do not gate this approved consumer change. Cancelling my earlier sequencing hold. Requested fresh pull-request checks using the current-main merge ref, rather than rerunning stale pre-#664 snapshots. The approved PR head is unchanged, so Danathar’s review is preserved. Use the normal merge queue and its required checks; no administrative bypass. |
bb459ab
Summary
tryCandidates(wasattempt()) moves on to the next mDNS candidate when one cannot prove the passphrase (ErrNotProven). Previously it ended the whole round.joined()no longer treats/etc/k0s/tokenas proof that the node joined. It now requires one of:/etc/kubernetes/kubelet.conf(kubeadm) or/var/lib/k0s/kubelet.conf(k0s worker)cmd/bluefin-cluster:Why
Join loop. mDNS answers are unauthenticated. A rogue advertiser, or another cluster's control plane on the same LAN, that answered first ended every round. The node then backed off and asked the same peer first again, so it never reached its own control plane.
The guess budget is unchanged. It is still shared by every candidate: charged before each PAKE and refunded only after the peer proves the passphrase. So
ErrBudgetstill ends the round, and a rogue advertiser gets no extra guesses. Once a candidate fails to prove the passphrase, its other addresses are skipped.Joined check.
ops.Joinwrites the token before it startsk0s-first-boot.service. If that start failed, or the 15-minute token expired before k0sworker used it, a restartedbluefin-cluster joinlogged "already joined" and never asked for a fresh token.Notes
cmd/bluefin-clusterstatement coverage is 17.7%. The new tests cover the passphrase and DNS-SD logic;serve/runJoinare I/O glue and remain untested.dnssdBody(). The source-text check intest_homelab_cluster.pynow looks there.Testing
go vet ./...andgo test -race ./...infiles/homelab/cluster: pass. This coverstryCandidateswith an injected join (a rogue candidate first, then budget exhaustion) andjoined()underops.Root.pytest -n auto tests/unit: 1900 passed, 30 skipped.docs-checks.py: clean.just validate: passes.