summaryrefslogtreecommitdiff
path: root/sshconnect2.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2020-12-22 00:15:22 +0000
committerDamien Miller <djm@mindrot.org>2020-12-22 15:43:59 +1100
commitda4bf0db942b5f0278f33238b86235e5813d7a5a (patch)
treed0260f5cd38d2fb4263aeca21a89be38afbba9b4 /sshconnect2.c
parenta34e14a5a0071de2036826a00197ce38c8b4ba8b (diff)
downloadopenssh-git-da4bf0db942b5f0278f33238b86235e5813d7a5a.tar.gz
upstream: add a ssh_config KnownHostsCommand that allows the client
to obtain known_hosts data from a command in addition to the usual files. The command accepts bunch of %-expansions, including details of the connection and the offered server host key. Note that the command may be invoked up to three times per connection (see the manpage for details). ok markus@ OpenBSD-Commit-ID: 2433cff4fb323918ae968da6ff38feb99b4d33d0
Diffstat (limited to 'sshconnect2.c')
-rw-r--r--sshconnect2.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sshconnect2.c b/sshconnect2.c
index 4460bca8..95813b9b 100644
--- a/sshconnect2.c
+++ b/sshconnect2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshconnect2.c,v 1.338 2020/12/20 23:40:19 djm Exp $ */
+/* $OpenBSD: sshconnect2.c,v 1.339 2020/12/22 00:15:23 djm Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
* Copyright (c) 2008 Damien Miller. All rights reserved.
@@ -137,6 +137,10 @@ order_hostkeyalgs(char *host, struct sockaddr *hostaddr, u_short port,
load_hostkeys(hostkeys, hostname,
options.system_hostfiles[i], 0);
}
+ if (options.known_hosts_command != NULL) {
+ load_hostkeys_command(hostkeys, options.known_hosts_command,
+ "ORDER", cinfo, NULL, host);
+ }
/*
* If a plain public key exists that matches the type of the best
* preference HostkeyAlgorithms, then use the whole list as is.
@@ -198,7 +202,8 @@ order_hostkeyalgs(char *host, struct sockaddr *hostaddr, u_short port,
(*first == '\0' || *last == '\0') ? "" : ",", last);
if (*first != '\0')
debug3_f("prefer hostkeyalgs: %s", first);
-
+ else
+ debug3_f("no algorithms matched; accept original");
out:
free(best);
free(first);