Created
August 17, 2010 11:04
-
-
Save mschmitt/529388 to your computer and use it in GitHub Desktop.
Script for identifying SSH keys without passphrase
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
umask 077 | |
if [ "XX$1" == "XX" ] | |
then | |
echo "No file specified." | |
exit 1 | |
fi | |
if [ ! -e $1 ] | |
then | |
echo "File not found: $1" | |
exit 1 | |
fi | |
KEYFILE=$1 | |
TEMPFILE=$(mktemp) | |
cp $KEYFILE $TEMPFILE | |
ssh-keygen -p -P '' -N 123456789 -f $TEMPFILE >/dev/null 2>/dev/null | |
if [ $? -eq 0 ] | |
then | |
echo "$KEYFILE - contains an unprotected OpenSSH key" | |
else | |
echo "$KEYFILE - does not contain an unprotected OpenSSH key" | |
fi | |
rm $TEMPFILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment