diff options
author | Andrew Cady <d@jerkface.net> | 2021-10-09 21:51:21 -0400 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2021-10-09 21:54:54 -0400 |
commit | c38fcfab61b2c38bdd2aaac10adbbc23a08cd30d (patch) | |
tree | 6bdc614e8ea3a07818c71d5e8fa981d4d0d22280 | |
parent | 6b20a96c27d91270896625ff5df05602a05ad5ef (diff) |
update-host-keys test/diagnostic program
-rwxr-xr-x | notes/update-host-keys | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/notes/update-host-keys b/notes/update-host-keys new file mode 100755 index 0000000..4ef0e0b --- /dev/null +++ b/notes/update-host-keys | |||
@@ -0,0 +1,26 @@ | |||
1 | #!/bin/sh | ||
2 | set -e | ||
3 | _TEMP_DIR_=$(mktemp -d) | ||
4 | cd "$_TEMP_DIR_" | ||
5 | trap 'rm -rf "$_TEMP_DIR_"' EXIT | ||
6 | host=${1:-borges} | ||
7 | ssh-keygen -F "${host#*@}" | grep -v '^#' > ssh_known_hosts 2>/dev/null | ||
8 | touch ssh_known_hosts.stamp -r ssh_known_hosts | ||
9 | |||
10 | ssh() | ||
11 | { | ||
12 | command ssh \ | ||
13 | -F /dev/null \ | ||
14 | -o GlobalKnownHostsFile=$PWD/ssh_known_hosts \ | ||
15 | -o UserKnownHostsFile=$PWD/ssh_known_hosts \ | ||
16 | -o UpdateHostKeys=yes \ | ||
17 | -o PasswordAuthentication=no \ | ||
18 | -o StrictHostKeyChecking=yes \ | ||
19 | "$@" | ||
20 | } | ||
21 | |||
22 | have=ecdsa-sha2-nistp256 | ||
23 | want=rsa-sha2-256 | ||
24 | ssh -q -n "$host" || true | ||
25 | |||
26 | cat ssh_known_hosts | ||