Created
October 10, 2018 05:48
-
-
Save tresni/66576b47eaafa6c6f9b27a358ca7cfb5 to your computer and use it in GitHub Desktop.
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/sh | |
reset_host() { | |
all="$1 $(dig +short $1) $(dig +short aaaa $1)" | |
for ident in $all | |
do | |
ssh-keygen -f ~/.ssh/known_hosts -R $ident | |
ssh-keyscan $ident >>~/.ssh/known_hosts | |
done | |
} | |
if [ $# -ne 1 ]; then | |
while read line; do | |
reset_host $line | |
done; | |
else | |
for h; do | |
reset_host $h | |
done | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment