Skip to content

Instantly share code, notes, and snippets.

@jwalterclark
jwalterclark / lpass-pull-ssh-keys.sh
Created January 27, 2019 21:10
Basic alternative to LastPass-SSH
#!/usr/bin/env bash
lpass ls "Secure Notes\\SSH" | tail -n +2 | while read line; do
name=$(sed 's/^[^\/]*\/\(.*\) \[id: [0-9]*\]$/\1/' <<< $line)
id=$(sed 's/^[^\/]*\/.* \[id: \([0-9]*\)\]$/\1/' <<< $line)
lpass show --field 'Private Key' $id > $HOME"/.ssh/"$name
chmod 600 $HOME"/.ssh/"$name
lpass show --field 'Public Key' $id > $HOME"/.ssh/"$name".pub"
done

Keybase proof

I hereby claim:

  • I am jwalterclark on github.
  • I am jwalterclark (https://keybase.io/jwalterclark) on keybase.
  • I have a public key whose fingerprint is 4C57 3A5C D83B AF3B EC22 DE88 F0EA D201 7643 6662

To claim this, I am signing this object: