Feature: Remove the CI SSH key from k3s nodes after bootstrap #95

Merged
claude-bot Bot merged 1 commits from feature/revoke-ci-ssh-key into main 2026-12-06 02:39:51 +01:00

What changes

  • New step 9 in k8s-bootstrap: revoke-ci-key-<node> for all 6 nodes. Each removes the CI runner key from ~/.ssh/authorized_keys, after every other SSH step has finished.
  • The script refuses to write an empty authorized_keys, and checks afterwards that the key is gone.
  • The repeated start, SSH-wait and join commands now go through helpers (startVm, waitSsh, joinMaster, joinWorker). Resource names are unchanged.

Why

The CI key is only needed during bootstrap, but it stayed on every node with passwordless sudo. Removing it means a leaked key no longer opens the nodes. The pve admin keys stay, so admin SSH access is unaffected. Nodes talk to each other over TLS, not SSH, so the cluster itself is unaffected.

Needs ciRunnerPublicKey from proxmox-infra (#94, already deployed).

Expected effect on deploy

Merging does not deploy: 02 runs only via manual dispatch. Local pulumi preview: 6 to create (revoke-ci-key-*), 31 unchanged.

The manual run removes the CI key from the live nodes. Afterwards ssh ubuntu@<node> from a Proxmox host should still work.

Note: if a VM gets new cloud-init settings later, cloud-init may add the key again on the next boot. Re-run that node with --target-replace on revoke-ci-key-<node>.

## What changes - New step 9 in `k8s-bootstrap`: `revoke-ci-key-<node>` for all 6 nodes. Each removes the CI runner key from `~/.ssh/authorized_keys`, after every other SSH step has finished. - The script refuses to write an empty `authorized_keys`, and checks afterwards that the key is gone. - The repeated start, SSH-wait and join commands now go through helpers (`startVm`, `waitSsh`, `joinMaster`, `joinWorker`). Resource names are unchanged. ## Why The CI key is only needed during bootstrap, but it stayed on every node with passwordless sudo. Removing it means a leaked key no longer opens the nodes. The pve admin keys stay, so admin SSH access is unaffected. Nodes talk to each other over TLS, not SSH, so the cluster itself is unaffected. Needs `ciRunnerPublicKey` from `proxmox-infra` (#94, already deployed). ## Expected effect on deploy Merging does not deploy: `02` runs only via manual dispatch. Local `pulumi preview`: 6 to create (`revoke-ci-key-*`), 31 unchanged. The manual run removes the CI key from the live nodes. Afterwards `ssh ubuntu@<node>` from a Proxmox host should still work. **Note:** if a VM gets new cloud-init settings later, cloud-init may add the key again on the next boot. Re-run that node with `--target-replace` on `revoke-ci-key-<node>`.
claude-bot Bot added 1 commit 2026-12-06 02:38:39 +01:00
feature(k8s-bootstrap): remove the CI SSH key from nodes after bootstrap
Deploy k8s Bootstrap / Bootstrap k3s Cluster (pull_request) Skipped
Deploy k8s Bootstrap / Pulumi Preview (pull_request) Successful in 31s
Secret Scan / Betterleaks (pull_request) Successful in 5s
2327e42cdd
The key is only needed during bootstrap, but it stayed on every node with
passwordless sudo. A final step now removes it once all SSH steps are done.
Needs the ciRunnerPublicKey output from proxmox-infra, so deploy that first.

Also moves the repeated start, SSH-wait and join commands into helpers.
Resource names are unchanged, so nothing re-runs on the live cluster.
claude-bot Bot merged commit 3c07c5d3b3 into main 2026-12-06 02:39:51 +01:00
Sign in to join this conversation.