summaryrefslogtreecommitdiffstats
path: root/readconf.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2023-06-21 05:10:26 +0000
committerDamien Miller <djm@mindrot.org>2023-06-21 15:13:56 +1000
commitc1c2ca1365b3f7b626683690bd2c68265f6d8ffd (patch)
treee6a60fdd49b7b57cb35573cbcbbf305b517c0488 /readconf.c
parent4e73cd0f4ab3e5b576c56cac9732da62c8fc0565 (diff)
upstream: better validate CASignatureAlgorithms in ssh_config and
sshd_config. Previously this directive would accept certificate algorithm names, but these were unusable in practice as OpenSSH does not support CA chains. part of bz3577; ok dtucker@ OpenBSD-Commit-ID: a992d410c8a78ec982701bc3f91043dbdb359912
Diffstat (limited to 'readconf.c')
-rw-r--r--readconf.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/readconf.c b/readconf.c
index 0816ef6b..bb3bf767 100644
--- a/readconf.c
+++ b/readconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: readconf.c,v 1.376 2023/03/31 04:23:02 djm Exp $ */
+/* $OpenBSD: readconf.c,v 1.377 2023/06/21 05:10:26 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -945,7 +945,7 @@ process_config_line_depth(Options *options, struct passwd *pw, const char *host,
char **cpptr, ***cppptr, fwdarg[256];
u_int i, *uintptr, uvalue, max_entries = 0;
int r, oactive, negated, opcode, *intptr, value, value2, cmdline = 0;
- int remotefwd, dynamicfwd;
+ int remotefwd, dynamicfwd, ca_only = 0;
LogLevel *log_level_ptr;
SyslogFacility *log_facility_ptr;
long long val64;
@@ -1441,6 +1441,7 @@ parse_int:
case oHostKeyAlgorithms:
charptr = &options->hostkeyalgorithms;
+ ca_only = 0;
parse_pubkey_algos:
arg = argv_next(&ac, &av);
if (!arg || *arg == '\0') {
@@ -1450,7 +1451,7 @@ parse_pubkey_algos:
}
if (*arg != '-' &&
!sshkey_names_valid2(*arg == '+' || *arg == '^' ?
- arg + 1 : arg, 1)) {
+ arg + 1 : arg, 1, ca_only)) {
error("%s line %d: Bad key types '%s'.",
filename, linenum, arg ? arg : "<NONE>");
goto out;
@@ -1461,6 +1462,7 @@ parse_pubkey_algos:
case oCASignatureAlgorithms:
charptr = &options->ca_sign_algorithms;
+ ca_only = 1;
goto parse_pubkey_algos;
case oLogLevel:
@@ -2117,10 +2119,12 @@ parse_pubkey_algos:
case oHostbasedAcceptedAlgorithms:
charptr = &options->hostbased_accepted_algos;
+ ca_only = 0;
goto parse_pubkey_algos;
case oPubkeyAcceptedAlgorithms:
charptr = &options->pubkey_accepted_algos;
+ ca_only = 0;
goto parse_pubkey_algos;
case oAddKeysToAgent: