diff options
author | Christian Pointner <equinox@spreadspace.org> | 2020-05-23 07:50:16 +0200 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2020-05-25 00:04:27 +0200 |
commit | 2a442070a042e2e27a64a6c4119df7a7fd635798 (patch) | |
tree | 863245e72fb011ea375c4230a341e947d9bce900 /remove-known-host.sh | |
parent | major revamp for zfs based vm images (diff) |
sk-tomnext and both VMs running on it are finally done
Diffstat (limited to 'remove-known-host.sh')
-rwxr-xr-x | remove-known-host.sh | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/remove-known-host.sh b/remove-known-host.sh index aab40144..647909ea 100755 --- a/remove-known-host.sh +++ b/remove-known-host.sh @@ -11,13 +11,19 @@ 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 -ansible_variable__get host_domain "$short" || exit 1 - +names+=("$host_name") +ansible_variable__get host_domain "$short" > /dev/null 2>&1 && names+=("$host_name.$host_domain") -for name in "$short" "$ssh_host" "$ssh_host:$ssh_port" "[$ssh_host]:$ssh_port" "$host_name" "$host_name.$host_domain"; do +for name in ${names[@]} ; do ssh-keygen -f "$known_hosts_file" -R "$name" done |