From 3589ae71315755bac837d07e0e7861b211c1d273 Mon Sep 17 00:00:00 2001 From: Stevan Freeborn Date: Tue, 7 Jul 2026 20:10:47 -0500 Subject: [PATCH] chore: update private key setup logic --- .../run_once_setup-ssh-keys.sh.tmpl | 34 ++++--------------- .../run_once_windows_setup-ssh-keys.ps1.tmpl | 29 ++++------------ dot_ssh/tanged.pub | 1 - dot_ssh/tinker.pub | 1 - 4 files changed, 13 insertions(+), 52 deletions(-) delete mode 100644 dot_ssh/tanged.pub delete mode 100644 dot_ssh/tinker.pub diff --git a/.chezmoiscripts/run_once_setup-ssh-keys.sh.tmpl b/.chezmoiscripts/run_once_setup-ssh-keys.sh.tmpl index 402a54a..4d8be86 100644 --- a/.chezmoiscripts/run_once_setup-ssh-keys.sh.tmpl +++ b/.chezmoiscripts/run_once_setup-ssh-keys.sh.tmpl @@ -46,32 +46,12 @@ write_key() { echo " Wrote: $key_path" } -# --- Add your SSH keys below --- -# Format: write_key "filename_in_~/.ssh" "Bitwarden secure note name" -# -# Example: -# write_key "stevan@freeborn.cloud" "SSH Key - stevan@freeborn.cloud" -# write_key "ftp_stevanfreeborn_com" "SSH Key - ftp_stevanfreeborn_com" -# write_key "tangled" "SSH Key - tangled" -# write_key "tinker" "SSH Key - tinker" -# write_key "gitea.freeborn.cloud" "SSH Key - gitea.freeborn.cloud" - -write_key "bit_bastion.key" "SSH Key - bit_bastion.key" -write_key "stevan@freeborn.cloud" "SSH Key - stevan@freeborn.cloud" -write_key "ftp_stevanfreeborn_com" "SSH Key - ftp_stevanfreeborn_com" -write_key "tangled" "SSH Key - tangled" -write_key "zenbook_tinker" "SSH Key - zenbook_tinker" -write_key "gitea.freeborn.cloud" "SSH Key - gitea.freeborn.cloud" -write_key "id_ed25519" "SSH Key - id_ed25519" -write_key "macbookair" "SSH Key - macbookair" -write_key "macbookpro" "SSH Key - macbookpro" -write_key "truenas" "SSH Key - truenas" -write_key "blog.stevanfreeborn.com_github_actions" "SSH Key - blog.stevanfreeborn.com_github_actions" -write_key "commands_github_actions" "SSH Key - commands_github_actions" -write_key "onspring_qa_playwright_reports_render" "SSH Key - onspring_qa_playwright_reports_render" -write_key "onx_graph_github_actions" "SSH Key - onx_graph_github_actions" -write_key "restapiplayground.stevanfreeborn.com_github_actions" "SSH Key - restapiplayground.stevanfreeborn.com_github_actions" -write_key "steves_bot_github_actions" "SSH Key - steves_bot_github_actions" +# Derive private key names from the public key files in dot_ssh/ +CHEZMOI_SOURCE_DIR="{{ .chezmoi.sourceDir }}" +for pub_file in "$CHEZMOI_SOURCE_DIR/dot_ssh"/*.pub; do + [ -f "$pub_file" ] || continue + key_name=$(basename "$pub_file" .pub) + write_key "$key_name" "SSH Key - $key_name" +done echo "==> SSH key setup complete!" -echo " NOTE: Store your SSH private keys as Bitwarden Secure Notes with the names listed above." diff --git a/.chezmoiscripts/run_once_windows_setup-ssh-keys.ps1.tmpl b/.chezmoiscripts/run_once_windows_setup-ssh-keys.ps1.tmpl index ffc3032..d9f08cf 100644 --- a/.chezmoiscripts/run_once_windows_setup-ssh-keys.ps1.tmpl +++ b/.chezmoiscripts/run_once_windows_setup-ssh-keys.ps1.tmpl @@ -41,28 +41,11 @@ function Write-Key($name, $bwItemName) { } } -# --- Add your SSH keys below --- -# Format: Write-Key "filename_in_~/.ssh" "Bitwarden secure note name" -# -# Example: -# Write-Key "stevan@freeborn.cloud" "SSH Key - stevan@freeborn.cloud" - -Write-Key "bit_bastion.key" "SSH Key - bit_bastion.key" -Write-Key "stevan@freeborn.cloud" "SSH Key - stevan@freeborn.cloud" -Write-Key "ftp_stevanfreeborn_com" "SSH Key - ftp_stevanfreeborn_com" -Write-Key "tangled" "SSH Key - tangled" -Write-Key "zenbook_tinker" "SSH Key - zenbook_tinker" -Write-Key "gitea.freeborn.cloud" "SSH Key - gitea.freeborn.cloud" -Write-Key "id_ed25519" "SSH Key - id_ed25519" -Write-Key "macbookair" "SSH Key - macbookair" -Write-Key "macbookpro" "SSH Key - macbookpro" -Write-Key "truenas" "SSH Key - truenas" -Write-Key "blog.stevanfreeborn.com_github_actions" "SSH Key - blog.stevanfreeborn.com_github_actions" -Write-Key "commands_github_actions" "SSH Key - commands_github_actions" -Write-Key "onspring_qa_playwright_reports_render" "SSH Key - onspring_qa_playwright_reports_render" -Write-Key "onx_graph_github_actions" "SSH Key - onx_graph_github_actions" -Write-Key "restapiplayground.stevanfreeborn.com_github_actions" "SSH Key - restapiplayground.stevanfreeborn.com_github_actions" -Write-Key "steves_bot_github_actions" "SSH Key - steves_bot_github_actions" +# Derive private key names from the public key files in dot_ssh/ +$chezmoiSourceDir = "{{ .chezmoi.sourceDir }}" +Get-ChildItem "$chezmoiSourceDir\dot_ssh\*.pub" | ForEach-Object { + $keyName = $_.BaseName + Write-Key $keyName "SSH Key - $keyName" +} Write-Host "==> SSH key setup complete!" -ForegroundColor Cyan -Write-Host " NOTE: Store your SSH private keys as Bitwarden Secure Notes with the names listed above." -ForegroundColor Yellow diff --git a/dot_ssh/tanged.pub b/dot_ssh/tanged.pub deleted file mode 100644 index 70e76a2..0000000 --- a/dot_ssh/tanged.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC9mM9XajMxOdK3Oy4L1qk7VCwnmvplKMqyVNd56JwsG sfree@g9 diff --git a/dot_ssh/tinker.pub b/dot_ssh/tinker.pub deleted file mode 100644 index 076c4c2..0000000 --- a/dot_ssh/tinker.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDEHvnMXdTp6zIOM+uJcmQ/gmyppfSpDLNNX+Rg2gFfZ sfree@g9