Skip to content

Instantly share code, notes, and snippets.

@cjshearer
Last active January 15, 2024 21:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cjshearer/9676d67dfd1d758cf05c64f4cfdcaa35 to your computer and use it in GitHub Desktop.
Save cjshearer/9676d67dfd1d758cf05c64f4cfdcaa35 to your computer and use it in GitHub Desktop.
Generate encrypted SSH key with SOPS and age
version: "3"
gen-key:
desc: Generate encrypted ssh key
silent: true
status:
- test -f ssh.sops.key
cmds:
- mkfifo key key.pub
- defer: rm key key.pub
- cat key | sops -e /dev/stdin > ssh.sops.key &
- 'printf "Your public key:\n$(cat key.pub)\n" &'
- yes | ssh-keygen -t ed25519 -f key > /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment