Created
February 6, 2018 04:14
-
-
Save rotanid/d7016f9ad6f41007230d4e43eda66bc0 to your computer and use it in GitHub Desktop.
sshd key length checking
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 | |
# generate new rsa host key | |
ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa -b 4096 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment