Skip to content

Instantly share code, notes, and snippets.

View rotanid's full-sized avatar

Andreas Ziegler rotanid

  • Landshut, Germany
View GitHub Profile
#!/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
@rotanid
rotanid / gist:d7016f9ad6f41007230d4e43eda66bc0
Created February 6, 2018 04:14
sshd key length checking
# 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