aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2019-03-26 21:38:26 -0300
committerSilvio Rhatto <rhatto@riseup.net>2019-03-26 21:38:26 -0300
commitf0e4160c6c9a5e9e24781e2a7678d487cda69da1 (patch)
tree0c5c634e7415aeb0806cb896a72af2352b955604
parent89b6c7f7795b302884e4056103135bc4f963d81e (diff)
downloadutils-ssh-f0e4160c6c9a5e9e24781e2a7678d487cda69da1.tar.gz
utils-ssh-f0e4160c6c9a5e9e24781e2a7678d487cda69da1.tar.bz2
Do not list keys without password at ssh-agent-loadkey
-rwxr-xr-xssh-agent-loadkey9
1 files changed, 6 insertions, 3 deletions
diff --git a/ssh-agent-loadkey b/ssh-agent-loadkey
index b6fefb1..840ea82 100755
--- a/ssh-agent-loadkey
+++ b/ssh-agent-loadkey
@@ -17,9 +17,12 @@ fi
function __query {
(
cd $KEYS && find -name '*.pub' | sed -e 's/.pub$//' | grep -v decomissioned | while read line; do
- handle="`echo $line | cut -d '/' -f 3`"
- type="`echo $line | cut -d '/' -f 2`"
- echo "$handle ($type)"
+ # See https://security.stackexchange.com/questions/129724/how-to-check-if-an-ssh-private-key-has-passphrase-or-not#129727
+ if grep -q ',ENCRYPTED' $line; then
+ handle="`echo $line | cut -d '/' -f 3`"
+ type="`echo $line | cut -d '/' -f 2`"
+ echo "$handle ($type)"
+ fi
done
)
}