docs(sync-host-keys): fix stale host-keys/ references in comments and usage
Check NixOS configurations / eval-hosts (pull_request) Successful in 10m24s

After the clan vars migration all keys are in vars/per-machine/, not
host-keys/. Update:
- File header: "existing clan var is never overwritten" (not host-keys/ file)
- Header --remove/--regenerate description: mention clan vars as primary
- usage() --remove, --regenerate-all-keys, --dry-run text
- cmd_remove/cmd_regenerate_all empty-guard messages
- README.md vars/per-machine/ row: "all deployed hosts" (not "LXC hosts")

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B2EJ4qTsM5KUqhS5c3GAwx
This commit is contained in:
2026-07-26 00:11:03 +10:00
co-authored by Claude Sonnet 4.6
parent adaf53d647
commit b5f749daa9
2 changed files with 17 additions and 17 deletions
+1 -1
View File
@@ -73,7 +73,7 @@ nix eval --json .#nixosConfigurations --apply builtins.attrNames | jq -r '.[]'
| `modules/nix-cache/` | Binary cache and remote builder client/server modules | | `modules/nix-cache/` | Binary cache and remote builder client/server modules |
| `modules/installer/` | Auto-installer environment (ISO, also served as PXE netboot) — see `docs/auto-installer.md` | | `modules/installer/` | Auto-installer environment (ISO, also served as PXE netboot) — see `docs/auto-installer.md` |
| `host-keys/` | Gitignored; only used by the auto-installer environment for pre-seeding SSH host keys before first boot — see `docs/auto-installer.md`. All deployed hosts use clan vars (`vars/per-machine/<target>/openssh/`) instead | | `host-keys/` | Gitignored; only used by the auto-installer environment for pre-seeding SSH host keys before first boot — see `docs/auto-installer.md`. All deployed hosts use clan vars (`vars/per-machine/<target>/openssh/`) instead |
| `vars/per-machine/` | Clan vars: committed, sops-encrypted SSH host keys for deployed LXC hosts; read by `create-proxmox-resource.sh` at deploy time | | `vars/per-machine/` | Clan vars: committed, sops-encrypted SSH host keys for all deployed hosts; read by `create-proxmox-resource.sh` at deploy time |
| `docs/` | Operational notes for cache, builders, lock updates, boot services, the auto-installer, and Proxmox image builds | | `docs/` | Operational notes for cache, builders, lock updates, boot services, the auto-installer, and Proxmox image builds |
| `scripts/` | Codex setup, validation, host-key, release-bump, and Proxmox resource helpers | | `scripts/` | Codex setup, validation, host-key, release-bump, and Proxmox resource helpers |
+16 -16
View File
@@ -11,17 +11,16 @@
# sync-host-keys.sh --regenerate-all-keys Remove and freshly regenerate # sync-host-keys.sh --regenerate-all-keys Remove and freshly regenerate
# every locally-managed key. # every locally-managed key.
# #
# "Generate/register" is idempotent and additive only: an existing # "Generate/register" is idempotent and additive only: an existing clan
# host-keys/ file is never touched, and .sops.yaml only ever gains an # var is never overwritten, and .sops.yaml only ever gains an anchor/alias
# anchor/alias it doesn't already have -- safe to re-run any time, e.g. # it doesn't already have -- safe to re-run any time, e.g. right after
# right after adding a new host to flake.nix. # adding a new host to flake.nix.
# #
# --remove and --regenerate-all-keys only ever operate on anchors that have # --remove and --regenerate-all-keys only ever operate on anchors that
# a corresponding host-keys/<name>_ssh_host_ed25519_key file. Anchors # have a corresponding clan var (vars/per-machine/<name>/openssh/) or
# without one (&admin, and any anchor for an already-deployed host whose # host-keys/ file. Anchors without either (&admin) are never listed,
# real /etc/ssh key was registered by hand, e.g. &docker/&server/&nix-cache # removed, or regenerated -- this tooling only ever touches keys it itself
# today) are never listed, removed, or regenerated -- this tooling only # manages.
# ever touches keys it itself manages.
set -euo pipefail set -euo pipefail
repo_root="$(cd "$(dirname "$0")/../.." && pwd)" repo_root="$(cd "$(dirname "$0")/../.." && pwd)"
@@ -56,13 +55,14 @@ Usage: $0 --all [--dry-run]
<flake-target> Same, for just one target (e.g. lxc-server). <flake-target> Same, for just one target (e.g. lxc-server).
Reports if it already has one. Reports if it already has one.
--remove Interactively pick one locally-managed key to --remove Interactively pick one locally-managed key to
remove from .sops.yaml and host-keys/. remove from .sops.yaml and vars/per-machine/
(or host-keys/ for legacy keys).
--regenerate-all-keys Remove every locally-managed key and generate --regenerate-all-keys Remove every locally-managed key and generate
fresh replacements for every current flake fresh clan-var replacements for every current
target. Destructive -- requires typed flake target. Destructive -- requires typed
confirmation. confirmation.
--dry-run Combine with any of the above: print what would --dry-run Combine with any of the above: print what would
change (host-keys/ files, .sops.yaml anchors and change (clan vars, .sops.yaml anchors and
key_groups, which secrets/*.yaml would be key_groups, which secrets/*.yaml would be
re-encrypted) without touching anything. No keys re-encrypted) without touching anything. No keys
generated, no files written, no sops calls, generated, no files written, no sops calls,
@@ -315,7 +315,7 @@ cmd_remove() {
local hosts local hosts
mapfile -t hosts < <(locally_managed_hosts) mapfile -t hosts < <(locally_managed_hosts)
if [[ "${#hosts[@]}" -eq 0 ]]; then if [[ "${#hosts[@]}" -eq 0 ]]; then
echo "No locally-managed keys in host-keys/ -- nothing to remove." echo "No locally-managed keys found (checked host-keys/ and vars/per-machine/) -- nothing to remove."
return return
fi fi
@@ -372,7 +372,7 @@ cmd_regenerate_all() {
local hosts local hosts
mapfile -t hosts < <(locally_managed_hosts) mapfile -t hosts < <(locally_managed_hosts)
if [[ "${#hosts[@]}" -eq 0 ]]; then if [[ "${#hosts[@]}" -eq 0 ]]; then
echo "No locally-managed keys in host-keys/ -- nothing to regenerate." echo "No locally-managed keys found (checked host-keys/ and vars/per-machine/) -- nothing to regenerate."
return return
fi fi