Add Readme
This commit is contained in:
parent
42f1b3b74b
commit
22cb803624
14
README.md
Normal file
14
README.md
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# Purpose
|
||||||
|
This script allows you to ssh to a server using an SSH Key and passphrase pulled from your lastpass account.
|
||||||
|
|
||||||
|
# Requirements
|
||||||
|
This script requires the `lastpass-cli` and `expect` packages.
|
||||||
|
|
||||||
|
The SSH Key must be stored in your lastpass account, as a Secure Note of the type SSH Key, with the Private Key and Passphrase fields filled out, at a minimum.
|
||||||
|
|
||||||
|
# Usage
|
||||||
|
1. Download the script to a location of your choosing, ensuring it is executable
|
||||||
|
2. run it like this: ```./ssh.sh KEYNAME server-you-wish-to-ssh-to```
|
||||||
|
|
||||||
|
# How it works
|
||||||
|
This script uses the official `lastpass-cli` package to pull the private key to a file and the private key passphrase to a variable. The script then uses that information to ssh to the requested server, and removes the private key when the connection is closed.
|
2
ssh.sh
2
ssh.sh
@ -18,7 +18,7 @@ keyfile=$HOME/.ssh/${keyname}_$(date "+%F-%T")
|
|||||||
fi
|
fi
|
||||||
#}
|
#}
|
||||||
|
|
||||||
#Fetch private key and place in /home/$user/.ssh/$hostname.datetime
|
#Fetch private key and place in /home/$user/.ssh/$keyname_datetime
|
||||||
lpass show $keyname --field="Private Key" > $keyfile
|
lpass show $keyname --field="Private Key" > $keyfile
|
||||||
chmod 0600 $keyfile
|
chmod 0600 $keyfile
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user