Fallback to reading the password from the commandline.

This commit is contained in:
Scott Wallace 2016-02-18 08:20:25 +00:00
parent c22fa4760b
commit 8a26e29218

View file

@ -15,7 +15,12 @@ getkey() {
KEYFILE=~/.keys/${1} KEYFILE=~/.keys/${1}
if [ -f ${KEYFILE} ]; then if [ -f ${KEYFILE} ]; then
PASS=$(security find-internet-password -l ssh:scott@wallace.sh -gw) if [ -x /usr/bin/security ]; then
PASS=$(/usr/bin/security find-internet-password -l ssh:scott@wallace.sh -gw)
else
read -sp "Password: " PASS
fi
openssl rsautl -decrypt -inkey ~/.ssh/scott@wallace.sh -passin "pass:${PASS}" -in ${KEYFILE} 2>/dev/null openssl rsautl -decrypt -inkey ~/.ssh/scott@wallace.sh -passin "pass:${PASS}" -in ${KEYFILE} 2>/dev/null
else else
echo "No such key" >&2 echo "No such key" >&2