]> gitweb.fluxo.info Git - utils-ssh.git/commitdiff
Do not list keys without password at ssh-agent-loadkey
authorSilvio Rhatto <rhatto@riseup.net>
Wed, 27 Mar 2019 00:38:26 +0000 (21:38 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Wed, 27 Mar 2019 00:38:26 +0000 (21:38 -0300)
ssh-agent-loadkey

index b6fefb1f7df02cb2339015b3925a0efa2648490b..840ea827849c815ea2d2c51d24c5576e40e13a66 100755 (executable)
@@ -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
   )
 }