Created
January 27, 2019 21:10
-
-
Save jwalterclark/b35e9fd14604bc68420545c1f3343050 to your computer and use it in GitHub Desktop.
Basic alternative to LastPass-SSH
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment