install.fairie/home/.chezmoiscripts/run_onchanges_after_generate-public-keys.tmpl
Brian Zalewski a2748ba201 Update 20 files
- /home/dot_config/nvim-custom/run_onchanges_after_symlink-custom.tmpl
- /home/dot_local/bin/run_onchange_ensure-executable.tmpl
- /home/dot_local/share/ansible/run_onchange_after_symlink-ansible-configs.tmpl
- /home/Library/Fonts/run_onchange_after_add-fonts.tmpl
- /home/private_dot_ssh/fail2ban/run_onchange_after_fail2ban.tmpl
- /home/private_dot_ssh/system/run_onchange_after_sshd.tmpl
- /home/private_dot_ssh/endlessh/run_onchange_after_endlessh.tmpl
- /home/private_dot_ssh/run_onchanges_after_decrypt-ssh-keys.tmpl
- /home/private_dot_ssh/run_onchanges_after_ensure-private-key.tmpl
- /home/private_dot_ssh/run_onchanges_after_generate-public-keys.tmpl
- /home/.chezmoiscripts/run_onchanges_after_symlink-custom.tmpl
- /home/.chezmoiscripts/run_onchange_ensure-executable.tmpl
- /home/.chezmoiscripts/run_onchange_after_symlink-ansible-configs.tmpl
- /home/.chezmoiscripts/run_onchange_after_add-fonts.tmpl
- /home/.chezmoiscripts/run_onchange_after_fail2ban.tmpl
- /home/.chezmoiscripts/run_onchange_after_sshd.tmpl
- /home/.chezmoiscripts/run_onchange_after_endlessh.tmpl
- /home/.chezmoiscripts/run_onchanges_after_decrypt-ssh-keys.tmpl
- /home/.chezmoiscripts/run_onchanges_after_ensure-private-key.tmpl
- /home/.chezmoiscripts/run_onchanges_after_generate-public-keys.tmpl
2023-04-15 22:16:15 +00:00

21 lines
703 B
Bash

#!/usr/bin/env bash
{{ $sshFiles := (output "find" (joinPath .chezmoi.homeDir ".ssh") "-type" "f") -}}
{{- range $sshFile := splitList "\n" $sshFiles -}}
{{- if ne $sshFile "" -}}
# {{ $sshFile }} hash: {{ $sshFile | sha256sum }}
{{ end -}}
{{- end }}
{{ includeTemplate "universal/profile" }}
{{ includeTemplate "universal/logg" }}
logg info 'Ensuring public keys are present'
find "$HOME/.ssh" -type f -maxdepth 1 ! -name "*.pub" ! -name "authorized_keys*" ! -name "known_host*" ! -name "config" | while read FILE; do
if [ ! -f "${FILE}.pub" ]; then
logg info 'Generating missing public key for `'"$FILE"'`'
ssh-keygen -f "$FILE" -y > "${FILE}.pub"
chmod 600 "${FILE}.pub"
fi
done