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

10 lines
453 B
Cheetah

{{- $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 }}