summaryrefslogtreecommitdiff
path: root/readconf.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2018-07-04 13:49:31 +0000
committerDamien Miller <djm@mindrot.org>2018-07-04 23:51:52 +1000
commit312d2f2861a2598ed08587cb6c45c0e98a85408f (patch)
treee3bdc4facef48a89cd76fa793d9e70211b7ff8d2 /readconf.c
parent303af5803bd74bf05d375c04e1a83b40c30b2be5 (diff)
upstream: repair PubkeyAcceptedKeyTypes (and friends) after RSA
signature work - returns ability to add/remove/specify algorithms by wildcard. Algorithm lists are now fully expanded when the server/client configs are finalised, so errors are reported early and the config dumps (e.g. "ssh -G ...") now list the actual algorithms selected. Clarify that, while wildcards are accepted in algorithm lists, they aren't full pattern-lists that support negation. (lots of) feedback, ok markus@ OpenBSD-Commit-ID: a8894c5c81f399a002f02ff4fe6b4fa46b1f3207
Diffstat (limited to 'readconf.c')
-rw-r--r--readconf.c38
1 files changed, 28 insertions, 10 deletions
diff --git a/readconf.c b/readconf.c
index 8d2029547..2bc27075f 100644
--- a/readconf.c
+++ b/readconf.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: readconf.c,v 1.291 2018/06/10 23:45:41 djm Exp $ */ 1/* $OpenBSD: readconf.c,v 1.292 2018/07/04 13:49:31 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1936,6 +1936,8 @@ fill_default_options_for_canonicalization(Options *options)
1936void 1936void
1937fill_default_options(Options * options) 1937fill_default_options(Options * options)
1938{ 1938{
1939 char *all_cipher, *all_mac, *all_kex, *all_key;
1940
1939 if (options->forward_agent == -1) 1941 if (options->forward_agent == -1)
1940 options->forward_agent = 0; 1942 options->forward_agent = 0;
1941 if (options->forward_x11 == -1) 1943 if (options->forward_x11 == -1)
@@ -2082,14 +2084,27 @@ fill_default_options(Options * options)
2082 options->fingerprint_hash = SSH_FP_HASH_DEFAULT; 2084 options->fingerprint_hash = SSH_FP_HASH_DEFAULT;
2083 if (options->update_hostkeys == -1) 2085 if (options->update_hostkeys == -1)
2084 options->update_hostkeys = 0; 2086 options->update_hostkeys = 0;
2085 if (kex_assemble_names(KEX_CLIENT_ENCRYPT, &options->ciphers) != 0 || 2087
2086 kex_assemble_names(KEX_CLIENT_MAC, &options->macs) != 0 || 2088 /* Expand KEX name lists */
2087 kex_assemble_names(KEX_CLIENT_KEX, &options->kex_algorithms) != 0 || 2089 all_cipher = cipher_alg_list(',', 0);
2088 kex_assemble_names(KEX_DEFAULT_PK_ALG, 2090 all_mac = mac_alg_list(',');
2089 &options->hostbased_key_types) != 0 || 2091 all_kex = kex_alg_list(',');
2090 kex_assemble_names(KEX_DEFAULT_PK_ALG, 2092 all_key = sshkey_alg_list(0, 0, 1, ',');
2091 &options->pubkey_key_types) != 0) 2093 if (kex_assemble_names(&options->ciphers,
2094 KEX_CLIENT_ENCRYPT, all_cipher) != 0 ||
2095 kex_assemble_names(&options->macs,
2096 KEX_CLIENT_MAC, all_mac) != 0 ||
2097 kex_assemble_names(&options->kex_algorithms,
2098 KEX_CLIENT_KEX, all_kex) != 0 ||
2099 kex_assemble_names(&options->hostbased_key_types,
2100 KEX_DEFAULT_PK_ALG, all_key) != 0 ||
2101 kex_assemble_names(&options->pubkey_key_types,
2102 KEX_DEFAULT_PK_ALG, all_key) != 0)
2092 fatal("%s: kex_assemble_names failed", __func__); 2103 fatal("%s: kex_assemble_names failed", __func__);
2104 free(all_cipher);
2105 free(all_mac);
2106 free(all_kex);
2107 free(all_key);
2093 2108
2094#define CLEAR_ON_NONE(v) \ 2109#define CLEAR_ON_NONE(v) \
2095 do { \ 2110 do { \
@@ -2537,11 +2552,14 @@ void
2537dump_client_config(Options *o, const char *host) 2552dump_client_config(Options *o, const char *host)
2538{ 2553{
2539 int i; 2554 int i;
2540 char buf[8]; 2555 char buf[8], *all_key;
2541 2556
2542 /* This is normally prepared in ssh_kex2 */ 2557 /* This is normally prepared in ssh_kex2 */
2543 if (kex_assemble_names(KEX_DEFAULT_PK_ALG, &o->hostkeyalgorithms) != 0) 2558 all_key = sshkey_alg_list(0, 0, 1, ',');
2559 if (kex_assemble_names( &o->hostkeyalgorithms,
2560 KEX_DEFAULT_PK_ALG, all_key) != 0)
2544 fatal("%s: kex_assemble_names failed", __func__); 2561 fatal("%s: kex_assemble_names failed", __func__);
2562 free(all_key);
2545 2563
2546 /* Most interesting options first: user, host, port */ 2564 /* Most interesting options first: user, host, port */
2547 dump_cfg_string(oUser, o->user); 2565 dump_cfg_string(oUser, o->user);