mirror of
https://github.com/PowerShell/openssh-portable.git
synced 2025-07-28 08:14:24 +02:00
upstream commit
Allow ssh_config and sshd_config kex parameters options be prefixed by a '+' to indicate that the specified items be appended to the default rather than replacing it. approach suggested by dtucker@, feedback dlg@, ok markus@ Upstream-ID: 0f901137298fc17095d5756ff1561a7028e8882a
This commit is contained in:
parent
5cefe76910
commit
f9eca249d4
64
kex.c
64
kex.c
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: kex.c,v 1.108 2015/07/29 08:34:54 djm Exp $ */
|
/* $OpenBSD: kex.c,v 1.109 2015/07/30 00:01:34 djm Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
|
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
|
||||||
*
|
*
|
||||||
@ -155,6 +155,68 @@ kex_names_valid(const char *names)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Concatenate algorithm names, avoiding duplicates in the process.
|
||||||
|
* Caller must free returned string.
|
||||||
|
*/
|
||||||
|
char *
|
||||||
|
kex_names_cat(const char *a, const char *b)
|
||||||
|
{
|
||||||
|
char *ret = NULL, *tmp = NULL, *cp, *p;
|
||||||
|
size_t len;
|
||||||
|
|
||||||
|
if (a == NULL || *a == '\0')
|
||||||
|
return NULL;
|
||||||
|
if (b == NULL || *b == '\0')
|
||||||
|
return strdup(a);
|
||||||
|
if (strlen(b) > 1024*1024)
|
||||||
|
return NULL;
|
||||||
|
len = strlen(a) + strlen(b) + 2;
|
||||||
|
if ((tmp = cp = strdup(b)) == NULL ||
|
||||||
|
(ret = calloc(1, len)) == NULL) {
|
||||||
|
free(tmp);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
strlcpy(ret, a, len);
|
||||||
|
for ((p = strsep(&cp, ",")); p && *p != '\0'; (p = strsep(&cp, ","))) {
|
||||||
|
if (match_list(ret, p, NULL) != NULL)
|
||||||
|
continue; /* Algorithm already present */
|
||||||
|
if (strlcat(ret, ",", len) >= len ||
|
||||||
|
strlcat(ret, p, len) >= len) {
|
||||||
|
free(tmp);
|
||||||
|
free(ret);
|
||||||
|
return NULL; /* Shouldn't happen */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free(tmp);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Assemble a list of algorithms from a default list and a string from a
|
||||||
|
* configuration file. The user-provided string may begin with '+' to
|
||||||
|
* indicate that it should be appended to the default.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
kex_assemble_names(const char *def, char **list)
|
||||||
|
{
|
||||||
|
char *ret;
|
||||||
|
|
||||||
|
if (list == NULL || *list == NULL || **list == '\0') {
|
||||||
|
*list = strdup(def);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (**list != '+') {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((ret = kex_names_cat(def, *list + 1)) == NULL)
|
||||||
|
return SSH_ERR_ALLOC_FAIL;
|
||||||
|
free(*list);
|
||||||
|
*list = ret;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* put algorithm proposal into buffer */
|
/* put algorithm proposal into buffer */
|
||||||
int
|
int
|
||||||
kex_prop2buf(struct sshbuf *b, char *proposal[PROPOSAL_MAX])
|
kex_prop2buf(struct sshbuf *b, char *proposal[PROPOSAL_MAX])
|
||||||
|
4
kex.h
4
kex.h
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: kex.h,v 1.72 2015/07/29 04:43:06 djm Exp $ */
|
/* $OpenBSD: kex.h,v 1.73 2015/07/30 00:01:34 djm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
|
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
|
||||||
@ -160,6 +160,8 @@ struct kex {
|
|||||||
|
|
||||||
int kex_names_valid(const char *);
|
int kex_names_valid(const char *);
|
||||||
char *kex_alg_list(char);
|
char *kex_alg_list(char);
|
||||||
|
char *kex_names_cat(const char *, const char *);
|
||||||
|
int kex_assemble_names(const char *, char **);
|
||||||
|
|
||||||
int kex_new(struct ssh *, char *[PROPOSAL_MAX], struct kex **);
|
int kex_new(struct ssh *, char *[PROPOSAL_MAX], struct kex **);
|
||||||
int kex_setup(struct ssh *, char *[PROPOSAL_MAX]);
|
int kex_setup(struct ssh *, char *[PROPOSAL_MAX]);
|
||||||
|
25
readconf.c
25
readconf.c
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: readconf.c,v 1.238 2015/07/10 06:21:53 markus Exp $ */
|
/* $OpenBSD: readconf.c,v 1.239 2015/07/30 00:01:34 djm Exp $ */
|
||||||
/*
|
/*
|
||||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||||
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
||||||
@ -1086,7 +1086,7 @@ parse_int:
|
|||||||
arg = strdelim(&s);
|
arg = strdelim(&s);
|
||||||
if (!arg || *arg == '\0')
|
if (!arg || *arg == '\0')
|
||||||
fatal("%.200s line %d: Missing argument.", filename, linenum);
|
fatal("%.200s line %d: Missing argument.", filename, linenum);
|
||||||
if (!ciphers_valid(arg))
|
if (!ciphers_valid(*arg == '+' ? arg + 1 : arg))
|
||||||
fatal("%.200s line %d: Bad SSH2 cipher spec '%s'.",
|
fatal("%.200s line %d: Bad SSH2 cipher spec '%s'.",
|
||||||
filename, linenum, arg ? arg : "<NONE>");
|
filename, linenum, arg ? arg : "<NONE>");
|
||||||
if (*activep && options->ciphers == NULL)
|
if (*activep && options->ciphers == NULL)
|
||||||
@ -1097,7 +1097,7 @@ parse_int:
|
|||||||
arg = strdelim(&s);
|
arg = strdelim(&s);
|
||||||
if (!arg || *arg == '\0')
|
if (!arg || *arg == '\0')
|
||||||
fatal("%.200s line %d: Missing argument.", filename, linenum);
|
fatal("%.200s line %d: Missing argument.", filename, linenum);
|
||||||
if (!mac_valid(arg))
|
if (!mac_valid(*arg == '+' ? arg + 1 : arg))
|
||||||
fatal("%.200s line %d: Bad SSH2 Mac spec '%s'.",
|
fatal("%.200s line %d: Bad SSH2 Mac spec '%s'.",
|
||||||
filename, linenum, arg ? arg : "<NONE>");
|
filename, linenum, arg ? arg : "<NONE>");
|
||||||
if (*activep && options->macs == NULL)
|
if (*activep && options->macs == NULL)
|
||||||
@ -1109,7 +1109,7 @@ parse_int:
|
|||||||
if (!arg || *arg == '\0')
|
if (!arg || *arg == '\0')
|
||||||
fatal("%.200s line %d: Missing argument.",
|
fatal("%.200s line %d: Missing argument.",
|
||||||
filename, linenum);
|
filename, linenum);
|
||||||
if (!kex_names_valid(arg))
|
if (!kex_names_valid(*arg == '+' ? arg + 1 : arg))
|
||||||
fatal("%.200s line %d: Bad SSH2 KexAlgorithms '%s'.",
|
fatal("%.200s line %d: Bad SSH2 KexAlgorithms '%s'.",
|
||||||
filename, linenum, arg ? arg : "<NONE>");
|
filename, linenum, arg ? arg : "<NONE>");
|
||||||
if (*activep && options->kex_algorithms == NULL)
|
if (*activep && options->kex_algorithms == NULL)
|
||||||
@ -1123,7 +1123,7 @@ parse_keytypes:
|
|||||||
if (!arg || *arg == '\0')
|
if (!arg || *arg == '\0')
|
||||||
fatal("%.200s line %d: Missing argument.",
|
fatal("%.200s line %d: Missing argument.",
|
||||||
filename, linenum);
|
filename, linenum);
|
||||||
if (!sshkey_names_valid2(arg, 1))
|
if (!sshkey_names_valid2(*arg == '+' ? arg + 1 : arg, 1))
|
||||||
fatal("%s line %d: Bad key types '%s'.",
|
fatal("%s line %d: Bad key types '%s'.",
|
||||||
filename, linenum, arg ? arg : "<NONE>");
|
filename, linenum, arg ? arg : "<NONE>");
|
||||||
if (*activep && *charptr == NULL)
|
if (*activep && *charptr == NULL)
|
||||||
@ -1762,9 +1762,6 @@ fill_default_options(Options * options)
|
|||||||
/* Selected in ssh_login(). */
|
/* Selected in ssh_login(). */
|
||||||
if (options->cipher == -1)
|
if (options->cipher == -1)
|
||||||
options->cipher = SSH_CIPHER_NOT_SET;
|
options->cipher = SSH_CIPHER_NOT_SET;
|
||||||
/* options->ciphers, default set in myproposals.h */
|
|
||||||
/* options->macs, default set in myproposals.h */
|
|
||||||
/* options->kex_algorithms, default set in myproposals.h */
|
|
||||||
/* options->hostkeyalgorithms, default set in myproposals.h */
|
/* options->hostkeyalgorithms, default set in myproposals.h */
|
||||||
if (options->protocol == SSH_PROTO_UNKNOWN)
|
if (options->protocol == SSH_PROTO_UNKNOWN)
|
||||||
options->protocol = SSH_PROTO_2;
|
options->protocol = SSH_PROTO_2;
|
||||||
@ -1858,10 +1855,14 @@ fill_default_options(Options * options)
|
|||||||
options->fingerprint_hash = SSH_FP_HASH_DEFAULT;
|
options->fingerprint_hash = SSH_FP_HASH_DEFAULT;
|
||||||
if (options->update_hostkeys == -1)
|
if (options->update_hostkeys == -1)
|
||||||
options->update_hostkeys = 0;
|
options->update_hostkeys = 0;
|
||||||
if (options->hostbased_key_types == NULL)
|
if (kex_assemble_names(KEX_CLIENT_ENCRYPT, &options->ciphers) != 0 ||
|
||||||
options->hostbased_key_types = xstrdup(KEX_DEFAULT_PK_ALG);
|
kex_assemble_names(KEX_CLIENT_MAC, &options->macs) != 0 ||
|
||||||
if (options->pubkey_key_types == NULL)
|
kex_assemble_names(KEX_CLIENT_KEX, &options->kex_algorithms) != 0 ||
|
||||||
options->pubkey_key_types = xstrdup(KEX_DEFAULT_PK_ALG);
|
kex_assemble_names(KEX_DEFAULT_PK_ALG,
|
||||||
|
&options->hostbased_key_types) != 0 ||
|
||||||
|
kex_assemble_names(KEX_DEFAULT_PK_ALG,
|
||||||
|
&options->pubkey_key_types) != 0)
|
||||||
|
fatal("%s: kex_assemble_names failed", __func__);
|
||||||
|
|
||||||
#define CLEAR_ON_NONE(v) \
|
#define CLEAR_ON_NONE(v) \
|
||||||
do { \
|
do { \
|
||||||
|
24
servconf.c
24
servconf.c
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
/* $OpenBSD: servconf.c,v 1.276 2015/07/10 06:21:53 markus Exp $ */
|
/* $OpenBSD: servconf.c,v 1.277 2015/07/30 00:01:34 djm Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
||||||
* All rights reserved
|
* All rights reserved
|
||||||
@ -259,16 +259,12 @@ fill_default_server_options(ServerOptions *options)
|
|||||||
options->hostbased_authentication = 0;
|
options->hostbased_authentication = 0;
|
||||||
if (options->hostbased_uses_name_from_packet_only == -1)
|
if (options->hostbased_uses_name_from_packet_only == -1)
|
||||||
options->hostbased_uses_name_from_packet_only = 0;
|
options->hostbased_uses_name_from_packet_only = 0;
|
||||||
if (options->hostbased_key_types == NULL)
|
|
||||||
options->hostbased_key_types = xstrdup(KEX_DEFAULT_PK_ALG);
|
|
||||||
if (options->hostkeyalgorithms == NULL)
|
if (options->hostkeyalgorithms == NULL)
|
||||||
options->hostkeyalgorithms = xstrdup(KEX_DEFAULT_PK_ALG);
|
options->hostkeyalgorithms = xstrdup(KEX_DEFAULT_PK_ALG);
|
||||||
if (options->rsa_authentication == -1)
|
if (options->rsa_authentication == -1)
|
||||||
options->rsa_authentication = 1;
|
options->rsa_authentication = 1;
|
||||||
if (options->pubkey_authentication == -1)
|
if (options->pubkey_authentication == -1)
|
||||||
options->pubkey_authentication = 1;
|
options->pubkey_authentication = 1;
|
||||||
if (options->pubkey_key_types == NULL)
|
|
||||||
options->pubkey_key_types = xstrdup(KEX_DEFAULT_PK_ALG);
|
|
||||||
if (options->kerberos_authentication == -1)
|
if (options->kerberos_authentication == -1)
|
||||||
options->kerberos_authentication = 0;
|
options->kerberos_authentication = 0;
|
||||||
if (options->kerberos_or_local_passwd == -1)
|
if (options->kerberos_or_local_passwd == -1)
|
||||||
@ -345,6 +341,16 @@ fill_default_server_options(ServerOptions *options)
|
|||||||
options->fwd_opts.streamlocal_bind_unlink = 0;
|
options->fwd_opts.streamlocal_bind_unlink = 0;
|
||||||
if (options->fingerprint_hash == -1)
|
if (options->fingerprint_hash == -1)
|
||||||
options->fingerprint_hash = SSH_FP_HASH_DEFAULT;
|
options->fingerprint_hash = SSH_FP_HASH_DEFAULT;
|
||||||
|
|
||||||
|
if (kex_assemble_names(KEX_SERVER_ENCRYPT, &options->ciphers) != 0 ||
|
||||||
|
kex_assemble_names(KEX_SERVER_MAC, &options->macs) != 0 ||
|
||||||
|
kex_assemble_names(KEX_SERVER_KEX, &options->kex_algorithms) != 0 ||
|
||||||
|
kex_assemble_names(KEX_DEFAULT_PK_ALG,
|
||||||
|
&options->hostbased_key_types) != 0 ||
|
||||||
|
kex_assemble_names(KEX_DEFAULT_PK_ALG,
|
||||||
|
&options->pubkey_key_types) != 0)
|
||||||
|
fatal("%s: kex_assemble_names failed", __func__);
|
||||||
|
|
||||||
/* Turn privilege separation on by default */
|
/* Turn privilege separation on by default */
|
||||||
if (use_privsep == -1)
|
if (use_privsep == -1)
|
||||||
use_privsep = PRIVSEP_NOSANDBOX;
|
use_privsep = PRIVSEP_NOSANDBOX;
|
||||||
@ -1181,7 +1187,7 @@ process_server_config_line(ServerOptions *options, char *line,
|
|||||||
if (!arg || *arg == '\0')
|
if (!arg || *arg == '\0')
|
||||||
fatal("%s line %d: Missing argument.",
|
fatal("%s line %d: Missing argument.",
|
||||||
filename, linenum);
|
filename, linenum);
|
||||||
if (!sshkey_names_valid2(arg, 1))
|
if (!sshkey_names_valid2(*arg == '+' ? arg + 1 : arg, 1))
|
||||||
fatal("%s line %d: Bad key types '%s'.",
|
fatal("%s line %d: Bad key types '%s'.",
|
||||||
filename, linenum, arg ? arg : "<NONE>");
|
filename, linenum, arg ? arg : "<NONE>");
|
||||||
if (*activep && *charptr == NULL)
|
if (*activep && *charptr == NULL)
|
||||||
@ -1434,7 +1440,7 @@ process_server_config_line(ServerOptions *options, char *line,
|
|||||||
arg = strdelim(&cp);
|
arg = strdelim(&cp);
|
||||||
if (!arg || *arg == '\0')
|
if (!arg || *arg == '\0')
|
||||||
fatal("%s line %d: Missing argument.", filename, linenum);
|
fatal("%s line %d: Missing argument.", filename, linenum);
|
||||||
if (!ciphers_valid(arg))
|
if (!ciphers_valid(*arg == '+' ? arg + 1 : arg))
|
||||||
fatal("%s line %d: Bad SSH2 cipher spec '%s'.",
|
fatal("%s line %d: Bad SSH2 cipher spec '%s'.",
|
||||||
filename, linenum, arg ? arg : "<NONE>");
|
filename, linenum, arg ? arg : "<NONE>");
|
||||||
if (options->ciphers == NULL)
|
if (options->ciphers == NULL)
|
||||||
@ -1445,7 +1451,7 @@ process_server_config_line(ServerOptions *options, char *line,
|
|||||||
arg = strdelim(&cp);
|
arg = strdelim(&cp);
|
||||||
if (!arg || *arg == '\0')
|
if (!arg || *arg == '\0')
|
||||||
fatal("%s line %d: Missing argument.", filename, linenum);
|
fatal("%s line %d: Missing argument.", filename, linenum);
|
||||||
if (!mac_valid(arg))
|
if (!mac_valid(*arg == '+' ? arg + 1 : arg))
|
||||||
fatal("%s line %d: Bad SSH2 mac spec '%s'.",
|
fatal("%s line %d: Bad SSH2 mac spec '%s'.",
|
||||||
filename, linenum, arg ? arg : "<NONE>");
|
filename, linenum, arg ? arg : "<NONE>");
|
||||||
if (options->macs == NULL)
|
if (options->macs == NULL)
|
||||||
@ -1457,7 +1463,7 @@ process_server_config_line(ServerOptions *options, char *line,
|
|||||||
if (!arg || *arg == '\0')
|
if (!arg || *arg == '\0')
|
||||||
fatal("%s line %d: Missing argument.",
|
fatal("%s line %d: Missing argument.",
|
||||||
filename, linenum);
|
filename, linenum);
|
||||||
if (!kex_names_valid(arg))
|
if (!kex_names_valid(*arg == '+' ? arg + 1 : arg))
|
||||||
fatal("%s line %d: Bad SSH2 KexAlgorithms '%s'.",
|
fatal("%s line %d: Bad SSH2 KexAlgorithms '%s'.",
|
||||||
filename, linenum, arg ? arg : "<NONE>");
|
filename, linenum, arg ? arg : "<NONE>");
|
||||||
if (options->kex_algorithms == NULL)
|
if (options->kex_algorithms == NULL)
|
||||||
|
35
ssh.c
35
ssh.c
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: ssh.c,v 1.419 2015/07/20 18:42:35 millert Exp $ */
|
/* $OpenBSD: ssh.c,v 1.420 2015/07/30 00:01:34 djm Exp $ */
|
||||||
/*
|
/*
|
||||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||||
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
||||||
@ -108,6 +108,7 @@
|
|||||||
#include "roaming.h"
|
#include "roaming.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "ssherr.h"
|
#include "ssherr.h"
|
||||||
|
#include "myproposal.h"
|
||||||
|
|
||||||
#ifdef ENABLE_PKCS11
|
#ifdef ENABLE_PKCS11
|
||||||
#include "ssh-pkcs11.h"
|
#include "ssh-pkcs11.h"
|
||||||
@ -794,26 +795,26 @@ main(int ac, char **av)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
if (ciphers_valid(optarg)) {
|
if (ciphers_valid(*optarg == '+' ?
|
||||||
|
optarg + 1 : optarg)) {
|
||||||
/* SSH2 only */
|
/* SSH2 only */
|
||||||
options.ciphers = xstrdup(optarg);
|
options.ciphers = xstrdup(optarg);
|
||||||
options.cipher = SSH_CIPHER_INVALID;
|
options.cipher = SSH_CIPHER_INVALID;
|
||||||
} else {
|
break;
|
||||||
/* SSH1 only */
|
|
||||||
options.cipher = cipher_number(optarg);
|
|
||||||
if (options.cipher == -1) {
|
|
||||||
fprintf(stderr,
|
|
||||||
"Unknown cipher type '%s'\n",
|
|
||||||
optarg);
|
|
||||||
exit(255);
|
|
||||||
}
|
|
||||||
if (options.cipher == SSH_CIPHER_3DES)
|
|
||||||
options.ciphers = "3des-cbc";
|
|
||||||
else if (options.cipher == SSH_CIPHER_BLOWFISH)
|
|
||||||
options.ciphers = "blowfish-cbc";
|
|
||||||
else
|
|
||||||
options.ciphers = (char *)-1;
|
|
||||||
}
|
}
|
||||||
|
/* SSH1 only */
|
||||||
|
options.cipher = cipher_number(optarg);
|
||||||
|
if (options.cipher == -1) {
|
||||||
|
fprintf(stderr, "Unknown cipher type '%s'\n",
|
||||||
|
optarg);
|
||||||
|
exit(255);
|
||||||
|
}
|
||||||
|
if (options.cipher == SSH_CIPHER_3DES)
|
||||||
|
options.ciphers = xstrdup("3des-cbc");
|
||||||
|
else if (options.cipher == SSH_CIPHER_BLOWFISH)
|
||||||
|
options.ciphers = xstrdup("blowfish-cbc");
|
||||||
|
else
|
||||||
|
options.ciphers = xstrdup(KEX_CLIENT_ENCRYPT);
|
||||||
break;
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
if (mac_valid(optarg))
|
if (mac_valid(optarg))
|
||||||
|
31
ssh_config.5
31
ssh_config.5
@ -33,8 +33,8 @@
|
|||||||
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.\" $OpenBSD: ssh_config.5,v 1.213 2015/07/10 06:21:53 markus Exp $
|
.\" $OpenBSD: ssh_config.5,v 1.214 2015/07/30 00:01:34 djm Exp $
|
||||||
.Dd $Mdocdate: July 10 2015 $
|
.Dd $Mdocdate: July 30 2015 $
|
||||||
.Dt SSH_CONFIG 5
|
.Dt SSH_CONFIG 5
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -373,6 +373,11 @@ The default is
|
|||||||
Specifies the ciphers allowed for protocol version 2
|
Specifies the ciphers allowed for protocol version 2
|
||||||
in order of preference.
|
in order of preference.
|
||||||
Multiple ciphers must be comma-separated.
|
Multiple ciphers must be comma-separated.
|
||||||
|
If the specified value begins with a
|
||||||
|
.Sq +
|
||||||
|
character, then the specified ciphers will be appended to the default set
|
||||||
|
instead of replacing them.
|
||||||
|
.Pp
|
||||||
The supported ciphers are:
|
The supported ciphers are:
|
||||||
.Pp
|
.Pp
|
||||||
.Bl -item -compact -offset indent
|
.Bl -item -compact -offset indent
|
||||||
@ -781,6 +786,10 @@ is similar to
|
|||||||
.It Cm HostbasedKeyTypes
|
.It Cm HostbasedKeyTypes
|
||||||
Specifies the key types that will be used for hostbased authentication
|
Specifies the key types that will be used for hostbased authentication
|
||||||
as a comma-separated pattern list.
|
as a comma-separated pattern list.
|
||||||
|
Alternately if the specified value begins with a
|
||||||
|
.Sq +
|
||||||
|
character, then the specified key types will be appended to the default set
|
||||||
|
instead of replacing them.
|
||||||
The default for this option is:
|
The default for this option is:
|
||||||
.Bd -literal -offset 3n
|
.Bd -literal -offset 3n
|
||||||
ecdsa-sha2-nistp256-cert-v01@openssh.com,
|
ecdsa-sha2-nistp256-cert-v01@openssh.com,
|
||||||
@ -800,6 +809,10 @@ may be used to list supported key types.
|
|||||||
.It Cm HostKeyAlgorithms
|
.It Cm HostKeyAlgorithms
|
||||||
Specifies the protocol version 2 host key algorithms
|
Specifies the protocol version 2 host key algorithms
|
||||||
that the client wants to use in order of preference.
|
that the client wants to use in order of preference.
|
||||||
|
Alternately if the specified value begins with a
|
||||||
|
.Sq +
|
||||||
|
character, then the specified key types will be appended to the default set
|
||||||
|
instead of replacing them.
|
||||||
The default for this option is:
|
The default for this option is:
|
||||||
.Bd -literal -offset 3n
|
.Bd -literal -offset 3n
|
||||||
ecdsa-sha2-nistp256-cert-v01@openssh.com,
|
ecdsa-sha2-nistp256-cert-v01@openssh.com,
|
||||||
@ -981,6 +994,10 @@ and
|
|||||||
.It Cm KexAlgorithms
|
.It Cm KexAlgorithms
|
||||||
Specifies the available KEX (Key Exchange) algorithms.
|
Specifies the available KEX (Key Exchange) algorithms.
|
||||||
Multiple algorithms must be comma-separated.
|
Multiple algorithms must be comma-separated.
|
||||||
|
Alternately if the specified value begins with a
|
||||||
|
.Sq +
|
||||||
|
character, then the specified methods will be appended to the default set
|
||||||
|
instead of replacing them.
|
||||||
The default is:
|
The default is:
|
||||||
.Bd -literal -offset indent
|
.Bd -literal -offset indent
|
||||||
curve25519-sha256@libssh.org,
|
curve25519-sha256@libssh.org,
|
||||||
@ -1069,10 +1086,16 @@ in order of preference.
|
|||||||
The MAC algorithm is used in protocol version 2
|
The MAC algorithm is used in protocol version 2
|
||||||
for data integrity protection.
|
for data integrity protection.
|
||||||
Multiple algorithms must be comma-separated.
|
Multiple algorithms must be comma-separated.
|
||||||
|
If the specified value begins with a
|
||||||
|
.Sq +
|
||||||
|
character, then the specified algorithms will be appended to the default set
|
||||||
|
instead of replacing them.
|
||||||
|
.Pp
|
||||||
The algorithms that contain
|
The algorithms that contain
|
||||||
.Dq -etm
|
.Dq -etm
|
||||||
calculate the MAC after encryption (encrypt-then-mac).
|
calculate the MAC after encryption (encrypt-then-mac).
|
||||||
These are considered safer and their use recommended.
|
These are considered safer and their use recommended.
|
||||||
|
.Pp
|
||||||
The default is:
|
The default is:
|
||||||
.Bd -literal -offset indent
|
.Bd -literal -offset indent
|
||||||
umac-64-etm@openssh.com,umac-128-etm@openssh.com,
|
umac-64-etm@openssh.com,umac-128-etm@openssh.com,
|
||||||
@ -1216,6 +1239,10 @@ The default is
|
|||||||
.It Cm PubkeyAcceptedKeyTypes
|
.It Cm PubkeyAcceptedKeyTypes
|
||||||
Specifies the key types that will be used for public key authentication
|
Specifies the key types that will be used for public key authentication
|
||||||
as a comma-separated pattern list.
|
as a comma-separated pattern list.
|
||||||
|
Alternately if the specified value begins with a
|
||||||
|
.Sq +
|
||||||
|
character, then the key types after it will be appended to the default
|
||||||
|
instead of replacing it.
|
||||||
The default for this option is:
|
The default for this option is:
|
||||||
.Bd -literal -offset 3n
|
.Bd -literal -offset 3n
|
||||||
ecdsa-sha2-nistp256-cert-v01@openssh.com,
|
ecdsa-sha2-nistp256-cert-v01@openssh.com,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: sshconnect2.c,v 1.225 2015/07/10 06:21:53 markus Exp $ */
|
/* $OpenBSD: sshconnect2.c,v 1.226 2015/07/30 00:01:34 djm Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2000 Markus Friedl. All rights reserved.
|
* Copyright (c) 2000 Markus Friedl. All rights reserved.
|
||||||
* Copyright (c) 2008 Damien Miller. All rights reserved.
|
* Copyright (c) 2008 Damien Miller. All rights reserved.
|
||||||
@ -163,18 +163,12 @@ ssh_kex2(char *host, struct sockaddr *hostaddr, u_short port)
|
|||||||
xxx_host = host;
|
xxx_host = host;
|
||||||
xxx_hostaddr = hostaddr;
|
xxx_hostaddr = hostaddr;
|
||||||
|
|
||||||
if (options.ciphers == (char *)-1) {
|
myproposal[PROPOSAL_KEX_ALGS] = compat_kex_proposal(
|
||||||
logit("No valid ciphers for protocol version 2 given, using defaults.");
|
options.kex_algorithms);
|
||||||
options.ciphers = NULL;
|
|
||||||
}
|
|
||||||
if (options.ciphers != NULL) {
|
|
||||||
myproposal[PROPOSAL_ENC_ALGS_CTOS] =
|
|
||||||
myproposal[PROPOSAL_ENC_ALGS_STOC] = options.ciphers;
|
|
||||||
}
|
|
||||||
myproposal[PROPOSAL_ENC_ALGS_CTOS] =
|
myproposal[PROPOSAL_ENC_ALGS_CTOS] =
|
||||||
compat_cipher_proposal(myproposal[PROPOSAL_ENC_ALGS_CTOS]);
|
compat_cipher_proposal(options.ciphers);
|
||||||
myproposal[PROPOSAL_ENC_ALGS_STOC] =
|
myproposal[PROPOSAL_ENC_ALGS_STOC] =
|
||||||
compat_cipher_proposal(myproposal[PROPOSAL_ENC_ALGS_STOC]);
|
compat_cipher_proposal(options.ciphers);
|
||||||
if (options.compression) {
|
if (options.compression) {
|
||||||
myproposal[PROPOSAL_COMP_ALGS_CTOS] =
|
myproposal[PROPOSAL_COMP_ALGS_CTOS] =
|
||||||
myproposal[PROPOSAL_COMP_ALGS_STOC] = "zlib@openssh.com,zlib,none";
|
myproposal[PROPOSAL_COMP_ALGS_STOC] = "zlib@openssh.com,zlib,none";
|
||||||
@ -182,14 +176,15 @@ ssh_kex2(char *host, struct sockaddr *hostaddr, u_short port)
|
|||||||
myproposal[PROPOSAL_COMP_ALGS_CTOS] =
|
myproposal[PROPOSAL_COMP_ALGS_CTOS] =
|
||||||
myproposal[PROPOSAL_COMP_ALGS_STOC] = "none,zlib@openssh.com,zlib";
|
myproposal[PROPOSAL_COMP_ALGS_STOC] = "none,zlib@openssh.com,zlib";
|
||||||
}
|
}
|
||||||
if (options.macs != NULL) {
|
myproposal[PROPOSAL_MAC_ALGS_CTOS] =
|
||||||
myproposal[PROPOSAL_MAC_ALGS_CTOS] =
|
myproposal[PROPOSAL_MAC_ALGS_STOC] = options.macs;
|
||||||
myproposal[PROPOSAL_MAC_ALGS_STOC] = options.macs;
|
if (options.hostkeyalgorithms != NULL) {
|
||||||
}
|
if (kex_assemble_names(KEX_DEFAULT_PK_ALG,
|
||||||
if (options.hostkeyalgorithms != NULL)
|
&options.hostkeyalgorithms) != 0)
|
||||||
|
fatal("%s: kex_assemble_namelist", __func__);
|
||||||
myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] =
|
myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] =
|
||||||
compat_pkalg_proposal(options.hostkeyalgorithms);
|
compat_pkalg_proposal(options.hostkeyalgorithms);
|
||||||
else {
|
} else {
|
||||||
/* Enforce default */
|
/* Enforce default */
|
||||||
options.hostkeyalgorithms = xstrdup(KEX_DEFAULT_PK_ALG);
|
options.hostkeyalgorithms = xstrdup(KEX_DEFAULT_PK_ALG);
|
||||||
/* Prefer algorithms that we already have keys for */
|
/* Prefer algorithms that we already have keys for */
|
||||||
@ -197,10 +192,6 @@ ssh_kex2(char *host, struct sockaddr *hostaddr, u_short port)
|
|||||||
compat_pkalg_proposal(
|
compat_pkalg_proposal(
|
||||||
order_hostkeyalgs(host, hostaddr, port));
|
order_hostkeyalgs(host, hostaddr, port));
|
||||||
}
|
}
|
||||||
if (options.kex_algorithms != NULL)
|
|
||||||
myproposal[PROPOSAL_KEX_ALGS] = options.kex_algorithms;
|
|
||||||
myproposal[PROPOSAL_KEX_ALGS] = compat_kex_proposal(
|
|
||||||
myproposal[PROPOSAL_KEX_ALGS]);
|
|
||||||
|
|
||||||
if (options.rekey_limit || options.rekey_interval)
|
if (options.rekey_limit || options.rekey_interval)
|
||||||
packet_set_rekey_limits((u_int32_t)options.rekey_limit,
|
packet_set_rekey_limits((u_int32_t)options.rekey_limit,
|
||||||
|
27
sshd.c
27
sshd.c
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: sshd.c,v 1.456 2015/07/17 02:47:45 djm Exp $ */
|
/* $OpenBSD: sshd.c,v 1.457 2015/07/30 00:01:34 djm Exp $ */
|
||||||
/*
|
/*
|
||||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||||
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
||||||
@ -2539,19 +2539,15 @@ do_ssh2_kex(void)
|
|||||||
struct kex *kex;
|
struct kex *kex;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
if (options.ciphers != NULL) {
|
myproposal[PROPOSAL_KEX_ALGS] = compat_kex_proposal(
|
||||||
myproposal[PROPOSAL_ENC_ALGS_CTOS] =
|
options.kex_algorithms);
|
||||||
myproposal[PROPOSAL_ENC_ALGS_STOC] = options.ciphers;
|
myproposal[PROPOSAL_ENC_ALGS_CTOS] = compat_cipher_proposal(
|
||||||
}
|
options.ciphers);
|
||||||
myproposal[PROPOSAL_ENC_ALGS_CTOS] =
|
myproposal[PROPOSAL_ENC_ALGS_STOC] = compat_cipher_proposal(
|
||||||
compat_cipher_proposal(myproposal[PROPOSAL_ENC_ALGS_CTOS]);
|
options.ciphers);
|
||||||
myproposal[PROPOSAL_ENC_ALGS_STOC] =
|
myproposal[PROPOSAL_MAC_ALGS_CTOS] =
|
||||||
compat_cipher_proposal(myproposal[PROPOSAL_ENC_ALGS_STOC]);
|
myproposal[PROPOSAL_MAC_ALGS_STOC] = options.macs;
|
||||||
|
|
||||||
if (options.macs != NULL) {
|
|
||||||
myproposal[PROPOSAL_MAC_ALGS_CTOS] =
|
|
||||||
myproposal[PROPOSAL_MAC_ALGS_STOC] = options.macs;
|
|
||||||
}
|
|
||||||
if (options.compression == COMP_NONE) {
|
if (options.compression == COMP_NONE) {
|
||||||
myproposal[PROPOSAL_COMP_ALGS_CTOS] =
|
myproposal[PROPOSAL_COMP_ALGS_CTOS] =
|
||||||
myproposal[PROPOSAL_COMP_ALGS_STOC] = "none";
|
myproposal[PROPOSAL_COMP_ALGS_STOC] = "none";
|
||||||
@ -2559,11 +2555,6 @@ do_ssh2_kex(void)
|
|||||||
myproposal[PROPOSAL_COMP_ALGS_CTOS] =
|
myproposal[PROPOSAL_COMP_ALGS_CTOS] =
|
||||||
myproposal[PROPOSAL_COMP_ALGS_STOC] = "none,zlib@openssh.com";
|
myproposal[PROPOSAL_COMP_ALGS_STOC] = "none,zlib@openssh.com";
|
||||||
}
|
}
|
||||||
if (options.kex_algorithms != NULL)
|
|
||||||
myproposal[PROPOSAL_KEX_ALGS] = options.kex_algorithms;
|
|
||||||
|
|
||||||
myproposal[PROPOSAL_KEX_ALGS] = compat_kex_proposal(
|
|
||||||
myproposal[PROPOSAL_KEX_ALGS]);
|
|
||||||
|
|
||||||
if (options.rekey_limit || options.rekey_interval)
|
if (options.rekey_limit || options.rekey_interval)
|
||||||
packet_set_rekey_limits((u_int32_t)options.rekey_limit,
|
packet_set_rekey_limits((u_int32_t)options.rekey_limit,
|
||||||
|
@ -33,8 +33,8 @@
|
|||||||
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.\" $OpenBSD: sshd_config.5,v 1.207 2015/07/20 00:30:01 djm Exp $
|
.\" $OpenBSD: sshd_config.5,v 1.208 2015/07/30 00:01:34 djm Exp $
|
||||||
.Dd $Mdocdate: July 20 2015 $
|
.Dd $Mdocdate: July 30 2015 $
|
||||||
.Dt SSHD_CONFIG 5
|
.Dt SSHD_CONFIG 5
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -434,6 +434,11 @@ The default is not to
|
|||||||
.It Cm Ciphers
|
.It Cm Ciphers
|
||||||
Specifies the ciphers allowed for protocol version 2.
|
Specifies the ciphers allowed for protocol version 2.
|
||||||
Multiple ciphers must be comma-separated.
|
Multiple ciphers must be comma-separated.
|
||||||
|
If the specified value begins with a
|
||||||
|
.Sq +
|
||||||
|
character, then the specified ciphers will be appended to the default set
|
||||||
|
instead of replacing them.
|
||||||
|
.Pp
|
||||||
The supported ciphers are:
|
The supported ciphers are:
|
||||||
.Pp
|
.Pp
|
||||||
.Bl -item -compact -offset indent
|
.Bl -item -compact -offset indent
|
||||||
@ -640,6 +645,10 @@ The default is
|
|||||||
.It Cm HostbasedAcceptedKeyTypes
|
.It Cm HostbasedAcceptedKeyTypes
|
||||||
Specifies the key types that will be accepted for hostbased authentication
|
Specifies the key types that will be accepted for hostbased authentication
|
||||||
as a comma-separated pattern list.
|
as a comma-separated pattern list.
|
||||||
|
Alternately if the specified value begins with a
|
||||||
|
.Sq +
|
||||||
|
character, then the specified key types will be appended to the default set
|
||||||
|
instead of replacing them.
|
||||||
The default for this option is:
|
The default for this option is:
|
||||||
.Bd -literal -offset 3n
|
.Bd -literal -offset 3n
|
||||||
ecdsa-sha2-nistp256-cert-v01@openssh.com,
|
ecdsa-sha2-nistp256-cert-v01@openssh.com,
|
||||||
@ -855,6 +864,10 @@ The default is
|
|||||||
.It Cm KexAlgorithms
|
.It Cm KexAlgorithms
|
||||||
Specifies the available KEX (Key Exchange) algorithms.
|
Specifies the available KEX (Key Exchange) algorithms.
|
||||||
Multiple algorithms must be comma-separated.
|
Multiple algorithms must be comma-separated.
|
||||||
|
Alternately if the specified value begins with a
|
||||||
|
.Sq +
|
||||||
|
character, then the specified methods will be appended to the default set
|
||||||
|
instead of replacing them.
|
||||||
The supported algorithms are:
|
The supported algorithms are:
|
||||||
.Pp
|
.Pp
|
||||||
.Bl -item -compact -offset indent
|
.Bl -item -compact -offset indent
|
||||||
@ -953,6 +966,11 @@ Specifies the available MAC (message authentication code) algorithms.
|
|||||||
The MAC algorithm is used in protocol version 2
|
The MAC algorithm is used in protocol version 2
|
||||||
for data integrity protection.
|
for data integrity protection.
|
||||||
Multiple algorithms must be comma-separated.
|
Multiple algorithms must be comma-separated.
|
||||||
|
If the specified value begins with a
|
||||||
|
.Sq +
|
||||||
|
character, then the specified algorithms will be appended to the default set
|
||||||
|
instead of replacing them.
|
||||||
|
.Pp
|
||||||
The algorithms that contain
|
The algorithms that contain
|
||||||
.Dq -etm
|
.Dq -etm
|
||||||
calculate the MAC after encryption (encrypt-then-mac).
|
calculate the MAC after encryption (encrypt-then-mac).
|
||||||
@ -1313,6 +1331,10 @@ is identical to
|
|||||||
.It Cm PubkeyAcceptedKeyTypes
|
.It Cm PubkeyAcceptedKeyTypes
|
||||||
Specifies the key types that will be accepted for public key authentication
|
Specifies the key types that will be accepted for public key authentication
|
||||||
as a comma-separated pattern list.
|
as a comma-separated pattern list.
|
||||||
|
Alternately if the specified value begins with a
|
||||||
|
.Sq +
|
||||||
|
character, then the specified key types will be appended to the default set
|
||||||
|
instead of replacing them.
|
||||||
The default for this option is:
|
The default for this option is:
|
||||||
.Bd -literal -offset 3n
|
.Bd -literal -offset 3n
|
||||||
ecdsa-sha2-nistp256-cert-v01@openssh.com,
|
ecdsa-sha2-nistp256-cert-v01@openssh.com,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user