summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2021-10-10 05:27:16 -0400
committerAndrew Cady <d@jerkface.net>2021-10-10 05:27:16 -0400
commit015ec452bf5eaf2c56d9f311634d19b09f158269 (patch)
treedaa918b3f49fb810104828b2d749b3f7146271bd
parent023d70d8eede8754eb4bf8e9d363dc7055ad2841 (diff)
get-host-keys: now modifies the real UserKnownHostsFile
-rwxr-xr-xget-host-keys25
1 files 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
77 dnsname_to_openssh_knownhost "${host##*@}" >> ssh_known_hosts || die "could not validate hostname cryptographically" 77 dnsname_to_openssh_knownhost "${host##*@}" >> ssh_known_hosts || die "could not validate hostname cryptographically"
78fi 78fi
79 79
80ssh \ 80modify_known_hosts=y
81 -F /dev/null \ 81
82 -o GlobalKnownHostsFile=$PWD/ssh_known_hosts \ 82set -- ssh
83 -o UserKnownHostsFile=$PWD/ssh_known_hosts \ 83if [ ! "$modify_known_hosts" ]
84 -o UpdateHostKeys=yes \ 84then
85 -o PasswordAuthentication=no \ 85 set -- "$@" -F /dev/null
86 -o StrictHostKeyChecking=yes \ 86 set -- "$@" -o GlobalKnownHostsFile=$PWD/ssh_known_hosts
87 -n -T \ 87 set -- "$@" -o UserKnownHostsFile=$PWD/ssh_known_hosts
88 "$host" >/dev/null 2>&1 || true 88fi
89set -- "$@" -o UpdateHostKeys=yes
90set -- "$@" -o PasswordAuthentication=no
91set -- "$@" -o StrictHostKeyChecking=yes
92set -- "$@" -n -T
93set -- "$@" "$host"
94
95"$@" || true
89 96
90if test -t 1 97if test -t 1
91then 98then