rehearsal: preflight refuses recycled droplet IPs — stale known_hosts + accept-new = a false 'no SSH' red (#390's real cause) #393

Closed
opened 2026-08-10 12:57:07 +00:00 by ben · 1 comment
Owner

Drive 20260810T111039Z went red at pre-legs: no SSH on root@170.64.173.190 after 300s, and the log's hint ("is the workstation's key registered on the DO account?") points the wrong way. The key is fine — a hand SSH from the workstation to that droplet succeeds.

Real cause: DigitalOcean recycled 170.64.173.190 from an earlier rehearsal run, so the workstation held a stale entry (~/.ssh/known_hosts:63). The preflight banner wait (scripts/lib/rehearsal-droplet.sh:37) uses -o StrictHostKeyChecking=accept-new, which accepts unknown hosts but refuses a changed key — every attempt failed until the 300s timeout.

Fix: after clan-lab reports the droplet IP, run ssh-keygen -R "$ip" before the banner wait (fresh droplets have no identity worth pinning at this stage). Consider the same scrub in the teardown path. Also correct the misleading hint string.

Second defect on the same path: the exit-3 branch never reaches the destroy step — clan-lab-rehearsal-d683265e was left running until destroyed by hand 2026-08-10. Gather-evidence/destroy should run on every red, pre-legs included.

Drive `20260810T111039Z` went red at pre-legs: `no SSH on root@170.64.173.190 after 300s`, and the log's hint ("is the workstation's key registered on the DO account?") points the wrong way. The key is fine — a hand SSH from the workstation to that droplet succeeds. Real cause: DigitalOcean recycled `170.64.173.190` from an earlier rehearsal run, so the workstation held a stale entry (`~/.ssh/known_hosts:63`). The preflight banner wait (`scripts/lib/rehearsal-droplet.sh:37`) uses `-o StrictHostKeyChecking=accept-new`, which accepts *unknown* hosts but refuses a *changed* key — every attempt failed until the 300s timeout. Fix: after `clan-lab` reports the droplet IP, run `ssh-keygen -R "$ip"` before the banner wait (fresh droplets have no identity worth pinning at this stage). Consider the same scrub in the teardown path. Also correct the misleading hint string. Second defect on the same path: the exit-3 branch never reaches the destroy step — `clan-lab-rehearsal-d683265e` was left running until destroyed by hand 2026-08-10. Gather-evidence/destroy should run on every red, pre-legs included.
Author
Owner

Fixed in 19c7cac (on origin/main).

Recycled-IP false red (#390 cause): oc_droplet_create now runs ssh-keygen -R "$ip" after clan-lab reports the droplet IP and before the SSH-banner wait — a fresh droplet has no identity worth pinning, so a stale known_hosts key from a recycled address can no longer make accept-new refuse a real, reachable droplet into the 300s timeout. The same scrub runs after teardown's destroy (the IP returns to DO's pool). The misleading hint ("is the workstation's key registered on the DO account?") is replaced with one that names the real shape and states the address was already scrubbed.

Leaked droplet on pre-legs red: an EXIT trap is armed the moment the droplet exists, so evidence-gather + teardown now run on every red path — the banner-wait die_host (exit 3) included, which previously skipped destroy and left clan-lab-rehearsal-d683265e running until a hand destroy. oc_droplet_cleanup guards against a double run; the drive's ordered post-drive call routes through it and the trap is the safety net.

Tests: .sandcastle/tests/rehearsal-droplet-test.sh (offline, shimmed ssh/ssh-keygen/clan-lab) pins scrub-before-wait ordering, teardown-on-timeout, --keep-droplet hold-up, and the released-IP scrub. OC_DROPLET_SSH_TIMEOUT (default 300) is the seam that lets the timeout path drive fast.

Fixed in 19c7cac (on origin/main). **Recycled-IP false red (#390 cause):** `oc_droplet_create` now runs `ssh-keygen -R "$ip"` after clan-lab reports the droplet IP and before the SSH-banner wait — a fresh droplet has no identity worth pinning, so a stale `known_hosts` key from a recycled address can no longer make `accept-new` refuse a real, reachable droplet into the 300s timeout. The same scrub runs after teardown's destroy (the IP returns to DO's pool). The misleading hint ("is the workstation's key registered on the DO account?") is replaced with one that names the real shape and states the address was already scrubbed. **Leaked droplet on pre-legs red:** an EXIT trap is armed the moment the droplet exists, so evidence-gather + teardown now run on *every* red path — the banner-wait `die_host` (exit 3) included, which previously skipped destroy and left `clan-lab-rehearsal-d683265e` running until a hand destroy. `oc_droplet_cleanup` guards against a double run; the drive's ordered post-drive call routes through it and the trap is the safety net. **Tests:** `.sandcastle/tests/rehearsal-droplet-test.sh` (offline, shimmed ssh/ssh-keygen/clan-lab) pins scrub-before-wait ordering, teardown-on-timeout, `--keep-droplet` hold-up, and the released-IP scrub. `OC_DROPLET_SSH_TIMEOUT` (default 300) is the seam that lets the timeout path drive fast.
ben closed this issue 2026-08-10 13:12:24 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Matou/idss#393
No description provided.