diff options
author | Andrew Cady <d@jerkface.net> | 2021-10-10 05:27:16 -0400 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2021-10-10 05:27:16 -0400 |
commit | 015ec452bf5eaf2c56d9f311634d19b09f158269 (patch) | |
tree | daa918b3f49fb810104828b2d749b3f7146271bd | |
parent | 023d70d8eede8754eb4bf8e9d363dc7055ad2841 (diff) |
get-host-keys: now modifies the real UserKnownHostsFile
-rwxr-xr-x | get-host-keys | 25 |
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" |
78 | fi | 78 | fi |
79 | 79 | ||
80 | ssh \ | 80 | modify_known_hosts=y |
81 | -F /dev/null \ | 81 | |
82 | -o GlobalKnownHostsFile=$PWD/ssh_known_hosts \ | 82 | set -- ssh |
83 | -o UserKnownHostsFile=$PWD/ssh_known_hosts \ | 83 | if [ ! "$modify_known_hosts" ] |
84 | -o UpdateHostKeys=yes \ | 84 | then |
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 | 88 | fi |
89 | set -- "$@" -o UpdateHostKeys=yes | ||
90 | set -- "$@" -o PasswordAuthentication=no | ||
91 | set -- "$@" -o StrictHostKeyChecking=yes | ||
92 | set -- "$@" -n -T | ||
93 | set -- "$@" "$host" | ||
94 | |||
95 | "$@" || true | ||
89 | 96 | ||
90 | if test -t 1 | 97 | if test -t 1 |
91 | then | 98 | then |