From d6b2832134facac013cdb7accbba29d3a7123b9b Mon Sep 17 00:00:00 2001 From: Brian Zalewski Date: Fri, 2 Dec 2022 04:30:27 +0000 Subject: [PATCH] Update .local/share/chezmoi/home/dot_ssh/run_after_ensure-private-key, .local/share/chezmoi/home/dot_ssh/symlink_authorized_keys.tmpl, .local/share/chezmoi/home/.chezmoiscripts/darwin/run_onchange_after_10_configure-macos.tmpl Deleted .local/share/chezmoi/home/dot_ssh/create_private_readonly_private_id_rsa.tmpl --- .../darwin/run_onchange_after_10_configure-macos.tmpl | 4 ++-- .../create_private_readonly_private_id_rsa.tmpl | 10 ---------- .../chezmoi/home/dot_ssh/run_after_ensure-private-key | 7 +++++++ .../chezmoi/home/dot_ssh/symlink_authorized_keys.tmpl | 3 +++ 4 files changed, 12 insertions(+), 12 deletions(-) delete mode 100644 .local/share/chezmoi/home/dot_ssh/create_private_readonly_private_id_rsa.tmpl create mode 100644 .local/share/chezmoi/home/dot_ssh/run_after_ensure-private-key create mode 100644 .local/share/chezmoi/home/dot_ssh/symlink_authorized_keys.tmpl diff --git a/.local/share/chezmoi/home/.chezmoiscripts/darwin/run_onchange_after_10_configure-macos.tmpl b/.local/share/chezmoi/home/.chezmoiscripts/darwin/run_onchange_after_10_configure-macos.tmpl index 7cd80672..df3bad98 100644 --- a/.local/share/chezmoi/home/.chezmoiscripts/darwin/run_onchange_after_10_configure-macos.tmpl +++ b/.local/share/chezmoi/home/.chezmoiscripts/darwin/run_onchange_after_10_configure-macos.tmpl @@ -2,8 +2,8 @@ set -x -{{- includeTemplate "universal/profile" }} -{{- includeTemplate "universal/logg" }} +{{ includeTemplate "universal/profile" }} +{{ includeTemplate "universal/logg" }} logg 'Applying optimized macOS settings' diff --git a/.local/share/chezmoi/home/dot_ssh/create_private_readonly_private_id_rsa.tmpl b/.local/share/chezmoi/home/dot_ssh/create_private_readonly_private_id_rsa.tmpl deleted file mode 100644 index 91a55438..00000000 --- a/.local/share/chezmoi/home/dot_ssh/create_private_readonly_private_id_rsa.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -{{- $bwAuthenticated := eq (fromJson (output "bw" "status")).status "authenticated" }} -{{- if $bwAuthenticated -}} -{{- (bitwarden "item" "dev.betelgeuse.ssh.personal.id_rsa.private").notes -}} -{{- else -}} -{{- $sshLocation := (joinPath .chezmoi.homeDir ".ssh" "id_rsa") -}} -{{- if not (stat $sshLocation) -}} -{{- $sshKeygen := (output "ssh-keygen" "-b" "4096" "-t" "rsa" "-f" $sshLocation "-q" "-N") }} -{{- end -}} -{{- include $sshLocation }} -{{ end }} diff --git a/.local/share/chezmoi/home/dot_ssh/run_after_ensure-private-key b/.local/share/chezmoi/home/dot_ssh/run_after_ensure-private-key new file mode 100644 index 00000000..e9144c8a --- /dev/null +++ b/.local/share/chezmoi/home/dot_ssh/run_after_ensure-private-key @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +### Ensure id_rsa is present and create one if it does not exist +if [ ! -f "$HOME/.ssh/id_rsa" ]; then + logg 'Generating missing default private key / public key (`~/.ssh/id_rsa`)' + ssh-keygen -b 4096 -t rsa -f "$HOME/.ssh/id_rsa" -q -N +fi diff --git a/.local/share/chezmoi/home/dot_ssh/symlink_authorized_keys.tmpl b/.local/share/chezmoi/home/dot_ssh/symlink_authorized_keys.tmpl new file mode 100644 index 00000000..da9cf109 --- /dev/null +++ b/.local/share/chezmoi/home/dot_ssh/symlink_authorized_keys.tmpl @@ -0,0 +1,3 @@ +{{- if true -}} +{{ .host.home }}/.ssh/authorized_keys.github +{{- end -}}