install.fairie/dotfiles/.local/share/chezmoi/home/dot_ssh/create_encrypted_private_readonly_private_id_rsa.tmpl

11 lines
580 B
Cheetah
Raw Normal View History

{{- if ( bitwarden "item" "dev.betelgeuse.ssh.personal.id_rsa.private" ).notes -}}
{{- ( 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" }}
{{- writeToStdout "Generated new SSH key since none were present and could not connect to BitWarden. It will be encrypted and included in your source." -}}
{{- end -}}
{{- include $sshLocation }}
{{ end }}