diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2024-04-30 02:10:50 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2024-04-30 02:10:50 +0000 |
commit | 4d36818f089a1134a312900559baac501284a361 (patch) | |
tree | 2c079489eb28b70f08fc7f1911395ea01155f6e0 /usr.bin/ssh/clientloop.c | |
parent | dbe891d253b9089861b974c5a1ff80c442713cd5 (diff) |
add explict check for server hostkey type against HostkeyAlgorithms.
Allows HostkeyAlgorithms to disable implicit fallback from certificate
keys to plain keys. ok markus@
Diffstat (limited to 'usr.bin/ssh/clientloop.c')
-rw-r--r-- | usr.bin/ssh/clientloop.c | 23 |
1 files changed, 2 insertions, 21 deletions
diff --git a/usr.bin/ssh/clientloop.c b/usr.bin/ssh/clientloop.c index 31eaa9500f1..c4b37a7a4db 100644 --- a/usr.bin/ssh/clientloop.c +++ b/usr.bin/ssh/clientloop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clientloop.c,v 1.403 2024/02/21 05:57:34 djm Exp $ */ +/* $OpenBSD: clientloop.c,v 1.404 2024/04/30 02:10:49 djm Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -2427,25 +2427,6 @@ client_global_hostkeys_prove_confirm(struct ssh *ssh, int type, } /* - * Returns non-zero if the key is accepted by HostkeyAlgorithms. - * Made slightly less trivial by the multiple RSA signature algorithm names. - */ -static int -key_accepted_by_hostkeyalgs(const struct sshkey *key) -{ - const char *ktype = sshkey_ssh_name(key); - const char *hostkeyalgs = options.hostkeyalgorithms; - - if (key->type == KEY_UNSPEC) - return 0; - if (key->type == KEY_RSA && - (match_pattern_list("rsa-sha2-256", hostkeyalgs, 0) == 1 || - match_pattern_list("rsa-sha2-512", hostkeyalgs, 0) == 1)) - return 1; - return match_pattern_list(ktype, hostkeyalgs, 0) == 1; -} - -/* * Handle hostkeys-00@openssh.com global request to inform the client of all * the server's hostkeys. The keys are checked against the user's * HostkeyAlgorithms preference before they are accepted. @@ -2489,7 +2470,7 @@ client_input_hostkeys(struct ssh *ssh) debug3_f("received %s key %s", sshkey_type(key), fp); free(fp); - if (!key_accepted_by_hostkeyalgs(key)) { + if (!hostkey_accepted_by_hostkeyalgs(key)) { debug3_f("%s key not permitted by " "HostkeyAlgorithms", sshkey_ssh_name(key)); continue; |