Created
October 17, 2013 07:40
-
-
Save SylvainJuge/7020697 to your computer and use it in GitHub Desktop.
simple "ssh audit" to see ssh keys fingerprints authorized on multiple servers at once usage : sshaudit server1 server2
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
# ssh "audit" : see who accesses what | |
sshaudit (){ | |
for server in "$@"; do | |
ssh $server -C 'cat ~/.ssh/authorized_keys' | sort | while read line; do | |
tmp="$(mktemp)" | |
echo "$line" > "$tmp" | |
echo $server $(ssh-keygen -lf "$tmp" | cut -d ' ' -f2,4) | |
rm -f "$tmp" | |
done | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment