From 8a26e2921808be239fcd977a755514a362584c0f Mon Sep 17 00:00:00 2001 From: Scott Wallace Date: Thu, 18 Feb 2016 08:20:25 +0000 Subject: [PATCH] Fallback to reading the password from the commandline. --- .bashrc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.bashrc b/.bashrc index a3734c3..0a15b4a 100644 --- a/.bashrc +++ b/.bashrc @@ -15,7 +15,12 @@ getkey() { KEYFILE=~/.keys/${1} 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 else echo "No such key" >&2