if LASTPASS_USER env not found, prompt for username

This commit is contained in:
James Tomasino 2019-12-25 16:34:32 +00:00
parent 790fee5e50
commit ae3bb3bb4f
3 changed files with 12 additions and 6 deletions

View File

@ -50,4 +50,4 @@
AUTHOR
James Tomasino
version 2019.04.18 18 Apr 2019 LSSH(1)
version 2019.12.25 25 Dec 2019 LSSH(1)

14
lssh
View File

@ -1,6 +1,6 @@
#!/bin/sh
version="2019.04.22"
version="2019.12.25"
arg_options="hv"
key=""
@ -105,9 +105,15 @@ main () {
fi
# If not logged into lastpass, do so now
if ! lpass status -q; then
lpass login --trust "${LASTPASS_USER}"
fi
while ! lpass status -q; do
if [ -z "${LASTPASS_USER}" ]; then
printf "Lastpass Username: "
read -r lpass_user
lpass login --trust "${lpass_user}"
else
lpass login --trust "${LASTPASS_USER}"
fi
done
# Retrieve key from LastPass. If logged in but not recently authenticated
# lastpass will prompt with pinentry. If no entry found, suppress error.

2
lssh.1
View File

@ -1,4 +1,4 @@
.TH LSSH 1 "22 Apr 2019" "version 2019.04.22"
.TH LSSH 1 "25 Dec 2019" "version 2019.12.25"
.SH NAME
lssh \- a wrapper for Lastpass CLI and ssh-agent
.SH SYNOPSIS