better man page

This commit is contained in:
James Tomasino 2019-04-18 18:31:41 -04:00
parent 5ab663f35d
commit 04160565e0
2 changed files with 40 additions and 5 deletions

9
lssh
View File

@ -1,9 +1,5 @@
#!/bin/sh
# ENV Variables Used:
# SSH_KEY_LOCATIONS
# LASTPASS_USER
version="2019.04.18"
arg_options="hv"
key=""
@ -113,6 +109,11 @@ main () {
# lastpass will prompt with pinentry. If no entry found, suppress error.
password=$(lpass show --password "SSH: ${key}" 2> /dev/null)
# If the "SSH: xxx" pattern failed, try the key directly
if [ -n "$password" ]; then
password=$(lpass show --password "${key}" 2> /dev/null)
fi
# If we found a password, apply it to the key
if [ -n "$password" ]; then
# awkward tabbing due to EOF structure

36
lssh.1
View File

@ -4,5 +4,39 @@ lssh \- a wrapper for Lastpass CLI and ssh-agent
.SH SYNOPSIS
lssh [options] [ssh-key]
.SH DESRIPTION
lssh quickly activates ssh-keys by name, filling passwords via Lastpass CLI, and
lssh quickly activates ssh keys by name, filling passwords via Lastpass CLI, and
adding them to ssh-agent. Keys are activated for 1-hour at a time.
The ssh key name provided to
.B lssh
will be used to look up both the key itself and the password for the key. If
that key has a password,
.B lssh
will search Lastpass for an entry named `SSH: [ssh-key]' and autofill the password
with the results. If that entry is not found, `[ssh-key]' will also be attempted
before giving up on a password search. The key will be passed to the ssh-agent
regardless.
.SH OPTIONS
.TP
.B -h
Shows simple help.
.TP
.B -v
Shows current version number.
.SH ENVIRONMENT VARIABLES
.TP
.B SSH_KEY_LOCATIONS
List of folders containing ssh keys.
This environment variable can contain any number of folder paths, space
separated, which will be used to search for the ssh keys. The folders are
searched in order and the search stops at the first successful match.
.TP
.B LASTPASS_USER
Login username to Lastpass. This is used to initiate a login if you are not
already logged in when initiating lssh
.SH EXAMPLES
If you have an ssh key located at ~/.ssh/work/id_rsa, it can be loaded by
entering:
$ lssh work