diff options
Diffstat (limited to 'remove-known-host.sh')
-rwxr-xr-x | remove-known-host.sh | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/remove-known-host.sh b/remove-known-host.sh index 647909ea..9035935e 100755 --- a/remove-known-host.sh +++ b/remove-known-host.sh @@ -5,26 +5,8 @@ if [ -z "$1" ]; then exit 1 fi -short="$1" -ssh_host=$(ssh -G "$short" | grep "^hostname " | awk '{ print($2) }' ) -ssh_port=$(ssh -G "$short" | grep "^port " | awk '{ print($2) }' ) -known_hosts_file=$(ssh -G "$short" | grep "^userknownhostsfile " | awk '{ print($2) }' ) -known_hosts_file=${known_hosts_file/#\~/$HOME} - -declare -a names -names+=("$short") -names+=("$ssh_host") -names+=("$ssh_host:$ssh_port") -names+=("[$ssh_host]:$ssh_port") - cd "${BASH_SOURCE%/*}" source common/utils.sh -ansible_variable__get host_name "$short" || exit 1 -names+=("$host_name") -ansible_variable__get host_domain "$short" > /dev/null 2>&1 && names+=("$host_name.$host_domain") - -for name in ${names[@]} ; do - ssh-keygen -f "$known_hosts_file" -R "$name" -done +remove_known_hosts "$1" exit 0 |