summaryrefslogtreecommitdiff
path: root/remove-known-host.sh
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2017-12-13 00:16:24 +0100
committerChristian Pointner <equinox@spreadspace.org>2017-12-13 00:16:24 +0100
commit66de6e08c414ada9111d8241a6ef5d844c3527bf (patch)
treee0eff089137c8071dd01c7cbeee96f54ebb728bb /remove-known-host.sh
parentlimit tftp server to vm bridge (diff)
added workaround for new key detection
Diffstat (limited to 'remove-known-host.sh')
-rwxr-xr-xremove-known-host.sh18
1 files changed, 2 insertions, 16 deletions
diff --git a/remove-known-host.sh b/remove-known-host.sh
index d681f0e6..d2c8b8d5 100755
--- a/remove-known-host.sh
+++ b/remove-known-host.sh
@@ -5,24 +5,10 @@ if [ -z "$1" ]; then
exit 1
fi
-TMP=`host -t A "$1" | grep -v "has no"`
-IP=`echo "$TMP" | awk '{ print($4) }'`
-HOST=`echo "$TMP" | awk '{ print($1) }'`
-
-TMP=`host -t AAAA "$1" | grep -v "has no"`
-IP6=`echo "$TMP" | awk '{ print($5) }'`
-HOST6=`echo "$TMP" | awk '{ print($1) }'`
-
-if [ "$HOST6" = "$HOST" ]; then
- HOST6=""
-fi
SHORT="$1"
-if [ "$SHORT" = "$HOST" ] || [ "$SHORT" == "$HOST6" ]; then
- SHORT=""
-fi
-
+SSH_HOST=$(ssh -G "$1" | grep "^hostname " | awk '{ print($2) }' )
-for name in $IP $IP6 $HOST $HOST6 $SHORT; do
+for name in $SHORT $SSH_HOST; do
ssh-keygen -f "$HOME/.ssh/known_hosts" -R "$name"
done