This file contains 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 | |
if [ "$#" -ne 2 ]; then | |
echo "Usage: $0 hostfile cmdfile" | |
echo " hostfile contains a list of hostnames or IP addresses" | |
echo " cmdfile contains a list of commands that should be run on the hosts" | |
exit 1 | |
fi | |
HOSTLIST="$1" | |
CMDLIST="$2" | |
if [ ! -e "$HOSTLIST" ] || [ ! "$(wc -l < $HOSTLIST)" -ge 1 ]; then |
This file contains 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
# check authorized keys | |
while read line; do if [ "$(echo $line | wc -c)" -gt 20 ]; then echo $line > /tmp/key; ssh-keygen -l -f /tmp/key; else continue; fi; done < .ssh/authorized_keys ; rm /tmp/key >/dev/null | |
# check local keys | |
for i in .ssh/*.pub; do ssh-keygen -l -f $i; done | |
# check sshd host keys | |
for i in /etc/ssh/*.pub; do ssh-keygen -l -f $i; done | |