From 015ec452bf5eaf2c56d9f311634d19b09f158269 Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Sun, 10 Oct 2021 05:27:16 -0400 Subject: get-host-keys: now modifies the real UserKnownHostsFile --- get-host-keys | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/get-host-keys b/get-host-keys index e67830d..896d983 100755 --- a/get-host-keys +++ b/get-host-keys @@ -77,15 +77,22 @@ else dnsname_to_openssh_knownhost "${host##*@}" >> ssh_known_hosts || die "could not validate hostname cryptographically" fi -ssh \ - -F /dev/null \ - -o GlobalKnownHostsFile=$PWD/ssh_known_hosts \ - -o UserKnownHostsFile=$PWD/ssh_known_hosts \ - -o UpdateHostKeys=yes \ - -o PasswordAuthentication=no \ - -o StrictHostKeyChecking=yes \ - -n -T \ - "$host" >/dev/null 2>&1 || true +modify_known_hosts=y + +set -- ssh +if [ ! "$modify_known_hosts" ] +then + set -- "$@" -F /dev/null + set -- "$@" -o GlobalKnownHostsFile=$PWD/ssh_known_hosts + set -- "$@" -o UserKnownHostsFile=$PWD/ssh_known_hosts +fi +set -- "$@" -o UpdateHostKeys=yes +set -- "$@" -o PasswordAuthentication=no +set -- "$@" -o StrictHostKeyChecking=yes +set -- "$@" -n -T +set -- "$@" "$host" + +"$@" || true if test -t 1 then -- cgit v1.2.3