Module Name: src Committed By: christos Date: Thu Aug 13 10:33:21 UTC 2015
Modified Files: src/crypto/external/bsd/openssh/dist: OVERVIEW PROTOCOL PROTOCOL.mux addrmatch.c auth-options.c auth.c auth2-chall.c authfd.c authfile.c cipher.h clientloop.c compat.c kex.c kex.h key.c key.h krl.c log.c monitor.c myproposal.h packet.c readconf.c readconf.h scp.1 servconf.c servconf.h ssh-add.c ssh-agent.c ssh-keygen.1 ssh-keygen.c ssh-keysign.c ssh-pkcs11.c ssh.1 ssh.c ssh.h ssh_config.5 sshconnect2.c sshd.8 sshd.c sshd_config sshd_config.5 sshkey.c sshpty.c version.h Log Message: merge conflicts To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/crypto/external/bsd/openssh/dist/OVERVIEW \ src/crypto/external/bsd/openssh/dist/sshkey.c \ src/crypto/external/bsd/openssh/dist/sshpty.c cvs rdiff -u -r1.6 -r1.7 src/crypto/external/bsd/openssh/dist/PROTOCOL \ src/crypto/external/bsd/openssh/dist/krl.c cvs rdiff -u -r1.7 -r1.8 src/crypto/external/bsd/openssh/dist/PROTOCOL.mux \ src/crypto/external/bsd/openssh/dist/cipher.h cvs rdiff -u -r1.8 -r1.9 src/crypto/external/bsd/openssh/dist/addrmatch.c \ src/crypto/external/bsd/openssh/dist/auth2-chall.c \ src/crypto/external/bsd/openssh/dist/ssh-pkcs11.c cvs rdiff -u -r1.10 -r1.11 \ src/crypto/external/bsd/openssh/dist/auth-options.c cvs rdiff -u -r1.13 -r1.14 src/crypto/external/bsd/openssh/dist/auth.c \ src/crypto/external/bsd/openssh/dist/ssh-keygen.1 cvs rdiff -u -r1.9 -r1.10 src/crypto/external/bsd/openssh/dist/authfd.c \ src/crypto/external/bsd/openssh/dist/kex.h \ src/crypto/external/bsd/openssh/dist/key.h \ src/crypto/external/bsd/openssh/dist/scp.1 \ src/crypto/external/bsd/openssh/dist/ssh-keysign.c cvs rdiff -u -r1.11 -r1.12 src/crypto/external/bsd/openssh/dist/authfile.c \ src/crypto/external/bsd/openssh/dist/compat.c \ src/crypto/external/bsd/openssh/dist/kex.c \ src/crypto/external/bsd/openssh/dist/myproposal.h \ src/crypto/external/bsd/openssh/dist/ssh-add.c cvs rdiff -u -r1.14 -r1.15 src/crypto/external/bsd/openssh/dist/clientloop.c \ src/crypto/external/bsd/openssh/dist/ssh_config.5 \ src/crypto/external/bsd/openssh/dist/sshd.8 \ src/crypto/external/bsd/openssh/dist/sshd_config cvs rdiff -u -r1.16 -r1.17 src/crypto/external/bsd/openssh/dist/key.c cvs rdiff -u -r1.12 -r1.13 src/crypto/external/bsd/openssh/dist/log.c \ src/crypto/external/bsd/openssh/dist/readconf.h \ src/crypto/external/bsd/openssh/dist/servconf.h cvs rdiff -u -r1.15 -r1.16 src/crypto/external/bsd/openssh/dist/monitor.c \ src/crypto/external/bsd/openssh/dist/readconf.c \ src/crypto/external/bsd/openssh/dist/ssh-agent.c \ src/crypto/external/bsd/openssh/dist/ssh.1 \ src/crypto/external/bsd/openssh/dist/version.h cvs rdiff -u -r1.19 -r1.20 src/crypto/external/bsd/openssh/dist/packet.c cvs rdiff -u -r1.18 -r1.19 src/crypto/external/bsd/openssh/dist/servconf.c \ src/crypto/external/bsd/openssh/dist/ssh.c \ src/crypto/external/bsd/openssh/dist/sshd_config.5 cvs rdiff -u -r1.17 -r1.18 src/crypto/external/bsd/openssh/dist/ssh-keygen.c cvs rdiff -u -r1.5 -r1.6 src/crypto/external/bsd/openssh/dist/ssh.h cvs rdiff -u -r1.21 -r1.22 src/crypto/external/bsd/openssh/dist/sshconnect2.c cvs rdiff -u -r1.20 -r1.21 src/crypto/external/bsd/openssh/dist/sshd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/crypto/external/bsd/openssh/dist/OVERVIEW diff -u src/crypto/external/bsd/openssh/dist/OVERVIEW:1.4 src/crypto/external/bsd/openssh/dist/OVERVIEW:1.5 --- src/crypto/external/bsd/openssh/dist/OVERVIEW:1.4 Fri Apr 3 19:58:19 2015 +++ src/crypto/external/bsd/openssh/dist/OVERVIEW Thu Aug 13 06:33:21 2015 @@ -65,8 +65,8 @@ these programs. packets. CRC code comes from crc32.c. - The code in packet.c calls the buffer manipulation routines - (buffer.c, bufaux.c), compression routines (compress.c, zlib), - and the encryption routines. + (buffer.c, bufaux.c), compression routines (zlib), and the + encryption routines. X11, TCP/IP, and Agent forwarding @@ -165,5 +165,5 @@ these programs. uidswap.c uid-swapping xmalloc.c "safe" malloc routines -$OpenBSD: OVERVIEW,v 1.11 2006/08/03 03:34:41 deraadt Exp $ -$NetBSD: OVERVIEW,v 1.4 2015/04/03 23:58:19 christos Exp $ +$OpenBSD: OVERVIEW,v 1.12 2015/07/08 19:01:15 markus Exp $ +$NetBSD: OVERVIEW,v 1.5 2015/08/13 10:33:21 christos Exp $ Index: src/crypto/external/bsd/openssh/dist/sshkey.c diff -u src/crypto/external/bsd/openssh/dist/sshkey.c:1.4 src/crypto/external/bsd/openssh/dist/sshkey.c:1.5 --- src/crypto/external/bsd/openssh/dist/sshkey.c:1.4 Thu Jul 2 21:00:00 2015 +++ src/crypto/external/bsd/openssh/dist/sshkey.c Thu Aug 13 06:33:21 2015 @@ -1,5 +1,5 @@ -/* $NetBSD: sshkey.c,v 1.4 2015/07/03 01:00:00 christos Exp $ */ -/* $OpenBSD: sshkey.c,v 1.19 2015/05/21 04:55:51 djm Exp $ */ +/* $NetBSD: sshkey.c,v 1.5 2015/08/13 10:33:21 christos Exp $ */ +/* $OpenBSD: sshkey.c,v 1.20 2015/07/03 03:43:18 djm Exp $ */ /* * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. * Copyright (c) 2008 Alexander von Gernler. All rights reserved. @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "includes.h" -__RCSID("$NetBSD: sshkey.c,v 1.4 2015/07/03 01:00:00 christos Exp $"); +__RCSID("$NetBSD: sshkey.c,v 1.5 2015/08/13 10:33:21 christos Exp $"); #include <sys/param.h> /* MIN MAX */ #include <sys/types.h> @@ -102,10 +102,6 @@ static const struct keytype keytypes[] = KEY_ECDSA_CERT, NID_secp384r1, 1 }, { "ecdsa-sha2-nistp521-cert-...@openssh.com", "ECDSA-CERT", KEY_ECDSA_CERT, NID_secp521r1, 1 }, - { "ssh-rsa-cert-...@openssh.com", "RSA-CERT-V00", - KEY_RSA_CERT_V00, 0, 1 }, - { "ssh-dss-cert-...@openssh.com", "DSA-CERT-V00", - KEY_DSA_CERT_V00, 0, 1 }, #endif /* WITH_OPENSSL */ { NULL, NULL, -1, -1, 0 } }; @@ -263,11 +259,9 @@ sshkey_size(const struct sshkey *k) #ifdef WITH_OPENSSL case KEY_RSA1: case KEY_RSA: - case KEY_RSA_CERT_V00: case KEY_RSA_CERT: return BN_num_bits(k->rsa->n); case KEY_DSA: - case KEY_DSA_CERT_V00: case KEY_DSA_CERT: return BN_num_bits(k->dsa->p); case KEY_ECDSA: @@ -281,18 +275,6 @@ sshkey_size(const struct sshkey *k) return 0; } -int -sshkey_cert_is_legacy(const struct sshkey *k) -{ - switch (k->type) { - case KEY_DSA_CERT_V00: - case KEY_RSA_CERT_V00: - return 1; - default: - return 0; - } -} - static int sshkey_type_is_valid_ca(int type) { @@ -320,10 +302,8 @@ int sshkey_type_plain(int type) { switch (type) { - case KEY_RSA_CERT_V00: case KEY_RSA_CERT: return KEY_RSA; - case KEY_DSA_CERT_V00: case KEY_DSA_CERT: return KEY_DSA; case KEY_ECDSA_CERT: @@ -480,7 +460,6 @@ sshkey_new(int type) #ifdef WITH_OPENSSL case KEY_RSA1: case KEY_RSA: - case KEY_RSA_CERT_V00: case KEY_RSA_CERT: if ((rsa = RSA_new()) == NULL || (rsa->n = BN_new()) == NULL || @@ -493,7 +472,6 @@ sshkey_new(int type) k->rsa = rsa; break; case KEY_DSA: - case KEY_DSA_CERT_V00: case KEY_DSA_CERT: if ((dsa = DSA_new()) == NULL || (dsa->p = BN_new()) == NULL || @@ -541,7 +519,6 @@ sshkey_add_private(struct sshkey *k) #ifdef WITH_OPENSSL case KEY_RSA1: case KEY_RSA: - case KEY_RSA_CERT_V00: case KEY_RSA_CERT: #define bn_maybe_alloc_failed(p) (p == NULL && (p = BN_new()) == NULL) if (bn_maybe_alloc_failed(k->rsa->d) || @@ -553,7 +530,6 @@ sshkey_add_private(struct sshkey *k) return SSH_ERR_ALLOC_FAIL; break; case KEY_DSA: - case KEY_DSA_CERT_V00: case KEY_DSA_CERT: if (bn_maybe_alloc_failed(k->dsa->priv_key)) return SSH_ERR_ALLOC_FAIL; @@ -599,14 +575,12 @@ sshkey_free(struct sshkey *k) #ifdef WITH_OPENSSL case KEY_RSA1: case KEY_RSA: - case KEY_RSA_CERT_V00: case KEY_RSA_CERT: if (k->rsa != NULL) RSA_free(k->rsa); k->rsa = NULL; break; case KEY_DSA: - case KEY_DSA_CERT_V00: case KEY_DSA_CERT: if (k->dsa != NULL) DSA_free(k->dsa); @@ -676,13 +650,11 @@ sshkey_equal_public(const struct sshkey switch (a->type) { #ifdef WITH_OPENSSL case KEY_RSA1: - case KEY_RSA_CERT_V00: case KEY_RSA_CERT: case KEY_RSA: return a->rsa != NULL && b->rsa != NULL && BN_cmp(a->rsa->e, b->rsa->e) == 0 && BN_cmp(a->rsa->n, b->rsa->n) == 0; - case KEY_DSA_CERT_V00: case KEY_DSA_CERT: case KEY_DSA: return a->dsa != NULL && b->dsa != NULL && @@ -751,8 +723,6 @@ to_blob_buf(const struct sshkey *key, st switch (type) { #ifdef WITH_OPENSSL - case KEY_DSA_CERT_V00: - case KEY_RSA_CERT_V00: case KEY_DSA_CERT: case KEY_ECDSA_CERT: case KEY_RSA_CERT: @@ -1274,8 +1244,6 @@ sshkey_read(struct sshkey *ret, char **c case KEY_DSA: case KEY_ECDSA: case KEY_ED25519: - case KEY_DSA_CERT_V00: - case KEY_RSA_CERT_V00: case KEY_DSA_CERT: case KEY_ECDSA_CERT: case KEY_RSA_CERT: @@ -1766,7 +1734,6 @@ sshkey_from_private(const struct sshkey switch (k->type) { #ifdef WITH_OPENSSL case KEY_DSA: - case KEY_DSA_CERT_V00: case KEY_DSA_CERT: if ((n = sshkey_new(k->type)) == NULL) return SSH_ERR_ALLOC_FAIL; @@ -1796,7 +1763,6 @@ sshkey_from_private(const struct sshkey break; case KEY_RSA: case KEY_RSA1: - case KEY_RSA_CERT_V00: case KEY_RSA_CERT: if ((n = sshkey_new(k->type)) == NULL) return SSH_ERR_ALLOC_FAIL; @@ -1840,21 +1806,20 @@ cert_parse(struct sshbuf *b, struct sshk u_char *sig = NULL; size_t signed_len = 0, slen = 0, kidlen = 0; int ret = SSH_ERR_INTERNAL_ERROR; - int v00 = sshkey_cert_is_legacy(key); /* Copy the entire key blob for verification and later serialisation */ if ((ret = sshbuf_putb(key->cert->certblob, certbuf)) != 0) return ret; - if ((!v00 && (ret = sshbuf_get_u64(b, &key->cert->serial)) != 0) || + /* Parse body of certificate up to signature */ + if ((ret = sshbuf_get_u64(b, &key->cert->serial)) != 0 || (ret = sshbuf_get_u32(b, &key->cert->type)) != 0 || (ret = sshbuf_get_cstring(b, &key->cert->key_id, &kidlen)) != 0 || (ret = sshbuf_froms(b, &principals)) != 0 || (ret = sshbuf_get_u64(b, &key->cert->valid_after)) != 0 || (ret = sshbuf_get_u64(b, &key->cert->valid_before)) != 0 || (ret = sshbuf_froms(b, &crit)) != 0 || - (!v00 && (ret = sshbuf_froms(b, &exts)) != 0) || - (v00 && (ret = sshbuf_get_string_direct(b, NULL, NULL)) != 0) || + (ret = sshbuf_froms(b, &exts)) != 0 || (ret = sshbuf_get_string_direct(b, NULL, NULL)) != 0 || (ret = sshbuf_froms(b, &ca)) != 0) { /* XXX debug print error for ret */ @@ -1891,9 +1856,8 @@ cert_parse(struct sshbuf *b, struct sshk goto out; } oprincipals = key->cert->principals; - key->cert->principals = realloc(key->cert->principals, - (key->cert->nprincipals + 1) * - sizeof(*key->cert->principals)); + key->cert->principals = reallocarray(key->cert->principals, + key->cert->nprincipals + 1, sizeof(*key->cert->principals)); if (key->cert->principals == NULL) { free(principal); key->cert->principals = oprincipals; @@ -1914,7 +1878,6 @@ cert_parse(struct sshbuf *b, struct sshk /* * Validate critical options and extensions sections format. - * NB. extensions are not present in v00 certs. */ while (sshbuf_len(crit) != 0) { if ((ret = sshbuf_get_string_direct(crit, NULL, NULL)) != 0 || @@ -1999,7 +1962,6 @@ sshkey_from_blob_internal(struct sshbuf } /* FALLTHROUGH */ case KEY_RSA: - case KEY_RSA_CERT_V00: if ((key = sshkey_new(type)) == NULL) { ret = SSH_ERR_ALLOC_FAIL; goto out; @@ -2021,7 +1983,6 @@ sshkey_from_blob_internal(struct sshbuf } /* FALLTHROUGH */ case KEY_DSA: - case KEY_DSA_CERT_V00: if ((key = sshkey_new(type)) == NULL) { ret = SSH_ERR_ALLOC_FAIL; goto out; @@ -2189,14 +2150,12 @@ sshkey_sign(const struct sshkey *key, return SSH_ERR_INVALID_ARGUMENT; switch (key->type) { #ifdef WITH_OPENSSL - case KEY_DSA_CERT_V00: case KEY_DSA_CERT: case KEY_DSA: return ssh_dss_sign(key, sigp, lenp, data, datalen, compat); case KEY_ECDSA_CERT: case KEY_ECDSA: return ssh_ecdsa_sign(key, sigp, lenp, data, datalen, compat); - case KEY_RSA_CERT_V00: case KEY_RSA_CERT: case KEY_RSA: return ssh_rsa_sign(key, sigp, lenp, data, datalen, compat); @@ -2221,14 +2180,12 @@ sshkey_verify(const struct sshkey *key, return SSH_ERR_INVALID_ARGUMENT; switch (key->type) { #ifdef WITH_OPENSSL - case KEY_DSA_CERT_V00: case KEY_DSA_CERT: case KEY_DSA: return ssh_dss_verify(key, sig, siglen, data, dlen, compat); case KEY_ECDSA_CERT: case KEY_ECDSA: return ssh_ecdsa_verify(key, sig, siglen, data, dlen, compat); - case KEY_RSA_CERT_V00: case KEY_RSA_CERT: case KEY_RSA: return ssh_rsa_verify(key, sig, siglen, data, dlen, compat); @@ -2264,7 +2221,6 @@ sshkey_demote(const struct sshkey *k, st switch (k->type) { #ifdef WITH_OPENSSL - case KEY_RSA_CERT_V00: case KEY_RSA_CERT: if ((ret = sshkey_cert_copy(k, pk)) != 0) goto fail; @@ -2278,7 +2234,6 @@ sshkey_demote(const struct sshkey *k, st goto fail; } break; - case KEY_DSA_CERT_V00: case KEY_DSA_CERT: if ((ret = sshkey_cert_copy(k, pk)) != 0) goto fail; @@ -2335,27 +2290,23 @@ sshkey_demote(const struct sshkey *k, st /* Convert a plain key to their _CERT equivalent */ int -sshkey_to_certified(struct sshkey *k, int legacy) +sshkey_to_certified(struct sshkey *k) { int newtype; switch (k->type) { #ifdef WITH_OPENSSL case KEY_RSA: - newtype = legacy ? KEY_RSA_CERT_V00 : KEY_RSA_CERT; + newtype = KEY_RSA_CERT; break; case KEY_DSA: - newtype = legacy ? KEY_DSA_CERT_V00 : KEY_DSA_CERT; + newtype = KEY_DSA_CERT; break; case KEY_ECDSA: - if (legacy) - return SSH_ERR_INVALID_ARGUMENT; newtype = KEY_ECDSA_CERT; break; #endif /* WITH_OPENSSL */ case KEY_ED25519: - if (legacy) - return SSH_ERR_INVALID_ARGUMENT; newtype = KEY_ED25519_CERT; break; default: @@ -2407,15 +2358,12 @@ sshkey_certify(struct sshkey *k, struct /* -v01 certs put nonce first */ arc4random_buf(&nonce, sizeof(nonce)); - if (!sshkey_cert_is_legacy(k)) { - if ((ret = sshbuf_put_string(cert, nonce, sizeof(nonce))) != 0) - goto out; - } + if ((ret = sshbuf_put_string(cert, nonce, sizeof(nonce))) != 0) + goto out; /* XXX this substantially duplicates to_blob(); refactor */ switch (k->type) { #ifdef WITH_OPENSSL - case KEY_DSA_CERT_V00: case KEY_DSA_CERT: if ((ret = sshbuf_put_bignum2(cert, k->dsa->p)) != 0 || (ret = sshbuf_put_bignum2(cert, k->dsa->q)) != 0 || @@ -2431,7 +2379,6 @@ sshkey_certify(struct sshkey *k, struct EC_KEY_get0_group(k->ecdsa))) != 0) goto out; break; - case KEY_RSA_CERT_V00: case KEY_RSA_CERT: if ((ret = sshbuf_put_bignum2(cert, k->rsa->e)) != 0 || (ret = sshbuf_put_bignum2(cert, k->rsa->n)) != 0) @@ -2448,13 +2395,8 @@ sshkey_certify(struct sshkey *k, struct goto out; } - /* -v01 certs have a serial number next */ - if (!sshkey_cert_is_legacy(k)) { - if ((ret = sshbuf_put_u64(cert, k->cert->serial)) != 0) - goto out; - } - - if ((ret = sshbuf_put_u32(cert, k->cert->type)) != 0 || + if ((ret = sshbuf_put_u64(cert, k->cert->serial)) != 0 || + (ret = sshbuf_put_u32(cert, k->cert->type)) != 0 || (ret = sshbuf_put_cstring(cert, k->cert->key_id)) != 0) goto out; @@ -2470,22 +2412,9 @@ sshkey_certify(struct sshkey *k, struct if ((ret = sshbuf_put_stringb(cert, principals)) != 0 || (ret = sshbuf_put_u64(cert, k->cert->valid_after)) != 0 || (ret = sshbuf_put_u64(cert, k->cert->valid_before)) != 0 || - (ret = sshbuf_put_stringb(cert, k->cert->critical)) != 0) - goto out; - - /* -v01 certs have non-critical options here */ - if (!sshkey_cert_is_legacy(k)) { - if ((ret = sshbuf_put_stringb(cert, k->cert->extensions)) != 0) - goto out; - } - - /* -v00 certs put the nonce at the end */ - if (sshkey_cert_is_legacy(k)) { - if ((ret = sshbuf_put_string(cert, nonce, sizeof(nonce))) != 0) - goto out; - } - - if ((ret = sshbuf_put_string(cert, NULL, 0)) != 0 || /* Reserved */ + (ret = sshbuf_put_stringb(cert, k->cert->critical)) != 0 || + (ret = sshbuf_put_stringb(cert, k->cert->extensions)) != 0 || + (ret = sshbuf_put_string(cert, NULL, 0)) != 0 || /* Reserved */ (ret = sshbuf_put_string(cert, ca_blob, ca_len)) != 0) goto out; @@ -2585,7 +2514,6 @@ sshkey_private_serialize(const struct ss (r = sshbuf_put_bignum2(b, key->rsa->q)) != 0) goto out; break; - case KEY_RSA_CERT_V00: case KEY_RSA_CERT: if (key->cert == NULL || sshbuf_len(key->cert->certblob) == 0) { r = SSH_ERR_INVALID_ARGUMENT; @@ -2606,7 +2534,6 @@ sshkey_private_serialize(const struct ss (r = sshbuf_put_bignum2(b, key->dsa->priv_key)) != 0) goto out; break; - case KEY_DSA_CERT_V00: case KEY_DSA_CERT: if (key->cert == NULL || sshbuf_len(key->cert->certblob) == 0) { r = SSH_ERR_INVALID_ARGUMENT; @@ -2695,7 +2622,6 @@ sshkey_private_deserialize(struct sshbuf (r = sshbuf_get_bignum2(buf, k->dsa->priv_key)) != 0) goto out; break; - case KEY_DSA_CERT_V00: case KEY_DSA_CERT: if ((r = sshkey_froms(buf, &k)) != 0 || (r = sshkey_add_private(k)) != 0 || @@ -2766,7 +2692,6 @@ sshkey_private_deserialize(struct sshbuf (r = rsa_generate_additional_parameters(k->rsa)) != 0) goto out; break; - case KEY_RSA_CERT_V00: case KEY_RSA_CERT: if ((r = sshkey_froms(buf, &k)) != 0 || (r = sshkey_add_private(k)) != 0 || @@ -2816,7 +2741,6 @@ sshkey_private_deserialize(struct sshbuf /* enable blinding */ switch (k->type) { case KEY_RSA: - case KEY_RSA_CERT_V00: case KEY_RSA_CERT: case KEY_RSA1: if (RSA_blinding_on(k->rsa, NULL) != 1) { Index: src/crypto/external/bsd/openssh/dist/sshpty.c diff -u src/crypto/external/bsd/openssh/dist/sshpty.c:1.4 src/crypto/external/bsd/openssh/dist/sshpty.c:1.5 --- src/crypto/external/bsd/openssh/dist/sshpty.c:1.4 Fri Apr 3 19:58:19 2015 +++ src/crypto/external/bsd/openssh/dist/sshpty.c Thu Aug 13 06:33:21 2015 @@ -1,5 +1,5 @@ -/* $NetBSD: sshpty.c,v 1.4 2015/04/03 23:58:19 christos Exp $ */ -/* $OpenBSD: sshpty.c,v 1.29 2014/09/03 18:55:07 djm Exp $ */ +/* $NetBSD: sshpty.c,v 1.5 2015/08/13 10:33:21 christos Exp $ */ +/* $OpenBSD: sshpty.c,v 1.30 2015/07/30 23:09:15 djm Exp $ */ /* * Author: Tatu Ylonen <y...@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <y...@cs.hut.fi>, Espoo, Finland @@ -14,7 +14,7 @@ */ #include "includes.h" -__RCSID("$NetBSD: sshpty.c,v 1.4 2015/04/03 23:58:19 christos Exp $"); +__RCSID("$NetBSD: sshpty.c,v 1.5 2015/08/13 10:33:21 christos Exp $"); #include <sys/types.h> #include <sys/ioctl.h> #include <sys/stat.h> @@ -145,7 +145,7 @@ pty_setowner(struct passwd *pw, const ch /* Determine the group to make the owner of the tty. */ grp = getgrnam("tty"); gid = (grp != NULL) ? grp->gr_gid : pw->pw_gid; - mode = (grp != NULL) ? 0622 : 0600; + mode = (grp != NULL) ? 0620 : 0600; /* * Change owner and mode of the tty as required. Index: src/crypto/external/bsd/openssh/dist/PROTOCOL diff -u src/crypto/external/bsd/openssh/dist/PROTOCOL:1.6 src/crypto/external/bsd/openssh/dist/PROTOCOL:1.7 --- src/crypto/external/bsd/openssh/dist/PROTOCOL:1.6 Thu Jul 2 20:59:59 2015 +++ src/crypto/external/bsd/openssh/dist/PROTOCOL Thu Aug 13 06:33:21 2015 @@ -247,7 +247,6 @@ to request that the server make a connec uint32 initial window size uint32 maximum packet size string socket path - string reserved for future use Similar to forwarded-tcpip, forwarded-streamlocal is sent by the server when the client has previously send the server a streamlocal-forward @@ -453,5 +452,5 @@ respond with a SSH_FXP_STATUS message. This extension is advertised in the SSH_FXP_VERSION hello with version "1". -$OpenBSD: PROTOCOL,v 1.28 2015/05/08 03:56:51 djm Exp $ -$NetBSD: PROTOCOL,v 1.6 2015/07/03 00:59:59 christos Exp $ +$OpenBSD: PROTOCOL,v 1.29 2015/07/17 03:09:19 djm Exp $ +$NetBSD: PROTOCOL,v 1.7 2015/08/13 10:33:21 christos Exp $ Index: src/crypto/external/bsd/openssh/dist/krl.c diff -u src/crypto/external/bsd/openssh/dist/krl.c:1.6 src/crypto/external/bsd/openssh/dist/krl.c:1.7 --- src/crypto/external/bsd/openssh/dist/krl.c:1.6 Thu Jul 2 21:00:00 2015 +++ src/crypto/external/bsd/openssh/dist/krl.c Thu Aug 13 06:33:21 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: krl.c,v 1.6 2015/07/03 01:00:00 christos Exp $ */ +/* $NetBSD: krl.c,v 1.7 2015/08/13 10:33:21 christos Exp $ */ /* * Copyright (c) 2012 Damien Miller <d...@mindrot.org> * @@ -16,9 +16,9 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: krl.c,v 1.6 2015/07/03 01:00:00 christos Exp $"); +__RCSID("$NetBSD: krl.c,v 1.7 2015/08/13 10:33:21 christos Exp $"); -/* $OpenBSD: krl.c,v 1.32 2015/06/24 23:47:23 djm Exp $ */ +/* $OpenBSD: krl.c,v 1.33 2015/07/03 03:43:18 djm Exp $ */ #include "includes.h" #include <sys/param.h> /* MIN */ @@ -435,7 +435,7 @@ ssh_krl_revoke_key(struct ssh_krl *krl, if (!sshkey_is_cert(key)) return ssh_krl_revoke_key_sha1(krl, key); - if (sshkey_cert_is_legacy(key) || key->cert->serial == 0) { + if (key->cert->serial == 0) { return ssh_krl_revoke_cert_by_key_id(krl, key->cert->signature_key, key->cert->key_id); @@ -1186,10 +1186,10 @@ is_cert_revoked(const struct sshkey *key } /* - * Legacy cert formats lack serial numbers. Zero serials numbers - * are ignored (it's the default when the CA doesn't specify one). + * Zero serials numbers are ignored (it's the default when the + * CA doesn't specify one). */ - if (sshkey_cert_is_legacy(key) || key->cert->serial == 0) + if (key->cert->serial == 0) return 0; memset(&rs, 0, sizeof(rs)); Index: src/crypto/external/bsd/openssh/dist/PROTOCOL.mux diff -u src/crypto/external/bsd/openssh/dist/PROTOCOL.mux:1.7 src/crypto/external/bsd/openssh/dist/PROTOCOL.mux:1.8 --- src/crypto/external/bsd/openssh/dist/PROTOCOL.mux:1.7 Fri Apr 3 19:58:19 2015 +++ src/crypto/external/bsd/openssh/dist/PROTOCOL.mux Thu Aug 13 06:33:21 2015 @@ -116,6 +116,12 @@ A client may request the master to estab forwarding type may be MUX_FWD_LOCAL, MUX_FWD_REMOTE, MUX_FWD_DYNAMIC. +If listen port is (unsigned int) -2, then the listen host is treated as +a unix socket path name. + +If connect port is (unsigned int) -2, then the connect host is treated +as a unix socket path name. + A server may reply with a MUX_S_OK, a MUX_S_REMOTE_PORT, a MUX_S_PERMISSION_DENIED or a MUX_S_FAILURE. @@ -219,5 +225,5 @@ XXX inject packet (what about replies) XXX server->client error/warning notifications XXX send signals via mux -$OpenBSD: PROTOCOL.mux,v 1.9 2012/06/01 00:49:35 djm Exp $ -$NetBSD: PROTOCOL.mux,v 1.7 2015/04/03 23:58:19 christos Exp $ +$OpenBSD: PROTOCOL.mux,v 1.10 2015/07/17 03:04:27 djm Exp $ +$NetBSD: PROTOCOL.mux,v 1.8 2015/08/13 10:33:21 christos Exp $ Index: src/crypto/external/bsd/openssh/dist/cipher.h diff -u src/crypto/external/bsd/openssh/dist/cipher.h:1.7 src/crypto/external/bsd/openssh/dist/cipher.h:1.8 --- src/crypto/external/bsd/openssh/dist/cipher.h:1.7 Fri Apr 3 19:58:19 2015 +++ src/crypto/external/bsd/openssh/dist/cipher.h Thu Aug 13 06:33:21 2015 @@ -1,5 +1,5 @@ -/* $NetBSD: cipher.h,v 1.7 2015/04/03 23:58:19 christos Exp $ */ -/* $OpenBSD: cipher.h,v 1.47 2015/01/14 10:24:42 markus Exp $ */ +/* $NetBSD: cipher.h,v 1.8 2015/08/13 10:33:21 christos Exp $ */ +/* $OpenBSD: cipher.h,v 1.48 2015/07/08 19:09:25 markus Exp $ */ /* * Author: Tatu Ylonen <y...@cs.hut.fi> @@ -73,9 +73,6 @@ struct sshcipher_ctx { const struct sshcipher *cipher; }; -typedef struct sshcipher Cipher; -typedef struct sshcipher_ctx CipherContext; - u_int cipher_mask_ssh1(int); const struct sshcipher *cipher_by_name(const char *); const struct sshcipher *cipher_by_number(int); Index: src/crypto/external/bsd/openssh/dist/addrmatch.c diff -u src/crypto/external/bsd/openssh/dist/addrmatch.c:1.8 src/crypto/external/bsd/openssh/dist/addrmatch.c:1.9 --- src/crypto/external/bsd/openssh/dist/addrmatch.c:1.8 Fri Apr 3 19:58:19 2015 +++ src/crypto/external/bsd/openssh/dist/addrmatch.c Thu Aug 13 06:33:21 2015 @@ -1,5 +1,5 @@ -/* $NetBSD: addrmatch.c,v 1.8 2015/04/03 23:58:19 christos Exp $ */ -/* $OpenBSD: addrmatch.c,v 1.9 2014/01/19 11:21:51 dtucker Exp $ */ +/* $NetBSD: addrmatch.c,v 1.9 2015/08/13 10:33:21 christos Exp $ */ +/* $OpenBSD: addrmatch.c,v 1.10 2015/07/08 19:04:21 markus Exp $ */ /* * Copyright (c) 2004-2008 Damien Miller <d...@mindrot.org> @@ -18,7 +18,7 @@ */ #include "includes.h" -__RCSID("$NetBSD: addrmatch.c,v 1.8 2015/04/03 23:58:19 christos Exp $"); +__RCSID("$NetBSD: addrmatch.c,v 1.9 2015/08/13 10:33:21 christos Exp $"); #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> @@ -32,7 +32,6 @@ __RCSID("$NetBSD: addrmatch.c,v 1.8 2015 #include "match.h" #include "log.h" -#include "xmalloc.h" struct xaddr { sa_family_t af; Index: src/crypto/external/bsd/openssh/dist/auth2-chall.c diff -u src/crypto/external/bsd/openssh/dist/auth2-chall.c:1.8 src/crypto/external/bsd/openssh/dist/auth2-chall.c:1.9 --- src/crypto/external/bsd/openssh/dist/auth2-chall.c:1.8 Wed Jul 29 11:04:40 2015 +++ src/crypto/external/bsd/openssh/dist/auth2-chall.c Thu Aug 13 06:33:21 2015 @@ -1,5 +1,5 @@ -/* $NetBSD: auth2-chall.c,v 1.8 2015/07/29 15:04:40 christos Exp $ */ -/* $OpenBSD: auth2-chall.c,v 1.42 2015/01/19 20:07:45 markus Exp $ */ +/* $NetBSD: auth2-chall.c,v 1.9 2015/08/13 10:33:21 christos Exp $ */ +/* $OpenBSD: auth2-chall.c,v 1.43 2015/07/18 07:57:14 djm Exp $ */ /* * Copyright (c) 2001 Markus Friedl. All rights reserved. * Copyright (c) 2001 Per Allansson. All rights reserved. @@ -26,7 +26,7 @@ */ #include "includes.h" -__RCSID("$NetBSD: auth2-chall.c,v 1.8 2015/07/29 15:04:40 christos Exp $"); +__RCSID("$NetBSD: auth2-chall.c,v 1.9 2015/08/13 10:33:21 christos Exp $"); #include <sys/types.h> #include <stdio.h> Index: src/crypto/external/bsd/openssh/dist/ssh-pkcs11.c diff -u src/crypto/external/bsd/openssh/dist/ssh-pkcs11.c:1.8 src/crypto/external/bsd/openssh/dist/ssh-pkcs11.c:1.9 --- src/crypto/external/bsd/openssh/dist/ssh-pkcs11.c:1.8 Thu Jul 2 21:00:00 2015 +++ src/crypto/external/bsd/openssh/dist/ssh-pkcs11.c Thu Aug 13 06:33:21 2015 @@ -1,5 +1,5 @@ -/* $NetBSD: ssh-pkcs11.c,v 1.8 2015/07/03 01:00:00 christos Exp $ */ -/* $OpenBSD: ssh-pkcs11.c,v 1.19 2015/05/27 05:15:02 djm Exp $ */ +/* $NetBSD: ssh-pkcs11.c,v 1.9 2015/08/13 10:33:21 christos Exp $ */ +/* $OpenBSD: ssh-pkcs11.c,v 1.21 2015/07/18 08:02:17 djm Exp $ */ /* * Copyright (c) 2010 Markus Friedl. All rights reserved. * @@ -16,7 +16,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include "includes.h" -__RCSID("$NetBSD: ssh-pkcs11.c,v 1.8 2015/07/03 01:00:00 christos Exp $"); +__RCSID("$NetBSD: ssh-pkcs11.c,v 1.9 2015/08/13 10:33:21 christos Exp $"); #include <sys/types.h> #include <sys/queue.h> @@ -475,15 +475,23 @@ pkcs11_fetch_keys_filter(struct pkcs11_p error("C_GetAttributeValue failed: %lu", rv); continue; } - /* check that none of the attributes are zero length */ - if (attribs[0].ulValueLen == 0 || - attribs[1].ulValueLen == 0 || + /* + * Allow CKA_ID (always first attribute) to be empty, but + * ensure that none of the others are zero length. + * XXX assumes CKA_ID is always first. + */ + if (attribs[1].ulValueLen == 0 || attribs[2].ulValueLen == 0) { continue; } /* allocate buffers for attributes */ - for (i = 0; i < 3; i++) - attribs[i].pValue = xmalloc(attribs[i].ulValueLen); + for (i = 0; i < 3; i++) { + if (attribs[i].ulValueLen > 0) { + attribs[i].pValue = xmalloc( + attribs[i].ulValueLen); + } + } + /* * retrieve ID, modulus and public exponent of RSA key, * or ID, subject and value for certificates. @@ -625,6 +633,11 @@ pkcs11_add_provider(char *provider_id, c error("C_GetTokenInfo failed: %lu", rv); continue; } + if ((token->flags & CKF_TOKEN_INITIALIZED) == 0) { + debug2("%s: ignoring uninitialised token in slot %lu", + __func__, (unsigned long)i); + continue; + } rmspace(token->label, sizeof(token->label)); rmspace(token->manufacturerID, sizeof(token->manufacturerID)); rmspace(token->model, sizeof(token->model)); Index: src/crypto/external/bsd/openssh/dist/auth-options.c diff -u src/crypto/external/bsd/openssh/dist/auth-options.c:1.10 src/crypto/external/bsd/openssh/dist/auth-options.c:1.11 --- src/crypto/external/bsd/openssh/dist/auth-options.c:1.10 Thu Jul 2 20:59:59 2015 +++ src/crypto/external/bsd/openssh/dist/auth-options.c Thu Aug 13 06:33:21 2015 @@ -1,5 +1,5 @@ -/* $NetBSD: auth-options.c,v 1.10 2015/07/03 00:59:59 christos Exp $ */ -/* $OpenBSD: auth-options.c,v 1.67 2015/05/01 03:20:54 djm Exp $ */ +/* $NetBSD: auth-options.c,v 1.11 2015/08/13 10:33:21 christos Exp $ */ +/* $OpenBSD: auth-options.c,v 1.68 2015/07/03 03:43:18 djm Exp $ */ /* * Author: Tatu Ylonen <y...@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <y...@cs.hut.fi>, Espoo, Finland @@ -12,7 +12,7 @@ */ #include "includes.h" -__RCSID("$NetBSD: auth-options.c,v 1.10 2015/07/03 00:59:59 christos Exp $"); +__RCSID("$NetBSD: auth-options.c,v 1.11 2015/08/13 10:33:21 christos Exp $"); #include <sys/types.h> #include <sys/queue.h> @@ -590,35 +590,21 @@ auth_cert_options(struct sshkey *k, stru char *cert_forced_command = NULL; int cert_source_address_done = 0; - if (sshkey_cert_is_legacy(k)) { - /* All options are in the one field for v00 certs */ - if (parse_option_list(k->cert->critical, pw, - OPTIONS_CRITICAL|OPTIONS_EXTENSIONS, 1, - &cert_no_port_forwarding_flag, - &cert_no_agent_forwarding_flag, - &cert_no_x11_forwarding_flag, - &cert_no_pty_flag, - &cert_no_user_rc, - &cert_forced_command, - &cert_source_address_done) == -1) - return -1; - } else { - /* Separate options and extensions for v01 certs */ - if (parse_option_list(k->cert->critical, pw, - OPTIONS_CRITICAL, 1, NULL, NULL, NULL, NULL, NULL, - &cert_forced_command, - &cert_source_address_done) == -1) - return -1; - if (parse_option_list(k->cert->extensions, pw, - OPTIONS_EXTENSIONS, 0, - &cert_no_port_forwarding_flag, - &cert_no_agent_forwarding_flag, - &cert_no_x11_forwarding_flag, - &cert_no_pty_flag, - &cert_no_user_rc, - NULL, NULL) == -1) - return -1; - } + /* Separate options and extensions for v01 certs */ + if (parse_option_list(k->cert->critical, pw, + OPTIONS_CRITICAL, 1, NULL, NULL, NULL, NULL, NULL, + &cert_forced_command, + &cert_source_address_done) == -1) + return -1; + if (parse_option_list(k->cert->extensions, pw, + OPTIONS_EXTENSIONS, 0, + &cert_no_port_forwarding_flag, + &cert_no_agent_forwarding_flag, + &cert_no_x11_forwarding_flag, + &cert_no_pty_flag, + &cert_no_user_rc, + NULL, NULL) == -1) + return -1; no_port_forwarding_flag |= cert_no_port_forwarding_flag; no_agent_forwarding_flag |= cert_no_agent_forwarding_flag; Index: src/crypto/external/bsd/openssh/dist/auth.c diff -u src/crypto/external/bsd/openssh/dist/auth.c:1.13 src/crypto/external/bsd/openssh/dist/auth.c:1.14 --- src/crypto/external/bsd/openssh/dist/auth.c:1.13 Thu Jul 2 20:59:59 2015 +++ src/crypto/external/bsd/openssh/dist/auth.c Thu Aug 13 06:33:21 2015 @@ -1,5 +1,5 @@ -/* $NetBSD: auth.c,v 1.13 2015/07/03 00:59:59 christos Exp $ */ -/* $OpenBSD: auth.c,v 1.111 2015/05/01 04:17:51 djm Exp $ */ +/* $NetBSD: auth.c,v 1.14 2015/08/13 10:33:21 christos Exp $ */ +/* $OpenBSD: auth.c,v 1.112 2015/08/06 14:53:21 deraadt Exp $ */ /* * Copyright (c) 2000 Markus Friedl. All rights reserved. * @@ -25,7 +25,7 @@ */ #include "includes.h" -__RCSID("$NetBSD: auth.c,v 1.13 2015/07/03 00:59:59 christos Exp $"); +__RCSID("$NetBSD: auth.c,v 1.14 2015/08/13 10:33:21 christos Exp $"); #include <sys/types.h> #include <sys/stat.h> @@ -390,7 +390,9 @@ auth_root_allowed(const char *method) case PERMIT_YES: return 1; case PERMIT_NO_PASSWD: - if (strcmp(method, "password") != 0) + if (strcmp(method, "publickey") == 0 || + strcmp(method, "hostbased") == 0 || + strcmp(method, "gssapi-with-mic")) return 1; break; case PERMIT_FORCED_ONLY: Index: src/crypto/external/bsd/openssh/dist/ssh-keygen.1 diff -u src/crypto/external/bsd/openssh/dist/ssh-keygen.1:1.13 src/crypto/external/bsd/openssh/dist/ssh-keygen.1:1.14 --- src/crypto/external/bsd/openssh/dist/ssh-keygen.1:1.13 Fri Apr 3 19:58:19 2015 +++ src/crypto/external/bsd/openssh/dist/ssh-keygen.1 Thu Aug 13 06:33:21 2015 @@ -1,5 +1,5 @@ -.\" $NetBSD: ssh-keygen.1,v 1.13 2015/04/03 23:58:19 christos Exp $ -.\" $OpenBSD: ssh-keygen.1,v 1.125 2015/02/24 15:24:05 naddy Exp $ +.\" $NetBSD: ssh-keygen.1,v 1.14 2015/08/13 10:33:21 christos Exp $ +.\" $OpenBSD: ssh-keygen.1,v 1.126 2015/07/03 03:49:45 djm Exp $ .\" .\" -*- nroff -*- .\" @@ -38,7 +38,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd February 24 2015 +.Dd July 3 2015 .Dt SSH-KEYGEN 1 .Os .Sh NAME @@ -247,7 +247,7 @@ This option specifies the number of prim Show the bubblebabble digest of specified private or public key file. .It Fl b Ar bits Specifies the number of bits in the key to create. -For RSA keys, the minimum size is 768 bits and the default is 2048 bits. +For RSA keys, the minimum size is 1024 bits and the default is 2048 bits. Generally, 2048 bits is considered sufficient. DSA keys must be exactly 1024 bits as specified by FIPS 186-2. For ECDSA keys, the Index: src/crypto/external/bsd/openssh/dist/authfd.c diff -u src/crypto/external/bsd/openssh/dist/authfd.c:1.9 src/crypto/external/bsd/openssh/dist/authfd.c:1.10 --- src/crypto/external/bsd/openssh/dist/authfd.c:1.9 Thu Jul 2 20:59:59 2015 +++ src/crypto/external/bsd/openssh/dist/authfd.c Thu Aug 13 06:33:21 2015 @@ -1,5 +1,5 @@ -/* $NetBSD: authfd.c,v 1.9 2015/07/03 00:59:59 christos Exp $ */ -/* $OpenBSD: authfd.c,v 1.97 2015/03/26 19:32:19 markus Exp $ */ +/* $NetBSD: authfd.c,v 1.10 2015/08/13 10:33:21 christos Exp $ */ +/* $OpenBSD: authfd.c,v 1.98 2015/07/03 03:43:18 djm Exp $ */ /* * Author: Tatu Ylonen <y...@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <y...@cs.hut.fi>, Espoo, Finland @@ -37,7 +37,7 @@ */ #include "includes.h" -__RCSID("$NetBSD: authfd.c,v 1.9 2015/07/03 00:59:59 christos Exp $"); +__RCSID("$NetBSD: authfd.c,v 1.10 2015/08/13 10:33:21 christos Exp $"); #include <sys/types.h> #include <sys/un.h> #include <sys/socket.h> @@ -560,10 +560,8 @@ ssh_add_identity_constrained(int sock, s #ifdef WITH_OPENSSL case KEY_RSA: case KEY_RSA_CERT: - case KEY_RSA_CERT_V00: case KEY_DSA: case KEY_DSA_CERT: - case KEY_DSA_CERT_V00: case KEY_ECDSA: case KEY_ECDSA_CERT: #endif Index: src/crypto/external/bsd/openssh/dist/kex.h diff -u src/crypto/external/bsd/openssh/dist/kex.h:1.9 src/crypto/external/bsd/openssh/dist/kex.h:1.10 --- src/crypto/external/bsd/openssh/dist/kex.h:1.9 Fri Apr 3 19:58:19 2015 +++ src/crypto/external/bsd/openssh/dist/kex.h Thu Aug 13 06:33:21 2015 @@ -1,5 +1,5 @@ -/* $NetBSD: kex.h,v 1.9 2015/04/03 23:58:19 christos Exp $ */ -/* $OpenBSD: kex.h,v 1.71 2015/02/16 22:13:32 djm Exp $ */ +/* $NetBSD: kex.h,v 1.10 2015/08/13 10:33:21 christos Exp $ */ +/* $OpenBSD: kex.h,v 1.73 2015/07/30 00:01:34 djm Exp $ */ /* * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. @@ -128,6 +128,7 @@ struct kex { int ec_nid; char *client_version_string; char *server_version_string; + char *failed_choice; int (*verify_host_key)(struct sshkey *, struct ssh *); struct sshkey *(*load_host_public_key)(int, int, struct ssh *); struct sshkey *(*load_host_private_key)(int, int, struct ssh *); @@ -146,6 +147,8 @@ struct kex { int kex_names_valid(const 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 *, const char *[PROPOSAL_MAX], struct kex **); int kex_setup(struct ssh *, const char *[PROPOSAL_MAX]); Index: src/crypto/external/bsd/openssh/dist/key.h diff -u src/crypto/external/bsd/openssh/dist/key.h:1.9 src/crypto/external/bsd/openssh/dist/key.h:1.10 --- src/crypto/external/bsd/openssh/dist/key.h:1.9 Fri Apr 3 19:58:19 2015 +++ src/crypto/external/bsd/openssh/dist/key.h Thu Aug 13 06:33:21 2015 @@ -1,5 +1,5 @@ -/* $NetBSD: key.h,v 1.9 2015/04/03 23:58:19 christos Exp $ */ -/* $OpenBSD: key.h,v 1.47 2015/01/28 22:36:00 djm Exp $ */ +/* $NetBSD: key.h,v 1.10 2015/08/13 10:33:21 christos Exp $ */ +/* $OpenBSD: key.h,v 1.48 2015/07/03 03:43:18 djm Exp $ */ /* * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. @@ -52,7 +52,6 @@ typedef struct sshkey Key; #define key_ecdsa_key_to_nid sshkey_ecdsa_key_to_nid #define key_is_cert sshkey_is_cert #define key_type_plain sshkey_type_plain -#define key_cert_is_legacy sshkey_cert_is_legacy #define key_curve_name_to_nid sshkey_curve_name_to_nid #define key_curve_nid_to_bits sshkey_curve_nid_to_bits #define key_curve_nid_to_name sshkey_curve_nid_to_name @@ -70,7 +69,7 @@ int key_read(Key *, char **); Key *key_generate(int, u_int); Key *key_from_private(const Key *); -int key_to_certified(Key *, int); +int key_to_certified(Key *); int key_drop_cert(Key *); int key_certify(Key *, Key *); void key_cert_copy(const Key *, Key *); Index: src/crypto/external/bsd/openssh/dist/scp.1 diff -u src/crypto/external/bsd/openssh/dist/scp.1:1.9 src/crypto/external/bsd/openssh/dist/scp.1:1.10 --- src/crypto/external/bsd/openssh/dist/scp.1:1.9 Fri Apr 3 19:58:19 2015 +++ src/crypto/external/bsd/openssh/dist/scp.1 Thu Aug 13 06:33:21 2015 @@ -1,4 +1,4 @@ -.\" $NetBSD: scp.1,v 1.9 2015/04/03 23:58:19 christos Exp $ +.\" $NetBSD: scp.1,v 1.10 2015/08/13 10:33:21 christos Exp $ .\" -*- nroff -*- .\" .\" scp.1 @@ -10,9 +10,9 @@ .\" .\" Created: Sun May 7 00:14:37 1995 ylo .\" -.\" $OpenBSD: scp.1,v 1.66 2015/01/30 11:43:14 djm Exp $ +.\" $OpenBSD: scp.1,v 1.67 2015/07/10 06:21:53 markus Exp $ .\" -.Dd January 30 2015 +.Dd July 10 2015 .Dt SCP 1 .Os .Sh NAME @@ -172,6 +172,7 @@ For full details of the options listed b .It PreferredAuthentications .It Protocol .It ProxyCommand +.It PubkeyAcceptedKeyTypes .It PubkeyAuthentication .It RekeyLimit .It RhostsRSAAuthentication Index: src/crypto/external/bsd/openssh/dist/ssh-keysign.c diff -u src/crypto/external/bsd/openssh/dist/ssh-keysign.c:1.9 src/crypto/external/bsd/openssh/dist/ssh-keysign.c:1.10 --- src/crypto/external/bsd/openssh/dist/ssh-keysign.c:1.9 Thu Jul 2 21:00:00 2015 +++ src/crypto/external/bsd/openssh/dist/ssh-keysign.c Thu Aug 13 06:33:21 2015 @@ -1,5 +1,5 @@ -/* $NetBSD: ssh-keysign.c,v 1.9 2015/07/03 01:00:00 christos Exp $ */ -/* $OpenBSD: ssh-keysign.c,v 1.48 2015/03/24 20:09:11 markus Exp $ */ +/* $NetBSD: ssh-keysign.c,v 1.10 2015/08/13 10:33:21 christos Exp $ */ +/* $OpenBSD: ssh-keysign.c,v 1.49 2015/07/03 03:56:25 djm Exp $ */ /* * Copyright (c) 2002 Markus Friedl. All rights reserved. * @@ -25,7 +25,7 @@ */ #include "includes.h" -__RCSID("$NetBSD: ssh-keysign.c,v 1.9 2015/07/03 01:00:00 christos Exp $"); +__RCSID("$NetBSD: ssh-keysign.c,v 1.10 2015/08/13 10:33:21 christos Exp $"); #include <sys/types.h> #include <openssl/evp.h> @@ -179,6 +179,7 @@ main(int argc, char **argv) close(fd); i = 0; + /* XXX This really needs to read sshd_config for the paths */ key_fd[i++] = open(_PATH_HOST_DSA_KEY_FILE, O_RDONLY); key_fd[i++] = open(_PATH_HOST_ECDSA_KEY_FILE, O_RDONLY); key_fd[i++] = open(_PATH_HOST_ED25519_KEY_FILE, O_RDONLY); Index: src/crypto/external/bsd/openssh/dist/authfile.c diff -u src/crypto/external/bsd/openssh/dist/authfile.c:1.11 src/crypto/external/bsd/openssh/dist/authfile.c:1.12 --- src/crypto/external/bsd/openssh/dist/authfile.c:1.11 Thu Jul 2 20:59:59 2015 +++ src/crypto/external/bsd/openssh/dist/authfile.c Thu Aug 13 06:33:21 2015 @@ -1,5 +1,5 @@ -/* $NetBSD: authfile.c,v 1.11 2015/07/03 00:59:59 christos Exp $ */ -/* $OpenBSD: authfile.c,v 1.114 2015/04/17 13:32:09 djm Exp $ */ +/* $NetBSD: authfile.c,v 1.12 2015/08/13 10:33:21 christos Exp $ */ +/* $OpenBSD: authfile.c,v 1.116 2015/07/09 09:49:46 markus Exp $ */ /* * Copyright (c) 2000, 2013 Markus Friedl. All rights reserved. * @@ -25,7 +25,7 @@ */ #include "includes.h" -__RCSID("$NetBSD: authfile.c,v 1.11 2015/07/03 00:59:59 christos Exp $"); +__RCSID("$NetBSD: authfile.c,v 1.12 2015/08/13 10:33:21 christos Exp $"); #include <sys/types.h> #include <sys/stat.h> #include <sys/uio.h> @@ -39,13 +39,13 @@ __RCSID("$NetBSD: authfile.c,v 1.11 2015 #include <limits.h> #include "cipher.h" -#include "key.h" #include "ssh.h" #include "log.h" #include "authfile.h" #include "rsa.h" #include "misc.h" #include "atomicio.h" +#include "sshkey.h" #include "sshbuf.h" #include "ssherr.h" #include "krl.h" @@ -445,8 +445,8 @@ sshkey_load_private_cert(int type, const case KEY_RSA: case KEY_DSA: case KEY_ECDSA: - case KEY_ED25519: #endif /* WITH_OPENSSL */ + case KEY_ED25519: case KEY_UNSPEC: break; default: @@ -464,7 +464,7 @@ sshkey_load_private_cert(int type, const goto out; } - if ((r = sshkey_to_certified(key, sshkey_cert_is_legacy(cert))) != 0 || + if ((r = sshkey_to_certified(key)) != 0 || (r = sshkey_cert_copy(cert, key)) != 0) goto out; r = 0; Index: src/crypto/external/bsd/openssh/dist/compat.c diff -u src/crypto/external/bsd/openssh/dist/compat.c:1.11 src/crypto/external/bsd/openssh/dist/compat.c:1.12 --- src/crypto/external/bsd/openssh/dist/compat.c:1.11 Thu Jul 2 21:00:00 2015 +++ src/crypto/external/bsd/openssh/dist/compat.c Thu Aug 13 06:33:21 2015 @@ -1,5 +1,5 @@ -/* $NetBSD: compat.c,v 1.11 2015/07/03 01:00:00 christos Exp $ */ -/* $OpenBSD: compat.c,v 1.94 2015/05/26 23:23:40 dtucker Exp $ */ +/* $NetBSD: compat.c,v 1.12 2015/08/13 10:33:21 christos Exp $ */ +/* $OpenBSD: compat.c,v 1.96 2015/07/28 23:20:42 djm Exp $ */ /* * Copyright (c) 1999, 2000, 2001, 2002 Markus Friedl. All rights reserved. * @@ -25,7 +25,7 @@ */ #include "includes.h" -__RCSID("$NetBSD: compat.c,v 1.11 2015/07/03 01:00:00 christos Exp $"); +__RCSID("$NetBSD: compat.c,v 1.12 2015/08/13 10:33:21 christos Exp $"); #include <sys/types.h> #include <stdlib.h> @@ -153,7 +153,8 @@ compat_datafellows(const char *version) "1.2.22*", SSH_BUG_IGNOREMSG }, { "1.3.2*", /* F-Secure */ SSH_BUG_IGNOREMSG }, - { "Cisco-1.*", SSH_BUG_DHGEX_LARGE }, + { "Cisco-1.*", SSH_BUG_DHGEX_LARGE| + SSH_BUG_HOSTKEYS }, { "*SSH Compatible Server*", /* Netscreen */ SSH_BUG_PASSWORDPAD }, { "*OSU_0*," @@ -167,7 +168,8 @@ compat_datafellows(const char *version) "OSU_1.5alpha3*", SSH_BUG_PASSWORDPAD }, { "*SSH_Version_Mapper*", SSH_BUG_SCANNER }, - { "PuTTY-Release-0.5*," /* 0.50-0.57, DH-GEX in >=0.52 */ + { "PuTTY_Local:*," /* dev versions < Sep 2014 */ + "PuTTY-Release-0.5*," /* 0.50-0.57, DH-GEX in >=0.52 */ "PuTTY_Release_0.5*," /* 0.58-0.59 */ "PuTTY_Release_0.60*," "PuTTY_Release_0.61*," Index: src/crypto/external/bsd/openssh/dist/kex.c diff -u src/crypto/external/bsd/openssh/dist/kex.c:1.11 src/crypto/external/bsd/openssh/dist/kex.c:1.12 --- src/crypto/external/bsd/openssh/dist/kex.c:1.11 Thu Jul 2 21:00:00 2015 +++ src/crypto/external/bsd/openssh/dist/kex.c Thu Aug 13 06:33:21 2015 @@ -1,5 +1,5 @@ -/* $NetBSD: kex.c,v 1.11 2015/07/03 01:00:00 christos Exp $ */ -/* $OpenBSD: kex.c,v 1.106 2015/04/17 13:25:52 djm Exp $ */ +/* $NetBSD: kex.c,v 1.12 2015/08/13 10:33:21 christos Exp $ */ +/* $OpenBSD: kex.c,v 1.109 2015/07/30 00:01:34 djm Exp $ */ /* * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. * @@ -25,7 +25,7 @@ */ #include "includes.h" -__RCSID("$NetBSD: kex.c,v 1.11 2015/07/03 01:00:00 christos Exp $"); +__RCSID("$NetBSD: kex.c,v 1.12 2015/08/13 10:33:21 christos Exp $"); #include <sys/param.h> /* MAX roundup */ #include <signal.h> @@ -140,6 +140,68 @@ kex_names_valid(const char *names) 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 */ int kex_prop2buf(struct sshbuf *b, const char *proposal[PROPOSAL_MAX]) @@ -431,6 +493,7 @@ kex_free(struct kex *kex) free(kex->session_id); free(kex->client_version_string); free(kex->server_version_string); + free(kex->failed_choice); free(kex); } @@ -456,6 +519,7 @@ choose_enc(struct sshenc *enc, char *cli if (name == NULL) return SSH_ERR_NO_CIPHER_ALG_MATCH; + if ((enc->cipher = cipher_by_name(name)) == NULL) return SSH_ERR_INTERNAL_ERROR; enc->name = name; @@ -610,17 +674,26 @@ kex_choose_conf(struct ssh *ssh) nmac = ctos ? PROPOSAL_MAC_ALGS_CTOS : PROPOSAL_MAC_ALGS_STOC; ncomp = ctos ? PROPOSAL_COMP_ALGS_CTOS : PROPOSAL_COMP_ALGS_STOC; if ((r = choose_enc(&newkeys->enc, cprop[nenc], - sprop[nenc])) != 0) + sprop[nenc])) != 0) { + kex->failed_choice = peer[nenc]; + peer[nenc] = NULL; goto out; + } authlen = cipher_authlen(newkeys->enc.cipher); /* ignore mac for authenticated encryption */ if (authlen == 0 && (r = choose_mac(ssh, &newkeys->mac, cprop[nmac], - sprop[nmac])) != 0) + sprop[nmac])) != 0) { + kex->failed_choice = peer[nmac]; + peer[nmac] = NULL; goto out; + } if ((r = choose_comp(&newkeys->comp, cprop[ncomp], - sprop[ncomp])) != 0) + sprop[ncomp])) != 0) { + kex->failed_choice = peer[ncomp]; + peer[ncomp] = NULL; goto out; + } debug("REQUESTED ENC.NAME is '%s'", newkeys->enc.name); if (strcmp(newkeys->enc.name, "none") == 0) { int auth_flag; @@ -654,10 +727,17 @@ kex_choose_conf(struct ssh *ssh) log_flag = 1; } if ((r = choose_kex(kex, cprop[PROPOSAL_KEX_ALGS], - sprop[PROPOSAL_KEX_ALGS])) != 0 || - (r = choose_hostkeyalg(kex, cprop[PROPOSAL_SERVER_HOST_KEY_ALGS], - sprop[PROPOSAL_SERVER_HOST_KEY_ALGS])) != 0) + sprop[PROPOSAL_KEX_ALGS])) != 0) { + kex->failed_choice = peer[PROPOSAL_KEX_ALGS]; + peer[PROPOSAL_KEX_ALGS] = NULL; + goto out; + } + if ((r = choose_hostkeyalg(kex, cprop[PROPOSAL_SERVER_HOST_KEY_ALGS], + sprop[PROPOSAL_SERVER_HOST_KEY_ALGS])) != 0) { + kex->failed_choice = peer[PROPOSAL_SERVER_HOST_KEY_ALGS]; + peer[PROPOSAL_SERVER_HOST_KEY_ALGS] = NULL; goto out; + } need = dh_need = 0; for (mode = 0; mode < MODE_MAX; mode++) { newkeys = kex->newkeys[mode]; Index: src/crypto/external/bsd/openssh/dist/myproposal.h diff -u src/crypto/external/bsd/openssh/dist/myproposal.h:1.11 src/crypto/external/bsd/openssh/dist/myproposal.h:1.12 --- src/crypto/external/bsd/openssh/dist/myproposal.h:1.11 Thu Jul 2 21:00:00 2015 +++ src/crypto/external/bsd/openssh/dist/myproposal.h Thu Aug 13 06:33:21 2015 @@ -1,5 +1,5 @@ -/* $NetBSD: myproposal.h,v 1.11 2015/07/03 01:00:00 christos Exp $ */ -/* $OpenBSD: myproposal.h,v 1.44 2015/05/27 23:51:10 dtucker Exp $ */ +/* $NetBSD: myproposal.h,v 1.12 2015/08/13 10:33:21 christos Exp $ */ +/* $OpenBSD: myproposal.h,v 1.47 2015/07/10 06:21:53 markus Exp $ */ /* * Copyright (c) 2000 Markus Friedl. All rights reserved. @@ -39,8 +39,7 @@ #define KEX_CLIENT_KEX KEX_COMMON_KEX "," \ "diffie-hellman-group-exchange-sha1," \ - "diffie-hellman-group14-sha1," \ - "diffie-hellman-group1-sha1" + "diffie-hellman-group14-sha1" #define KEX_DEFAULT_PK_ALG \ "ecdsa-sha2-nistp256-cert-...@openssh.com," \ @@ -48,15 +47,11 @@ "ecdsa-sha2-nistp521-cert-...@openssh.com," \ "ssh-ed25519-cert-...@openssh.com," \ "ssh-rsa-cert-...@openssh.com," \ - "ssh-dss-cert-...@openssh.com," \ - "ssh-rsa-cert-...@openssh.com," \ - "ssh-dss-cert-...@openssh.com," \ "ecdsa-sha2-nistp256," \ "ecdsa-sha2-nistp384," \ "ecdsa-sha2-nistp521," \ "ssh-ed25519," \ - "ssh-rsa," \ - "ssh-dss" + "ssh-rsa" #define KEX_SERVER_ENCRYPT \ "chacha20-poly1...@openssh.com," \ Index: src/crypto/external/bsd/openssh/dist/ssh-add.c diff -u src/crypto/external/bsd/openssh/dist/ssh-add.c:1.11 src/crypto/external/bsd/openssh/dist/ssh-add.c:1.12 --- src/crypto/external/bsd/openssh/dist/ssh-add.c:1.11 Thu Jul 2 21:00:00 2015 +++ src/crypto/external/bsd/openssh/dist/ssh-add.c Thu Aug 13 06:33:21 2015 @@ -1,5 +1,5 @@ -/* $NetBSD: ssh-add.c,v 1.11 2015/07/03 01:00:00 christos Exp $ */ -/* $OpenBSD: ssh-add.c,v 1.122 2015/03/26 12:32:38 naddy Exp $ */ +/* $NetBSD: ssh-add.c,v 1.12 2015/08/13 10:33:21 christos Exp $ */ +/* $OpenBSD: ssh-add.c,v 1.123 2015/07/03 03:43:18 djm Exp $ */ /* * Author: Tatu Ylonen <y...@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <y...@cs.hut.fi>, Espoo, Finland @@ -37,7 +37,7 @@ */ #include "includes.h" -__RCSID("$NetBSD: ssh-add.c,v 1.11 2015/07/03 01:00:00 christos Exp $"); +__RCSID("$NetBSD: ssh-add.c,v 1.12 2015/08/13 10:33:21 christos Exp $"); #include <sys/types.h> #include <sys/stat.h> @@ -297,8 +297,7 @@ add_file(int agent_fd, const char *filen } /* Graft with private bits */ - if ((r = sshkey_to_certified(private, - sshkey_cert_is_legacy(cert))) != 0) { + if ((r = sshkey_to_certified(private)) != 0) { error("%s: sshkey_to_certified: %s", __func__, ssh_err(r)); sshkey_free(cert); goto out; Index: src/crypto/external/bsd/openssh/dist/clientloop.c diff -u src/crypto/external/bsd/openssh/dist/clientloop.c:1.14 src/crypto/external/bsd/openssh/dist/clientloop.c:1.15 --- src/crypto/external/bsd/openssh/dist/clientloop.c:1.14 Thu Jul 2 20:59:59 2015 +++ src/crypto/external/bsd/openssh/dist/clientloop.c Thu Aug 13 06:33:21 2015 @@ -1,5 +1,5 @@ -/* $NetBSD: clientloop.c,v 1.14 2015/07/03 00:59:59 christos Exp $ */ -/* $OpenBSD: clientloop.c,v 1.274 2015/07/01 02:26:31 djm Exp $ */ +/* $NetBSD: clientloop.c,v 1.15 2015/08/13 10:33:21 christos Exp $ */ +/* $OpenBSD: clientloop.c,v 1.275 2015/07/10 06:21:53 markus Exp $ */ /* * Author: Tatu Ylonen <y...@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <y...@cs.hut.fi>, Espoo, Finland @@ -61,7 +61,7 @@ */ #include "includes.h" -__RCSID("$NetBSD: clientloop.c,v 1.14 2015/07/03 00:59:59 christos Exp $"); +__RCSID("$NetBSD: clientloop.c,v 1.15 2015/08/13 10:33:21 christos Exp $"); #include <sys/param.h> /* MIN MAX */ #include <sys/types.h> @@ -95,6 +95,7 @@ __RCSID("$NetBSD: clientloop.c,v 1.14 20 #include "key.h" #include "cipher.h" #include "kex.h" +#include "myproposal.h" #include "log.h" #include "misc.h" #include "readconf.h" @@ -2369,10 +2370,11 @@ client_input_hostkeys(void) debug3("%s: received %s key %s", __func__, sshkey_type(key), fp); free(fp); + /* Check that the key is accepted in HostkeyAlgorithms */ - if (options.hostkeyalgorithms != NULL && - match_pattern_list(sshkey_ssh_name(key), - options.hostkeyalgorithms, 0) != 1) { + if (match_pattern_list(sshkey_ssh_name(key), + options.hostkeyalgorithms ? options.hostkeyalgorithms : + KEX_DEFAULT_PK_ALG, 0) != 1) { debug3("%s: %s key not permitted by HostkeyAlgorithms", __func__, sshkey_ssh_name(key)); continue; Index: src/crypto/external/bsd/openssh/dist/ssh_config.5 diff -u src/crypto/external/bsd/openssh/dist/ssh_config.5:1.14 src/crypto/external/bsd/openssh/dist/ssh_config.5:1.15 --- src/crypto/external/bsd/openssh/dist/ssh_config.5:1.14 Thu Jul 2 21:00:00 2015 +++ src/crypto/external/bsd/openssh/dist/ssh_config.5 Thu Aug 13 06:33:21 2015 @@ -1,4 +1,4 @@ -.\" $NetBSD: ssh_config.5,v 1.14 2015/07/03 01:00:00 christos Exp $ +.\" $NetBSD: ssh_config.5,v 1.15 2015/08/13 10:33:21 christos Exp $ .\" -*- nroff -*- .\" .\" Author: Tatu Ylonen <y...@cs.hut.fi> @@ -35,8 +35,8 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $OpenBSD: ssh_config.5,v 1.211 2015/06/02 09:10:40 djm Exp $ -.Dd June 2 2015 +.\" $OpenBSD: ssh_config.5,v 1.214 2015/07/30 00:01:34 djm Exp $ +.Dd July 30 2015 .Dt SSH_CONFIG 5 .Os .Sh NAME @@ -375,6 +375,11 @@ The default is Specifies the ciphers allowed for protocol version 2 in order of preference. 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: .Pp .Bl -item -compact -offset indent @@ -783,9 +788,21 @@ is similar to .It Cm HostbasedKeyTypes Specifies the key types that will be used for hostbased authentication as a comma-separated pattern list. -The default -.Dq * -will allow all key types. +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: +.Bd -literal -offset 3n +ecdsa-sha2-nistp256-cert-...@openssh.com, +ecdsa-sha2-nistp384-cert-...@openssh.com, +ecdsa-sha2-nistp521-cert-...@openssh.com, +ssh-ed25519-cert-...@openssh.com, +ssh-rsa-cert-...@openssh.com, +ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521, +ssh-ed25519,ssh-rsa +.Ed +.Pp The .Fl Q option of @@ -794,16 +811,19 @@ may be used to list supported key types. .It Cm HostKeyAlgorithms Specifies the protocol version 2 host key algorithms 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: .Bd -literal -offset 3n ecdsa-sha2-nistp256-cert-...@openssh.com, ecdsa-sha2-nistp384-cert-...@openssh.com, ecdsa-sha2-nistp521-cert-...@openssh.com, ssh-ed25519-cert-...@openssh.com, -ssh-rsa-cert-...@openssh.com,ssh-dss-cert-...@openssh.com, -ssh-rsa-cert-...@openssh.com,ssh-dss-cert-...@openssh.com, +ssh-rsa-cert-...@openssh.com, ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521, -ssh-ed25519,ssh-rsa,ssh-dss +ssh-ed25519,ssh-rsa .Ed .Pp If hostkeys are known for the destination host then this default is modified @@ -976,14 +996,17 @@ and .It Cm KexAlgorithms Specifies the available KEX (Key Exchange) algorithms. 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: .Bd -literal -offset indent curve25519-sha...@libssh.org, ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521, diffie-hellman-group-exchange-sha256, diffie-hellman-group-exchange-sha1, -diffie-hellman-group14-sha1, -diffie-hellman-group1-sha1 +diffie-hellman-group14-sha1 .Ed .Pp The list of available key exchange algorithms may also be obtained using the @@ -1065,10 +1088,16 @@ in order of preference. The MAC algorithm is used in protocol version 2 for data integrity protection. 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 .Dq -etm calculate the MAC after encryption (encrypt-then-mac). These are considered safer and their use recommended. +.Pp The default is: .Bd -literal -offset indent umac-64-...@openssh.com,umac-128-...@openssh.com, @@ -1209,6 +1238,29 @@ will pass a connected file descriptor ba instead of continuing to execute and pass data. The default is .Dq no . +.It Cm PubkeyAcceptedKeyTypes +Specifies the key types that will be used for public key authentication +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: +.Bd -literal -offset 3n +ecdsa-sha2-nistp256-cert-...@openssh.com, +ecdsa-sha2-nistp384-cert-...@openssh.com, +ecdsa-sha2-nistp521-cert-...@openssh.com, +ssh-ed25519-cert-...@openssh.com, +ssh-rsa-cert-...@openssh.com, +ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521, +ssh-ed25519,ssh-rsa +.Ed +.Pp +The +.Fl Q +option of +.Xr ssh 1 +may be used to list supported key types. .It Cm PubkeyAuthentication Specifies whether to try public key authentication. The argument to this keyword must be Index: src/crypto/external/bsd/openssh/dist/sshd.8 diff -u src/crypto/external/bsd/openssh/dist/sshd.8:1.14 src/crypto/external/bsd/openssh/dist/sshd.8:1.15 --- src/crypto/external/bsd/openssh/dist/sshd.8:1.14 Thu Jul 2 21:00:00 2015 +++ src/crypto/external/bsd/openssh/dist/sshd.8 Thu Aug 13 06:33:21 2015 @@ -1,4 +1,4 @@ -.\" $NetBSD: sshd.8,v 1.14 2015/07/03 01:00:00 christos Exp $ +.\" $NetBSD: sshd.8,v 1.15 2015/08/13 10:33:21 christos Exp $ .\" -*- nroff -*- .\" .\" Author: Tatu Ylonen <y...@cs.hut.fi> @@ -35,8 +35,8 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $OpenBSD: sshd.8,v 1.279 2015/05/01 07:11:47 djm Exp $ -.Dd May 1 2015 +.\" $OpenBSD: sshd.8,v 1.280 2015/07/03 03:49:45 djm Exp $ +.Dd July 3 2015 .Dt SSHD 8 .Os .Sh NAME @@ -186,15 +186,12 @@ Specifies that .Nm is being run from .Xr inetd 8 . +If SSH protocol 1 is enabled, .Nm -is normally not run +should not normally be run from inetd because it needs to generate the server key before it can -respond to the client, and this may take tens of seconds. -Clients would have to wait too long if the key was regenerated every time. -However, with small key sizes (e.g. 512) using -.Nm -from inetd may -be feasible. +respond to the client, and this may take some time. +Clients may have to wait too long if the key was regenerated every time. .It Fl k Ar key_gen_time Specifies how often the ephemeral protocol version 1 server key is regenerated (default 3600 seconds, or one hour). @@ -289,7 +286,7 @@ used to identify the host. .Pp Forward security for protocol 1 is provided through an additional server key, -normally 768 bits, +normally 1024 bits, generated when the server starts. This key is normally regenerated every hour if it has been used, and is never stored on disk. Index: src/crypto/external/bsd/openssh/dist/sshd_config diff -u src/crypto/external/bsd/openssh/dist/sshd_config:1.14 src/crypto/external/bsd/openssh/dist/sshd_config:1.15 --- src/crypto/external/bsd/openssh/dist/sshd_config:1.14 Thu Jul 2 21:00:00 2015 +++ src/crypto/external/bsd/openssh/dist/sshd_config Thu Aug 13 06:33:21 2015 @@ -1,5 +1,5 @@ -# $NetBSD: sshd_config,v 1.14 2015/07/03 01:00:00 christos Exp $ -# $OpenBSD: sshd_config,v 1.95 2015/04/27 21:42:48 djm Exp $ +# $NetBSD: sshd_config,v 1.15 2015/08/13 10:33:21 christos Exp $ +# $OpenBSD: sshd_config,v 1.97 2015/08/06 14:53:21 deraadt Exp $ # This is the sshd server system-wide configuration file. See # sshd_config(5) for more information. @@ -40,7 +40,7 @@ # Authentication: #LoginGraceTime 2m -#PermitRootLogin no +#PermitRootLogin prohibit-password #StrictModes yes #MaxAuthTries 6 #MaxSessions 10 Index: src/crypto/external/bsd/openssh/dist/key.c diff -u src/crypto/external/bsd/openssh/dist/key.c:1.16 src/crypto/external/bsd/openssh/dist/key.c:1.17 --- src/crypto/external/bsd/openssh/dist/key.c:1.16 Fri Apr 3 19:58:19 2015 +++ src/crypto/external/bsd/openssh/dist/key.c Thu Aug 13 06:33:21 2015 @@ -1,11 +1,11 @@ -/* $NetBSD: key.c,v 1.16 2015/04/03 23:58:19 christos Exp $ */ -/* $OpenBSD: key.c,v 1.127 2015/01/28 22:36:00 djm Exp $ */ +/* $NetBSD: key.c,v 1.17 2015/08/13 10:33:21 christos Exp $ */ +/* $OpenBSD: key.c,v 1.128 2015/07/03 03:43:18 djm Exp $ */ /* * placed in the public domain */ #include "includes.h" -__RCSID("$NetBSD: key.c,v 1.16 2015/04/03 23:58:19 christos Exp $"); +__RCSID("$NetBSD: key.c,v 1.17 2015/08/13 10:33:21 christos Exp $"); #include <sys/param.h> #include <sys/types.h> #include <errno.h> @@ -186,11 +186,11 @@ key_demote(const Key *k) } int -key_to_certified(Key *k, int legacy) +key_to_certified(Key *k) { int r; - if ((r = sshkey_to_certified(k, legacy)) != 0) { + if ((r = sshkey_to_certified(k)) != 0) { fatal_on_fatal_errors(r, __func__, 0); error("%s: %s", __func__, ssh_err(r)); return -1; Index: src/crypto/external/bsd/openssh/dist/log.c diff -u src/crypto/external/bsd/openssh/dist/log.c:1.12 src/crypto/external/bsd/openssh/dist/log.c:1.13 --- src/crypto/external/bsd/openssh/dist/log.c:1.12 Fri Apr 3 19:58:19 2015 +++ src/crypto/external/bsd/openssh/dist/log.c Thu Aug 13 06:33:21 2015 @@ -1,5 +1,5 @@ -/* $NetBSD: log.c,v 1.12 2015/04/03 23:58:19 christos Exp $ */ -/* $OpenBSD: log.c,v 1.45 2013/05/16 09:08:41 dtucker Exp $ */ +/* $NetBSD: log.c,v 1.13 2015/08/13 10:33:21 christos Exp $ */ +/* $OpenBSD: log.c,v 1.46 2015/07/08 19:04:21 markus Exp $ */ /* * Author: Tatu Ylonen <y...@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <y...@cs.hut.fi>, Espoo, Finland @@ -36,7 +36,7 @@ */ #include "includes.h" -__RCSID("$NetBSD: log.c,v 1.12 2015/04/03 23:58:19 christos Exp $"); +__RCSID("$NetBSD: log.c,v 1.13 2015/08/13 10:33:21 christos Exp $"); #include <sys/types.h> #include <sys/uio.h> @@ -50,7 +50,6 @@ __RCSID("$NetBSD: log.c,v 1.12 2015/04/0 #include <errno.h> #include <vis.h> -#include "xmalloc.h" #include "log.h" static LogLevel log_level = SYSLOG_LEVEL_INFO; Index: src/crypto/external/bsd/openssh/dist/readconf.h diff -u src/crypto/external/bsd/openssh/dist/readconf.h:1.12 src/crypto/external/bsd/openssh/dist/readconf.h:1.13 --- src/crypto/external/bsd/openssh/dist/readconf.h:1.12 Fri Apr 3 19:58:19 2015 +++ src/crypto/external/bsd/openssh/dist/readconf.h Thu Aug 13 06:33:21 2015 @@ -1,5 +1,5 @@ -/* $NetBSD: readconf.h,v 1.12 2015/04/03 23:58:19 christos Exp $ */ -/* $OpenBSD: readconf.h,v 1.109 2015/02/16 22:13:32 djm Exp $ */ +/* $NetBSD: readconf.h,v 1.13 2015/08/13 10:33:21 christos Exp $ */ +/* $OpenBSD: readconf.h,v 1.110 2015/07/10 06:21:53 markus Exp $ */ /* * Author: Tatu Ylonen <y...@cs.hut.fi> @@ -168,7 +168,8 @@ typedef struct { int update_hostkeys; /* one of SSH_UPDATE_HOSTKEYS_* */ - char *hostbased_key_types; + char *hostbased_key_types; + char *pubkey_key_types; char *ignored_unknown; /* Pattern list of unknown tokens to ignore */ } Options; Index: src/crypto/external/bsd/openssh/dist/servconf.h diff -u src/crypto/external/bsd/openssh/dist/servconf.h:1.12 src/crypto/external/bsd/openssh/dist/servconf.h:1.13 --- src/crypto/external/bsd/openssh/dist/servconf.h:1.12 Thu Jul 2 21:00:00 2015 +++ src/crypto/external/bsd/openssh/dist/servconf.h Thu Aug 13 06:33:21 2015 @@ -1,5 +1,5 @@ -/* $NetBSD: servconf.h,v 1.12 2015/07/03 01:00:00 christos Exp $ */ -/* $OpenBSD: servconf.h,v 1.119 2015/05/22 03:50:02 djm Exp $ */ +/* $NetBSD: servconf.h,v 1.13 2015/08/13 10:33:21 christos Exp $ */ +/* $OpenBSD: servconf.h,v 1.120 2015/07/10 06:21:53 markus Exp $ */ /* * Author: Tatu Ylonen <y...@cs.hut.fi> @@ -110,6 +110,7 @@ typedef struct { int hostbased_authentication; /* If true, permit ssh2 hostbased auth */ int hostbased_uses_name_from_packet_only; /* experimental */ char *hostbased_key_types; /* Key types allowed for hostbased */ + char *hostkeyalgorithms; /* SSH2 server key types */ int rsa_authentication; /* If true, permit RSA authentication. */ int pubkey_authentication; /* If true, permit ssh2 pubkey authentication. */ char *pubkey_key_types; /* Key types allowed for public key */ Index: src/crypto/external/bsd/openssh/dist/monitor.c diff -u src/crypto/external/bsd/openssh/dist/monitor.c:1.15 src/crypto/external/bsd/openssh/dist/monitor.c:1.16 --- src/crypto/external/bsd/openssh/dist/monitor.c:1.15 Thu Jul 2 21:00:00 2015 +++ src/crypto/external/bsd/openssh/dist/monitor.c Thu Aug 13 06:33:21 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: monitor.c,v 1.15 2015/07/03 01:00:00 christos Exp $ */ +/* $NetBSD: monitor.c,v 1.16 2015/08/13 10:33:21 christos Exp $ */ /* $OpenBSD: monitor.c,v 1.150 2015/06/22 23:42:16 djm Exp $ */ /* * Copyright 2002 Niels Provos <pro...@citi.umich.edu> @@ -27,7 +27,7 @@ */ #include "includes.h" -__RCSID("$NetBSD: monitor.c,v 1.15 2015/07/03 01:00:00 christos Exp $"); +__RCSID("$NetBSD: monitor.c,v 1.16 2015/08/13 10:33:21 christos Exp $"); #include <sys/types.h> #include <sys/wait.h> #include <sys/socket.h> @@ -1061,9 +1061,7 @@ extern KbdintDevice sshpam_device; int mm_answer_pam_init_ctx(int sock, Buffer *m) { - debug3("%s", __func__); - authctxt->user = buffer_get_string(m, NULL); sshpam_ctxt = (sshpam_device.init_ctx)(authctxt); sshpam_authok = NULL; buffer_clear(m); @@ -1145,13 +1143,15 @@ mm_answer_pam_respond(int sock, Buffer * int mm_answer_pam_free_ctx(int sock, Buffer *m) { + int r = sshpam_authok != NULL && sshpam_authok == sshpam_ctxt; debug3("%s", __func__); (sshpam_device.free_ctx)(sshpam_ctxt); + sshpam_ctxt = sshpam_authok = NULL; buffer_clear(m); mm_request_send(sock, MONITOR_ANS_PAM_FREE_CTX, m); auth_method = "keyboard-interactive/pam"; - return (sshpam_authok == sshpam_ctxt); + return r; } #endif Index: src/crypto/external/bsd/openssh/dist/readconf.c diff -u src/crypto/external/bsd/openssh/dist/readconf.c:1.15 src/crypto/external/bsd/openssh/dist/readconf.c:1.16 --- src/crypto/external/bsd/openssh/dist/readconf.c:1.15 Mon Jul 6 11:09:17 2015 +++ src/crypto/external/bsd/openssh/dist/readconf.c Thu Aug 13 06:33:21 2015 @@ -1,5 +1,5 @@ -/* $NetBSD: readconf.c,v 1.15 2015/07/06 15:09:17 christos Exp $ */ -/* $OpenBSD: readconf.c,v 1.237 2015/06/26 05:13:20 djm Exp $ */ +/* $NetBSD: readconf.c,v 1.16 2015/08/13 10:33:21 christos Exp $ */ +/* $OpenBSD: readconf.c,v 1.239 2015/07/30 00:01:34 djm Exp $ */ /* * Author: Tatu Ylonen <y...@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <y...@cs.hut.fi>, Espoo, Finland @@ -14,7 +14,7 @@ */ #include "includes.h" -__RCSID("$NetBSD: readconf.c,v 1.15 2015/07/06 15:09:17 christos Exp $"); +__RCSID("$NetBSD: readconf.c,v 1.16 2015/08/13 10:33:21 christos Exp $"); #include <sys/types.h> #include <sys/stat.h> #include <sys/socket.h> @@ -159,6 +159,7 @@ typedef enum { oCanonicalizeFallbackLocal, oCanonicalizePermittedCNAMEs, oStreamLocalBindMask, oStreamLocalBindUnlink, oRevokedHostKeys, oFingerprintHash, oUpdateHostkeys, oHostbasedKeyTypes, + oPubkeyAcceptedKeyTypes, oNoneEnabled, oTcpRcvBufPoll, oTcpRcvBuf, oNoneSwitch, oHPNDisabled, oHPNBufferSize, oSendVersionFirst, @@ -288,6 +289,7 @@ static struct { { "fingerprinthash", oFingerprintHash }, { "updatehostkeys", oUpdateHostkeys }, { "hostbasedkeytypes", oHostbasedKeyTypes }, + { "pubkeyacceptedkeytypes", oPubkeyAcceptedKeyTypes }, { "noneenabled", oNoneEnabled }, { "tcprcvbufpoll", oTcpRcvBufPoll }, { "tcprcvbuf", oTcpRcvBuf }, @@ -1156,7 +1158,7 @@ parse_int: arg = strdelim(&s); if (!arg || *arg == '\0') 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'.", filename, linenum, arg ? arg : "<NONE>"); if (*activep && options->ciphers == NULL) @@ -1167,7 +1169,7 @@ parse_int: arg = strdelim(&s); if (!arg || *arg == '\0') 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'.", filename, linenum, arg ? arg : "<NONE>"); if (*activep && options->macs == NULL) @@ -1179,7 +1181,7 @@ parse_int: if (!arg || *arg == '\0') fatal("%.200s line %d: Missing argument.", filename, linenum); - if (!kex_names_valid(arg)) + if (!kex_names_valid(*arg == '+' ? arg + 1 : arg)) fatal("%.200s line %d: Bad SSH2 KexAlgorithms '%s'.", filename, linenum, arg ? arg : "<NONE>"); if (*activep && options->kex_algorithms == NULL) @@ -1187,14 +1189,17 @@ parse_int: break; case oHostKeyAlgorithms: + charptr = &options->hostkeyalgorithms; +parse_keytypes: arg = strdelim(&s); if (!arg || *arg == '\0') - fatal("%.200s line %d: Missing argument.", filename, linenum); - if (!sshkey_names_valid2(arg, 1)) - fatal("%.200s line %d: Bad protocol 2 host key algorithms '%s'.", - filename, linenum, arg ? arg : "<NONE>"); - if (*activep && options->hostkeyalgorithms == NULL) - options->hostkeyalgorithms = xstrdup(arg); + fatal("%.200s line %d: Missing argument.", + filename, linenum); + if (!sshkey_names_valid2(*arg == '+' ? arg + 1 : arg, 1)) + fatal("%s line %d: Bad key types '%s'.", + filename, linenum, arg ? arg : "<NONE>"); + if (*activep && *charptr == NULL) + *charptr = xstrdup(arg); break; case oProtocol: @@ -1562,16 +1567,11 @@ parse_int: case oHostbasedKeyTypes: charptr = &options->hostbased_key_types; - arg = strdelim(&s); - if (!arg || *arg == '\0') - fatal("%.200s line %d: Missing argument.", - filename, linenum); - if (!sshkey_names_valid2(arg, 1)) - fatal("%s line %d: Bad key types '%s'.", - filename, linenum, arg ? arg : "<NONE>"); - if (*activep && *charptr == NULL) - *charptr = xstrdup(arg); - break; + goto parse_keytypes; + + case oPubkeyAcceptedKeyTypes: + charptr = &options->pubkey_key_types; + goto parse_keytypes; case oDeprecated: debug("%s line %d: Deprecated option \"%s\"", @@ -1762,6 +1762,7 @@ initialize_options(Options * options) options->fingerprint_hash = -1; options->update_hostkeys = -1; options->hostbased_key_types = NULL; + options->pubkey_key_types = NULL; options->none_switch = -1; options->none_enabled = -1; options->hpn_disabled = -1; @@ -1866,9 +1867,6 @@ fill_default_options(Options * options) /* Selected in ssh_login(). */ if (options->cipher == -1) 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 */ if (options->protocol == SSH_PROTO_UNKNOWN) options->protocol = SSH_PROTO_2; @@ -1983,8 +1981,14 @@ fill_default_options(Options * options) options->fingerprint_hash = SSH_FP_HASH_DEFAULT; if (options->update_hostkeys == -1) options->update_hostkeys = 0; - if (options->hostbased_key_types == NULL) - options->hostbased_key_types = xstrdup("*"); + if (kex_assemble_names(KEX_CLIENT_ENCRYPT, &options->ciphers) != 0 || + kex_assemble_names(KEX_CLIENT_MAC, &options->macs) != 0 || + kex_assemble_names(KEX_CLIENT_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__); if (options->send_version_first == -1) options->send_version_first = 1; Index: src/crypto/external/bsd/openssh/dist/ssh-agent.c diff -u src/crypto/external/bsd/openssh/dist/ssh-agent.c:1.15 src/crypto/external/bsd/openssh/dist/ssh-agent.c:1.16 --- src/crypto/external/bsd/openssh/dist/ssh-agent.c:1.15 Thu Jul 2 21:00:00 2015 +++ src/crypto/external/bsd/openssh/dist/ssh-agent.c Thu Aug 13 06:33:21 2015 @@ -1,5 +1,5 @@ -/* $NetBSD: ssh-agent.c,v 1.15 2015/07/03 01:00:00 christos Exp $ */ -/* $OpenBSD: ssh-agent.c,v 1.203 2015/05/15 05:44:21 dtucker Exp $ */ +/* $NetBSD: ssh-agent.c,v 1.16 2015/08/13 10:33:21 christos Exp $ */ +/* $OpenBSD: ssh-agent.c,v 1.204 2015/07/08 20:24:02 markus Exp $ */ /* * Author: Tatu Ylonen <y...@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <y...@cs.hut.fi>, Espoo, Finland @@ -36,7 +36,7 @@ */ #include "includes.h" -__RCSID("$NetBSD: ssh-agent.c,v 1.15 2015/07/03 01:00:00 christos Exp $"); +__RCSID("$NetBSD: ssh-agent.c,v 1.16 2015/08/13 10:33:21 christos Exp $"); #include <sys/param.h> /* MIN MAX */ #include <sys/types.h> #include <sys/time.h> @@ -62,9 +62,6 @@ __RCSID("$NetBSD: ssh-agent.c,v 1.15 201 #include <unistd.h> #include <util.h> -#include "key.h" /* XXX for typedef */ -#include "buffer.h" /* XXX for typedef */ - #include "xmalloc.h" #include "ssh.h" #include "rsa.h" Index: src/crypto/external/bsd/openssh/dist/ssh.1 diff -u src/crypto/external/bsd/openssh/dist/ssh.1:1.15 src/crypto/external/bsd/openssh/dist/ssh.1:1.16 --- src/crypto/external/bsd/openssh/dist/ssh.1:1.15 Thu Jul 2 21:00:00 2015 +++ src/crypto/external/bsd/openssh/dist/ssh.1 Thu Aug 13 06:33:21 2015 @@ -1,4 +1,4 @@ -.\" $NetBSD: ssh.1,v 1.15 2015/07/03 01:00:00 christos Exp $ +.\" $NetBSD: ssh.1,v 1.16 2015/08/13 10:33:21 christos Exp $ .\" -*- nroff -*- .\" .\" Author: Tatu Ylonen <y...@cs.hut.fi> @@ -35,8 +35,8 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $OpenBSD: ssh.1,v 1.358 2015/05/22 05:28:45 djm Exp $ -.Dd May 22 2015 +.\" $OpenBSD: ssh.1,v 1.361 2015/07/20 18:44:12 millert Exp $ +.Dd July 20 2015 .Dt SSH 1 .Os .Sh NAME @@ -54,14 +54,14 @@ .Op Fl F Ar configfile .Op Fl I Ar pkcs11 .Op Fl i Ar identity_file -.Op Fl L Oo Ar bind_address : Oc Ns Ar port : Ns Ar host : Ns Ar hostport +.Op Fl L Ar address .Op Fl l Ar login_name .Op Fl m Ar mac_spec .Op Fl O Ar ctl_cmd .Op Fl o Ar option .Op Fl p Ar port .Op Fl Q Cm cipher | cipher-auth | mac | kex | key | protocol-version -.Op Fl R Oo Ar bind_address : Oc Ns Ar port : Ns Ar host : Ns Ar hostport +.Op Fl R Ar address .Op Fl S Ar ctl_path .Op Fl W Ar host : Ns Ar port .Op Fl w Ar local_tun Ns Op : Ns Ar remote_tun @@ -95,23 +95,28 @@ is specified, it is executed on the remote host instead of a login shell. .Pp The options are as follows: -.Bl -tag -width Ds +.Pp +.Bl -tag -width Ds -compact .It Fl 1 Forces .Nm to try protocol version 1 only. +.Pp .It Fl 2 Forces .Nm to try protocol version 2 only. +.Pp .It Fl 4 Forces .Nm to use IPv4 addresses only. +.Pp .It Fl 6 Forces .Nm to use IPv6 addresses only. +.Pp .It Fl A Enables forwarding of the authentication agent connection. This can also be specified on a per-host basis in a configuration file. @@ -124,14 +129,17 @@ socket) can access the local agent throu An attacker cannot obtain key material from the agent, however they can perform operations on the keys that enable them to authenticate using the identities loaded into the agent. +.Pp .It Fl a Disables forwarding of the authentication agent connection. +.Pp .It Fl b Ar bind_address Use .Ar bind_address on the local machine as the source address of the connection. Only useful on systems with more than one address. +.Pp .It Fl C Requests compression of all data (including stdin, stdout, stderr, and data for forwarded X11, TCP and @@ -150,6 +158,7 @@ The default value can be set on a host-b configuration files; see the .Cm Compression option. +.Pp .It Fl c Ar cipher_spec Selects the cipher specification for encrypting the session. .Pp @@ -168,7 +177,13 @@ See the keyword in .Xr ssh_config 5 for more information. -.It Fl D Oo Ar bind_address : Oc Ns Ar port +.Pp +.It Fl D Xo +.Sm off +.Oo Ar bind_address : Oc +.Ar port +.Sm on +.Xc Specifies a local .Dq dynamic application-level port forwarding. @@ -202,10 +217,12 @@ indicates that the listening port be bou empty address or .Sq * indicates that the port should be available from all interfaces. +.Pp .It Fl E Ar log_file Append debug logs to .Ar log_file instead of standard error. +.Pp .It Fl e Ar escape_char Sets the escape character for sessions with a pty (default: .Ql ~ ) . @@ -218,6 +235,7 @@ and followed by itself sends the escape Setting the character to .Dq none disables any escapes and makes the session fully transparent. +.Pp .It Fl F Ar configfile Specifies an alternative per-user configuration file. If a configuration file is given on the command line, @@ -226,6 +244,7 @@ the system-wide configuration file will be ignored. The default for the per-user configuration file is .Pa ~/.ssh/config . +.Pp .It Fl f Requests .Nm @@ -248,6 +267,7 @@ then a client started with .Fl f will wait for all remote port forwards to be successfully established before placing itself in the background. +.Pp .It Fl G Causes .Nm @@ -256,15 +276,18 @@ to print its configuration after evaluat and .Cm Match blocks and exit. +.Pp .It Fl g Allows remote hosts to connect to local forwarded ports. If used on a multiplexed connection, then this option must be specified on the master process. +.Pp .It Fl I Ar pkcs11 Specify the PKCS#11 shared library .Nm should use to communicate with a PKCS#11 token providing the user's private RSA key. +.Pp .It Fl i Ar identity_file Selects a file from which the identity (private key) for public key authentication is read. @@ -288,28 +311,58 @@ will also try to load certificate inform by appending .Pa -cert.pub to identity filenames. +.Pp .It Fl K Enables GSSAPI-based authentication and forwarding (delegation) of GSSAPI credentials to the server. +.Pp .It Fl k Disables forwarding (delegation) of GSSAPI credentials to the server. -.It Fl L Oo Ar bind_address : Oc Ns Ar port : Ns Ar host : Ns Ar hostport -Specifies that the given port on the local (client) host is to be -forwarded to the given host and port on the remote side. -This works by allocating a socket to listen to +.Pp +.It Fl L Xo +.Sm off +.Oo Ar bind_address : Oc +.Ar port : host : hostport +.Sm on +.Xc +.It Fl L Xo +.Sm off +.Oo Ar bind_address : Oc +.Ar port : remote_socket +.Sm on +.Xc +.It Fl L Xo +.Sm off +.Ar local_socket : host : hostport +.Sm on +.Xc +.It Fl L Xo +.Sm off +.Ar local_socket : remote_socket +.Sm on +.Xc +Specifies that connections to the given TCP port or Unix socket on the local +(client) host are to be forwarded to the given host and port, or Unix socket, +on the remote side. +This works by allocating a socket to listen to either a TCP .Ar port on the local side, optionally bound to the specified -.Ar bind_address . -Whenever a connection is made to this port, the +.Ar bind_address , +or to a Unix socket. +Whenever a connection is made to the local port or socket, the connection is forwarded over the secure channel, and a connection is -made to +made to either .Ar host port -.Ar hostport +.Ar hostport , +or the Unix socket +.Ar remote_socket , from the remote machine. +.Pp Port forwardings can also be specified in the configuration file. -IPv6 addresses can be specified by enclosing the address in square brackets. Only the superuser can forward privileged ports. +IPv6 addresses can be specified by enclosing the address in square brackets. +.Pp By default, the local port is bound in accordance with the .Cm GatewayPorts setting. @@ -324,9 +377,11 @@ indicates that the listening port be bou empty address or .Sq * indicates that the port should be available from all interfaces. +.Pp .It Fl l Ar login_name Specifies the user to log in as on the remote machine. This also may be specified on a per-host basis in the configuration file. +.Pp .It Fl M Places the .Nm @@ -345,6 +400,7 @@ Refer to the description of in .Xr ssh_config 5 for details. +.Pp .It Fl m Ar mac_spec Additionally, for protocol version 2 a comma-separated list of MAC (message authentication code) algorithms can @@ -352,10 +408,12 @@ be specified in order of preference. See the .Cm MACs keyword for more information. +.Pp .It Fl N Do not execute a remote command. This is useful for just forwarding ports (protocol version 2 only). +.Pp .It Fl n Redirects stdin from .Pa /dev/null @@ -376,6 +434,7 @@ program will be put in the background. needs to ask for a password or passphrase; see also the .Fl f option.) +.Pp .It Fl O Ar ctl_cmd Control an active connection multiplexing master process. When the @@ -394,6 +453,7 @@ Valid commands are: (request the master to exit), and .Dq stop (request the master to stop accepting further multiplexing requests). +.Pp .It Fl o Ar option Can be used to give options in the format used in the configuration file. This is useful for specifying options for which there is no separate @@ -462,6 +522,7 @@ For full details of the options listed b .It Protocol .It ProxyCommand .It ProxyUseFdpass +.It PubkeyAcceptedKeyTypes .It PubkeyAuthentication .It RekeyLimit .It RemoteForward @@ -485,10 +546,12 @@ For full details of the options listed b .It VisualHostKey .It XAuthLocation .El +.Pp .It Fl p Ar port Port to connect to on the remote host. This can be specified on a per-host basis in the configuration file. +.Pp .It Fl Q Cm cipher | cipher-auth | mac | kex | key | protocol-version Queries .Nm @@ -506,20 +569,47 @@ The available features are: (key types) and .Ar protocol-version (supported SSH protocol versions). +.Pp .It Fl q Quiet mode. Causes most warning and diagnostic messages to be suppressed. -.It Fl R Oo Ar bind_address : Oc Ns Ar port : Ns Ar host : Ns Ar hostport -Specifies that the given port on the remote (server) host is to be -forwarded to the given host and port on the local side. -This works by allocating a socket to listen to +.Pp +.It Fl R Xo +.Sm off +.Oo Ar bind_address : Oc +.Ar port : host : hostport +.Sm on +.Xc +.It Fl R Xo +.Sm off +.Oo Ar bind_address : Oc +.Ar port : local_socket +.Sm on +.Xc +.It Fl R Xo +.Sm off +.Ar remote_socket : host : hostport +.Sm on +.Xc +.It Fl R Xo +.Sm off +.Ar remote_socket : local_socket +.Sm on +.Xc +Specifies that connections to the given TCP port or Unix socket on the remote +(server) host are to be forwarded to the given host and port, or Unix socket, +on the local side. +This works by allocating a socket to listen to either a TCP .Ar port -on the remote side, and whenever a connection is made to this port, the -connection is forwarded over the secure channel, and a connection is -made to +or to a Unix socket on the remote side. +Whenever a connection is made to this port or Unix socket, the +connection is forwarded over the secure channel, and a connection +is made to either .Ar host port -.Ar hostport +.Ar hostport , +or +.Ar local_socket , from the local machine. .Pp Port forwardings can also be specified in the configuration file. @@ -527,7 +617,7 @@ Privileged ports can be forwarded only w logging in as root on the remote machine. IPv6 addresses can be specified by enclosing the address in square brackets. .Pp -By default, the listening socket on the server will be bound to the loopback +By default, TCP listening sockets on the server will be bound to the loopback interface only. This may be overridden by specifying a .Ar bind_address . @@ -552,6 +642,7 @@ to the client at run time. When used together with .Ic -O forward the allocated port will be printed to the standard output. +.Pp .It Fl S Ar ctl_path Specifies the location of a control socket for connection sharing, or the string @@ -564,14 +655,17 @@ and in .Xr ssh_config 5 for details. +.Pp .It Fl s May be used to request invocation of a subsystem on the remote system. Subsystems are a feature of the SSH2 protocol which facilitate the use of SSH as a secure transport for other applications (eg.\& .Xr sftp 1 ) . The subsystem is specified as the remote command. +.Pp .It Fl T Disable pseudo-terminal allocation. +.Pp .It Fl t Force pseudo-terminal allocation. This can be used to execute arbitrary @@ -582,8 +676,10 @@ Multiple options force tty allocation, even if .Nm has no local tty. +.Pp .It Fl V Display the version number and exit. +.Pp .It Fl v Verbose mode. Causes @@ -595,6 +691,7 @@ Multiple .Fl v options increase the verbosity. The maximum is 3. +.Pp .It Fl W Ar host : Ns Ar port Requests that standard input and output on the client be forwarded to .Ar host @@ -608,6 +705,7 @@ Implies and .Cm ClearAllForwardings . Works with Protocol version 2 only. +.Pp .It Fl w Xo .Ar local_tun Ns Op : Ns Ar remote_tun .Xc @@ -637,6 +735,7 @@ If the .Cm Tunnel directive is unset, it is set to the default tunnel mode, which is .Dq point-to-point . +.Pp .It Fl X Enables X11 forwarding. This can also be specified on a per-host basis in a configuration file. @@ -657,12 +756,15 @@ option and the directive in .Xr ssh_config 5 for more information. +.Pp .It Fl x Disables X11 forwarding. +.Pp .It Fl Y Enables trusted X11 forwarding. Trusted X11 forwardings are not subjected to the X11 SECURITY extension controls. +.Pp .It Fl y Send log information using the .Xr syslog 3 Index: src/crypto/external/bsd/openssh/dist/version.h diff -u src/crypto/external/bsd/openssh/dist/version.h:1.15 src/crypto/external/bsd/openssh/dist/version.h:1.16 --- src/crypto/external/bsd/openssh/dist/version.h:1.15 Thu Jul 2 21:00:00 2015 +++ src/crypto/external/bsd/openssh/dist/version.h Thu Aug 13 06:33:21 2015 @@ -1,8 +1,8 @@ -/* $NetBSD: version.h,v 1.15 2015/07/03 01:00:00 christos Exp $ */ -/* $OpenBSD: version.h,v 1.73 2015/07/01 01:55:13 djm Exp $ */ +/* $NetBSD: version.h,v 1.16 2015/08/13 10:33:21 christos Exp $ */ +/* $OpenBSD: version.h,v 1.74 2015/08/02 09:56:42 djm Exp $ */ -#define __OPENSSH_VERSION "OpenSSH_6.9" -#define __NETBSDSSH_VERSION "NetBSD_Secure_Shell-20150602" +#define __OPENSSH_VERSION "OpenSSH_7.0" +#define __NETBSDSSH_VERSION "NetBSD_Secure_Shell-20150812" #define SSH_HPN "-hpn13v14" #define SSH_LPK "-lpk" /* Index: src/crypto/external/bsd/openssh/dist/packet.c diff -u src/crypto/external/bsd/openssh/dist/packet.c:1.19 src/crypto/external/bsd/openssh/dist/packet.c:1.20 --- src/crypto/external/bsd/openssh/dist/packet.c:1.19 Thu Jul 2 21:00:00 2015 +++ src/crypto/external/bsd/openssh/dist/packet.c Thu Aug 13 06:33:21 2015 @@ -1,5 +1,5 @@ -/* $NetBSD: packet.c,v 1.19 2015/07/03 01:00:00 christos Exp $ */ -/* $OpenBSD: packet.c,v 1.212 2015/05/01 07:10:01 djm Exp $ */ +/* $NetBSD: packet.c,v 1.20 2015/08/13 10:33:21 christos Exp $ */ +/* $OpenBSD: packet.c,v 1.213 2015/07/29 04:43:06 djm Exp $ */ /* * Author: Tatu Ylonen <y...@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <y...@cs.hut.fi>, Espoo, Finland @@ -39,7 +39,7 @@ */ #include "includes.h" -__RCSID("$NetBSD: packet.c,v 1.19 2015/07/03 01:00:00 christos Exp $"); +__RCSID("$NetBSD: packet.c,v 1.20 2015/08/13 10:33:21 christos Exp $"); #include <sys/param.h> /* MIN roundup */ #include <sys/types.h> #include <sys/queue.h> @@ -1932,6 +1932,17 @@ sshpkt_fatal(struct ssh *ssh, const char cleanup_exit(255); } /* FALLTHROUGH */ + case SSH_ERR_NO_CIPHER_ALG_MATCH: + case SSH_ERR_NO_MAC_ALG_MATCH: + case SSH_ERR_NO_COMPRESS_ALG_MATCH: + case SSH_ERR_NO_KEX_ALG_MATCH: + case SSH_ERR_NO_HOSTKEY_ALG_MATCH: + if (ssh && ssh->kex && ssh->kex->failed_choice) { + fatal("Unable to negotiate with %.200s: %s. " + "Their offer: %s", ssh_remote_ipaddr(ssh), + ssh_err(r), ssh->kex->failed_choice); + } + /* FALLTHROUGH */ default: fatal("%s%sConnection to %.200s: %s", tag != NULL ? tag : "", tag != NULL ? ": " : "", Index: src/crypto/external/bsd/openssh/dist/servconf.c diff -u src/crypto/external/bsd/openssh/dist/servconf.c:1.18 src/crypto/external/bsd/openssh/dist/servconf.c:1.19 --- src/crypto/external/bsd/openssh/dist/servconf.c:1.18 Thu Jul 2 21:00:00 2015 +++ src/crypto/external/bsd/openssh/dist/servconf.c Thu Aug 13 06:33:21 2015 @@ -1,6 +1,6 @@ -/* $NetBSD: servconf.c,v 1.18 2015/07/03 01:00:00 christos Exp $ */ +/* $NetBSD: servconf.c,v 1.19 2015/08/13 10:33:21 christos Exp $ */ -/* $OpenBSD: servconf.c,v 1.274 2015/07/01 02:32:17 djm Exp $ */ +/* $OpenBSD: servconf.c,v 1.280 2015/08/06 14:53:21 deraadt Exp $ */ /* * Copyright (c) 1995 Tatu Ylonen <y...@cs.hut.fi>, Espoo, Finland * All rights reserved @@ -13,7 +13,7 @@ */ #include "includes.h" -__RCSID("$NetBSD: servconf.c,v 1.18 2015/07/03 01:00:00 christos Exp $"); +__RCSID("$NetBSD: servconf.c,v 1.19 2015/08/13 10:33:21 christos Exp $"); #include <sys/types.h> #include <sys/socket.h> #include <sys/queue.h> @@ -121,6 +121,7 @@ initialize_server_options(ServerOptions options->hostbased_authentication = -1; options->hostbased_uses_name_from_packet_only = -1; options->hostbased_key_types = NULL; + options->hostkeyalgorithms = NULL; options->rsa_authentication = -1; options->pubkey_authentication = -1; options->pubkey_key_types = NULL; @@ -268,7 +269,7 @@ fill_default_server_options(ServerOption if (options->key_regeneration_time == -1) options->key_regeneration_time = 3600; if (options->permit_root_login == PERMIT_NOT_SET) - options->permit_root_login = PERMIT_NO; + options->permit_root_login = PERMIT_NO_PASSWD; if (options->ignore_rhosts == -1) options->ignore_rhosts = 1; if (options->ignore_root_rhosts == -1) @@ -305,14 +306,12 @@ fill_default_server_options(ServerOption options->hostbased_authentication = 0; if (options->hostbased_uses_name_from_packet_only == -1) options->hostbased_uses_name_from_packet_only = 0; - if (options->hostbased_key_types == NULL) - options->hostbased_key_types = xstrdup("*"); + if (options->hostkeyalgorithms == NULL) + options->hostkeyalgorithms = xstrdup(KEX_DEFAULT_PK_ALG); if (options->rsa_authentication == -1) options->rsa_authentication = 1; if (options->pubkey_authentication == -1) options->pubkey_authentication = 1; - if (options->pubkey_key_types == NULL) - options->pubkey_key_types = xstrdup("*"); if (options->kerberos_authentication == -1) options->kerberos_authentication = 0; if (options->kerberos_or_local_passwd == -1) @@ -463,6 +462,16 @@ fill_default_server_options(ServerOption options->fwd_opts.streamlocal_bind_unlink = 0; if (options->fingerprint_hash == -1) 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 */ if (use_privsep == -1) use_privsep = PRIVSEP_NOSANDBOX; @@ -510,6 +519,7 @@ typedef enum { sXAuthLocation, sSubsystem, sMaxStartups, sMaxAuthTries, sMaxSessions, sBanner, sUseDNS, sHostbasedAuthentication, sHostbasedUsesNameFromPacketOnly, sHostbasedAcceptedKeyTypes, + sHostKeyAlgorithms, sClientAliveInterval, sClientAliveCountMax, sAuthorizedKeysFile, sGssAuthentication, sGssCleanupCreds, sGssStrictAcceptor, sAcceptEnv, sPermitTunnel, @@ -565,6 +575,7 @@ static struct { { "hostbasedauthentication", sHostbasedAuthentication, SSHCFG_ALL }, { "hostbasedusesnamefrompacketonly", sHostbasedUsesNameFromPacketOnly, SSHCFG_ALL }, { "hostbasedacceptedkeytypes", sHostbasedAcceptedKeyTypes, SSHCFG_ALL }, + { "hostkeyalgorithms", sHostKeyAlgorithms, SSHCFG_GLOBAL }, { "rsaauthentication", sRSAAuthentication, SSHCFG_ALL }, { "pubkeyauthentication", sPubkeyAuthentication, SSHCFG_ALL }, { "pubkeyacceptedkeytypes", sPubkeyAcceptedKeyTypes, SSHCFG_ALL }, @@ -1041,6 +1052,7 @@ static const struct multistate multistat }; static const struct multistate multistate_permitrootlogin[] = { { "without-password", PERMIT_NO_PASSWD }, + { "prohibit-password", PERMIT_NO_PASSWD }, { "forced-commands-only", PERMIT_FORCED_ONLY }, { "yes", PERMIT_YES }, { "no", PERMIT_NO }, @@ -1337,13 +1349,17 @@ process_server_config_line(ServerOptions if (!arg || *arg == '\0') fatal("%s line %d: Missing argument.", 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'.", filename, linenum, arg ? arg : "<NONE>"); if (*activep && *charptr == NULL) *charptr = xstrdup(arg); break; + case sHostKeyAlgorithms: + charptr = &options->hostkeyalgorithms; + goto parse_keytypes; + case sRSAAuthentication: intptr = &options->rsa_authentication; goto parse_flag; @@ -1590,7 +1606,7 @@ process_server_config_line(ServerOptions arg = strdelim(&cp); if (!arg || *arg == '\0') 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'.", filename, linenum, arg ? arg : "<NONE>"); if (options->ciphers == NULL) @@ -1601,7 +1617,7 @@ process_server_config_line(ServerOptions arg = strdelim(&cp); if (!arg || *arg == '\0') 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'.", filename, linenum, arg ? arg : "<NONE>"); if (options->macs == NULL) @@ -1613,7 +1629,7 @@ process_server_config_line(ServerOptions if (!arg || *arg == '\0') fatal("%s line %d: Missing argument.", filename, linenum); - if (!kex_names_valid(arg)) + if (!kex_names_valid(*arg == '+' ? arg + 1 : arg)) fatal("%s line %d: Bad SSH2 KexAlgorithms '%s'.", filename, linenum, arg ? arg : "<NONE>"); if (options->kex_algorithms == NULL) @@ -2560,6 +2576,8 @@ dump_config(ServerOptions *o) o->kex_algorithms ? o->kex_algorithms : KEX_SERVER_KEX); dump_cfg_string(sHostbasedAcceptedKeyTypes, o->hostbased_key_types ? o->hostbased_key_types : KEX_DEFAULT_PK_ALG); + dump_cfg_string(sHostKeyAlgorithms, o->hostkeyalgorithms ? + o->hostkeyalgorithms : KEX_DEFAULT_PK_ALG); dump_cfg_string(sPubkeyAcceptedKeyTypes, o->pubkey_key_types ? o->pubkey_key_types : KEX_DEFAULT_PK_ALG); Index: src/crypto/external/bsd/openssh/dist/ssh.c diff -u src/crypto/external/bsd/openssh/dist/ssh.c:1.18 src/crypto/external/bsd/openssh/dist/ssh.c:1.19 --- src/crypto/external/bsd/openssh/dist/ssh.c:1.18 Mon Jul 6 11:09:17 2015 +++ src/crypto/external/bsd/openssh/dist/ssh.c Thu Aug 13 06:33:21 2015 @@ -1,5 +1,5 @@ -/* $NetBSD: ssh.c,v 1.18 2015/07/06 15:09:17 christos Exp $ */ -/* $OpenBSD: ssh.c,v 1.418 2015/05/04 06:10:48 djm Exp $ */ +/* $NetBSD: ssh.c,v 1.19 2015/08/13 10:33:21 christos Exp $ */ +/* $OpenBSD: ssh.c,v 1.420 2015/07/30 00:01:34 djm Exp $ */ /* * Author: Tatu Ylonen <y...@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <y...@cs.hut.fi>, Espoo, Finland @@ -42,7 +42,7 @@ */ #include "includes.h" -__RCSID("$NetBSD: ssh.c,v 1.18 2015/07/06 15:09:17 christos Exp $"); +__RCSID("$NetBSD: ssh.c,v 1.19 2015/08/13 10:33:21 christos Exp $"); #include <sys/types.h> #include <sys/param.h> #include <sys/ioctl.h> @@ -104,6 +104,7 @@ __RCSID("$NetBSD: ssh.c,v 1.18 2015/07/0 #include "roaming.h" #include "version.h" #include "ssherr.h" +#include "myproposal.h" #ifdef ENABLE_PKCS11 #include "ssh-pkcs11.h" @@ -194,10 +195,10 @@ usage(void) "usage: ssh [-1246AaCfGgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]\n" " [-D [bind_address:]port] [-E log_file] [-e escape_char]\n" " [-F configfile] [-I pkcs11] [-i identity_file]\n" -" [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]\n" +" [-L address] [-l login_name] [-m mac_spec]\n" " [-O ctl_cmd] [-o option] [-p port]\n" " [-Q cipher | cipher-auth | mac | kex | key]\n" -" [-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port]\n" +" [-R address] [-S ctl_path] [-W host:port]\n" " [-w local_tun[:remote_tun]] [user@]hostname [command]\n" ); exit(255); @@ -771,27 +772,26 @@ main(int ac, char **av) } break; case 'c': - if (ciphers_valid(optarg)) { + if (ciphers_valid(*optarg == '+' ? + optarg + 1 : optarg)) { /* SSH2 only */ options.ciphers = xstrdup(optarg); options.cipher = SSH_CIPHER_INVALID; - } else { - /* 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 = __UNCONST("3des-cbc"); - else if (options.cipher == SSH_CIPHER_BLOWFISH) - options.ciphers = - __UNCONST("blowfish-cbc"); - else - options.ciphers = (char *)-1; + 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 = xstrdup("3des-cbc"); + else if (options.cipher == SSH_CIPHER_BLOWFISH) + options.ciphers = xstrdup("blowfish-cbc"); + else + options.ciphers = xstrdup(KEX_CLIENT_ENCRYPT); break; case 'm': if (mac_valid(optarg)) Index: src/crypto/external/bsd/openssh/dist/sshd_config.5 diff -u src/crypto/external/bsd/openssh/dist/sshd_config.5:1.18 src/crypto/external/bsd/openssh/dist/sshd_config.5:1.19 --- src/crypto/external/bsd/openssh/dist/sshd_config.5:1.18 Thu Jul 2 21:00:00 2015 +++ src/crypto/external/bsd/openssh/dist/sshd_config.5 Thu Aug 13 06:33:21 2015 @@ -1,4 +1,4 @@ -.\" $NetBSD: sshd_config.5,v 1.18 2015/07/03 01:00:00 christos Exp $ +.\" $NetBSD: sshd_config.5,v 1.19 2015/08/13 10:33:21 christos Exp $ .\" -*- nroff -*- .\" .\" Author: Tatu Ylonen <y...@cs.hut.fi> @@ -35,8 +35,8 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $OpenBSD: sshd_config.5,v 1.204 2015/06/05 03:44:14 djm Exp $ -.Dd June 5 2015 +.\" $OpenBSD: sshd_config.5,v 1.210 2015/08/06 14:53:21 deraadt Exp $ +.Dd August 6 2015 .Dt SSHD_CONFIG 5 .Os .Sh NAME @@ -437,6 +437,11 @@ The default is not to .It Cm Ciphers Specifies the ciphers allowed for protocol version 2. 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: .Pp .Bl -item -compact -offset indent @@ -643,9 +648,21 @@ The default is .It Cm HostbasedAcceptedKeyTypes Specifies the key types that will be accepted for hostbased authentication as a comma-separated pattern list. -The default -.Dq * -will allow all key types. +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: +.Bd -literal -offset 3n +ecdsa-sha2-nistp256-cert-...@openssh.com, +ecdsa-sha2-nistp384-cert-...@openssh.com, +ecdsa-sha2-nistp521-cert-...@openssh.com, +ssh-ed25519-cert-...@openssh.com, +ssh-rsa-cert-...@openssh.com, +ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521, +ssh-ed25519,ssh-rsa +.Ed +.Pp The .Fl Q option of @@ -697,9 +714,15 @@ for protocol version 1, and and .Pa /etc/ssh/ssh_host_rsa_key for protocol version 2. +.Pp Note that .Xr sshd 8 -will refuse to use a file if it is group/world-accessible. +will refuse to use a file if it is group/world-accessible +and that the +.Cm HostKeyAlgorithms +option restricts which of the keys are actually used by +.Xr sshd 8 . +.Pp It is possible to have multiple host key files. .Dq rsa1 keys are used for version 1 and @@ -721,6 +744,26 @@ If is specified, the location of the socket will be read from the .Ev SSH_AUTH_SOCK environment variable. +.It Cm HostKeyAlgorithms +Specifies the protocol version 2 host key algorithms +that the server offers. +The default for this option is: +.Bd -literal -offset 3n +ecdsa-sha2-nistp256-cert-...@openssh.com, +ecdsa-sha2-nistp384-cert-...@openssh.com, +ecdsa-sha2-nistp521-cert-...@openssh.com, +ssh-ed25519-cert-...@openssh.com, +ssh-rsa-cert-...@openssh.com, +ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521, +ssh-ed25519,ssh-rsa +.Ed +.Pp +The list of available key types may also be obtained using the +.Fl Q +option of +.Xr ssh 1 +with an argument of +.Dq key . .It Cm IgnoreRhosts Specifies that .Pa .rhosts @@ -824,6 +867,10 @@ The default is .It Cm KexAlgorithms Specifies the available KEX (Key Exchange) algorithms. 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: .Pp .Bl -item -compact -offset indent @@ -924,6 +971,11 @@ Specifies the available MAC (message aut The MAC algorithm is used in protocol version 2 for data integrity protection. 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 .Dq -etm calculate the MAC after encryption (encrypt-then-mac). @@ -1157,16 +1209,19 @@ Specifies whether root can log in using .Xr ssh 1 . The argument must be .Dq yes , +.Dq prohibit-password , .Dq without-password , .Dq forced-commands-only , or .Dq no . The default is -.Dq no . +.Dq prohibit-password . .Pp If this option is set to +.Dq prohibit-password +or .Dq without-password , -password authentication is disabled for root. +password and keyboard-interactive authentication are disabled for root. .Pp If this option is set to .Dq forced-commands-only , @@ -1284,9 +1339,21 @@ is identical to .It Cm PubkeyAcceptedKeyTypes Specifies the key types that will be accepted for public key authentication as a comma-separated pattern list. -The default -.Dq * -will allow all key types. +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: +.Bd -literal -offset 3n +ecdsa-sha2-nistp256-cert-...@openssh.com, +ecdsa-sha2-nistp384-cert-...@openssh.com, +ecdsa-sha2-nistp521-cert-...@openssh.com, +ssh-ed25519-cert-...@openssh.com, +ssh-rsa-cert-...@openssh.com, +ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521, +ssh-ed25519,ssh-rsa +.Ed +.Pp The .Fl Q option of @@ -1348,7 +1415,7 @@ The default is This option applies to protocol version 1 only. .It Cm ServerKeyBits Defines the number of bits in the ephemeral protocol version 1 server key. -The minimum value is 512, and the default is 1024. +The default and minimum value is 1024. .It Cm StreamLocalBindMask Sets the octal file creation mode mask .Pq umask @@ -1456,11 +1523,20 @@ For more details on certificates, see th .It Cm UseDNS Specifies whether .Xr sshd 8 -should look up the remote host name and check that +should look up the remote host name, and to check that the resolved host name for the remote IP address maps back to the very same IP address. -The default is -.Dq no . +.Pp +If this option is set to +.Dq no +(the default) then only addresses and not host names may be used in +.Pa ~/.ssh/known_hosts +.Cm from +and +.Xr sshd_config 5 +.Cm Match +.Cm Host +directives. .It Cm UseLogin Specifies whether .Xr login 1 Index: src/crypto/external/bsd/openssh/dist/ssh-keygen.c diff -u src/crypto/external/bsd/openssh/dist/ssh-keygen.c:1.17 src/crypto/external/bsd/openssh/dist/ssh-keygen.c:1.18 --- src/crypto/external/bsd/openssh/dist/ssh-keygen.c:1.17 Thu Jul 2 21:00:00 2015 +++ src/crypto/external/bsd/openssh/dist/ssh-keygen.c Thu Aug 13 06:33:21 2015 @@ -1,5 +1,5 @@ -/* $NetBSD: ssh-keygen.c,v 1.17 2015/07/03 01:00:00 christos Exp $ */ -/* $OpenBSD: ssh-keygen.c,v 1.274 2015/05/28 07:37:31 djm Exp $ */ +/* $NetBSD: ssh-keygen.c,v 1.18 2015/08/13 10:33:21 christos Exp $ */ +/* $OpenBSD: ssh-keygen.c,v 1.276 2015/07/03 03:49:45 djm Exp $ */ /* * Author: Tatu Ylonen <y...@cs.hut.fi> * Copyright (c) 1994 Tatu Ylonen <y...@cs.hut.fi>, Espoo, Finland @@ -14,7 +14,7 @@ */ #include "includes.h" -__RCSID("$NetBSD: ssh-keygen.c,v 1.17 2015/07/03 01:00:00 christos Exp $"); +__RCSID("$NetBSD: ssh-keygen.c,v 1.18 2015/08/13 10:33:21 christos Exp $"); #include <sys/types.h> #include <sys/socket.h> #include <sys/stat.h> @@ -215,8 +215,8 @@ type_bits_valid(int type, const char *na fatal("key bits exceeds maximum %d", maxbits); if (type == KEY_DSA && *bitsp != 1024) fatal("DSA keys must be 1024 bits"); - else if (type != KEY_ECDSA && type != KEY_ED25519 && *bitsp < 768) - fatal("Key must at least be 768 bits"); + else if (type != KEY_ECDSA && type != KEY_ED25519 && *bitsp < 1024) + fatal("Key must at least be 1024 bits"); else if (type == KEY_ECDSA && sshkey_ecdsa_bits_to_nid(*bitsp) == -1) fatal("Invalid ECDSA key length - valid lengths are " "256, 384 or 521 bits"); @@ -237,7 +237,6 @@ ask_filename(struct passwd *pw, const ch name = _PATH_SSH_CLIENT_IDENTITY; break; case KEY_DSA_CERT: - case KEY_DSA_CERT_V00: case KEY_DSA: name = _PATH_SSH_CLIENT_ID_DSA; break; @@ -246,7 +245,6 @@ ask_filename(struct passwd *pw, const ch name = _PATH_SSH_CLIENT_ID_ECDSA; break; case KEY_RSA_CERT: - case KEY_RSA_CERT_V00: case KEY_RSA: name = _PATH_SSH_CLIENT_ID_RSA; break; @@ -1564,25 +1562,6 @@ do_ca_sign(struct passwd *pw, int argc, struct sshkey *ca, *public; char *otmp, *tmp, *cp, *out, *comment, **plist = NULL; FILE *f; - int v00 = 0; /* legacy keys */ - - if (key_type_name != NULL) { - switch (sshkey_type_from_name(key_type_name)) { - case KEY_RSA_CERT_V00: - case KEY_DSA_CERT_V00: - v00 = 1; - break; - case KEY_UNSPEC: - if (strcasecmp(key_type_name, "v00") == 0) { - v00 = 1; - break; - } else if (strcasecmp(key_type_name, "v01") == 0) - break; - /* FALLTHROUGH */ - default: - fatal("unknown key type %s", key_type_name); - } - } #ifdef ENABLE_PKCS11 pkcs11_init(1); @@ -1619,7 +1598,7 @@ do_ca_sign(struct passwd *pw, int argc, __func__, tmp, sshkey_type(public)); /* Prepare certificate to sign */ - if ((r = sshkey_to_certified(public, v00)) != 0) + if ((r = sshkey_to_certified(public)) != 0) fatal("Could not upgrade key %s to certificate: %s", tmp, ssh_err(r)); public->cert->type = cert_key_type; @@ -1629,15 +1608,9 @@ do_ca_sign(struct passwd *pw, int argc, public->cert->principals = plist; public->cert->valid_after = cert_valid_from; public->cert->valid_before = cert_valid_to; - if (v00) { - prepare_options_buf(public->cert->critical, - OPTIONS_CRITICAL|OPTIONS_EXTENSIONS); - } else { - prepare_options_buf(public->cert->critical, - OPTIONS_CRITICAL); - prepare_options_buf(public->cert->extensions, - OPTIONS_EXTENSIONS); - } + prepare_options_buf(public->cert->critical, OPTIONS_CRITICAL); + prepare_options_buf(public->cert->extensions, + OPTIONS_EXTENSIONS); if ((r = sshkey_from_private(ca, &public->cert->signature_key)) != 0) fatal("key_from_private (ca key): %s", ssh_err(r)); @@ -1823,7 +1796,7 @@ add_cert_option(char *opt) } static void -show_options(struct sshbuf *optbuf, int v00, int in_critical) +show_options(struct sshbuf *optbuf, int in_critical) { char *name, *arg; struct sshbuf *options, *option = NULL; @@ -1838,14 +1811,14 @@ show_options(struct sshbuf *optbuf, int (r = sshbuf_froms(options, &option)) != 0) fatal("%s: buffer error: %s", __func__, ssh_err(r)); printf(" %s", name); - if ((v00 || !in_critical) && + if (!in_critical && (strcmp(name, "permit-X11-forwarding") == 0 || strcmp(name, "permit-agent-forwarding") == 0 || strcmp(name, "permit-port-forwarding") == 0 || strcmp(name, "permit-pty") == 0 || strcmp(name, "permit-user-rc") == 0)) printf("\n"); - else if ((v00 || in_critical) && + else if (in_critical && (strcmp(name, "force-command") == 0 || strcmp(name, "source-address") == 0)) { if ((r = sshbuf_get_cstring(option, &arg, NULL)) != 0) @@ -1872,7 +1845,7 @@ do_show_cert(struct passwd *pw) struct sshkey *key; struct stat st; char *key_fp, *ca_fp; - u_int i, v00; + u_int i; int r; if (!have_identity) @@ -1884,7 +1857,6 @@ do_show_cert(struct passwd *pw) identity_file, ssh_err(r)); if (!sshkey_is_cert(key)) fatal("%s is not a certificate", identity_file); - v00 = key->type == KEY_RSA_CERT_V00 || key->type == KEY_DSA_CERT_V00; key_fp = sshkey_fingerprint(key, fingerprint_hash, SSH_FP_DEFAULT); ca_fp = sshkey_fingerprint(key->cert->signature_key, @@ -1899,10 +1871,7 @@ do_show_cert(struct passwd *pw) printf(" Signing CA: %s %s\n", sshkey_type(key->cert->signature_key), ca_fp); printf(" Key ID: \"%s\"\n", key->cert->key_id); - if (!v00) { - printf(" Serial: %llu\n", - (unsigned long long)key->cert->serial); - } + printf(" Serial: %llu\n", (unsigned long long)key->cert->serial); printf(" Valid: %s\n", fmt_validity(key->cert->valid_after, key->cert->valid_before)); printf(" Principals: "); @@ -1919,16 +1888,14 @@ do_show_cert(struct passwd *pw) printf("(none)\n"); else { printf("\n"); - show_options(key->cert->critical, v00, 1); + show_options(key->cert->critical, 1); } - if (!v00) { - printf(" Extensions: "); - if (sshbuf_len(key->cert->extensions) == 0) - printf("(none)\n"); - else { - printf("\n"); - show_options(key->cert->extensions, v00, 0); - } + printf(" Extensions: "); + if (sshbuf_len(key->cert->extensions) == 0) + printf("(none)\n"); + else { + printf("\n"); + show_options(key->cert->extensions, 0); } exit(0); } Index: src/crypto/external/bsd/openssh/dist/ssh.h diff -u src/crypto/external/bsd/openssh/dist/ssh.h:1.5 src/crypto/external/bsd/openssh/dist/ssh.h:1.6 --- src/crypto/external/bsd/openssh/dist/ssh.h:1.5 Fri Apr 3 19:58:19 2015 +++ src/crypto/external/bsd/openssh/dist/ssh.h Thu Aug 13 06:33:21 2015 @@ -1,5 +1,5 @@ -/* $NetBSD: ssh.h,v 1.5 2015/04/03 23:58:19 christos Exp $ */ -/* $OpenBSD: ssh.h,v 1.79 2010/06/25 07:14:46 djm Exp $ */ +/* $NetBSD: ssh.h,v 1.6 2015/08/13 10:33:21 christos Exp $ */ +/* $OpenBSD: ssh.h,v 1.81 2015/08/04 05:23:06 djm Exp $ */ /* * Author: Tatu Ylonen <y...@cs.hut.fi> Index: src/crypto/external/bsd/openssh/dist/sshconnect2.c diff -u src/crypto/external/bsd/openssh/dist/sshconnect2.c:1.21 src/crypto/external/bsd/openssh/dist/sshconnect2.c:1.22 --- src/crypto/external/bsd/openssh/dist/sshconnect2.c:1.21 Mon Jul 6 11:09:17 2015 +++ src/crypto/external/bsd/openssh/dist/sshconnect2.c Thu Aug 13 06:33:21 2015 @@ -1,5 +1,5 @@ -/* $NetBSD: sshconnect2.c,v 1.21 2015/07/06 15:09:17 christos Exp $ */ -/* $OpenBSD: sshconnect2.c,v 1.224 2015/05/04 06:10:48 djm Exp $ */ +/* $NetBSD: sshconnect2.c,v 1.22 2015/08/13 10:33:21 christos 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) 2008 Damien Miller. All rights reserved. @@ -26,7 +26,7 @@ */ #include "includes.h" -__RCSID("$NetBSD: sshconnect2.c,v 1.21 2015/07/06 15:09:17 christos Exp $"); +__RCSID("$NetBSD: sshconnect2.c,v 1.22 2015/08/13 10:33:21 christos Exp $"); #include <sys/types.h> #include <sys/socket.h> #include <sys/wait.h> @@ -169,18 +169,12 @@ ssh_kex2(char *host, struct sockaddr *ho xxx_host = host; xxx_hostaddr = hostaddr; - if (options.ciphers == (char *)-1) { - logit("No valid ciphers for protocol version 2 given, using defaults."); - options.ciphers = NULL; - } - if (options.ciphers != NULL) { - myproposal[PROPOSAL_ENC_ALGS_CTOS] = - myproposal[PROPOSAL_ENC_ALGS_STOC] = options.ciphers; - } + myproposal[PROPOSAL_KEX_ALGS] = compat_kex_proposal( + options.kex_algorithms); myproposal[PROPOSAL_ENC_ALGS_CTOS] = - compat_cipher_proposal(myproposal[PROPOSAL_ENC_ALGS_CTOS]); + compat_cipher_proposal(options.ciphers); myproposal[PROPOSAL_ENC_ALGS_STOC] = - compat_cipher_proposal(myproposal[PROPOSAL_ENC_ALGS_STOC]); + compat_cipher_proposal(options.ciphers); if (options.compression) { myproposal[PROPOSAL_COMP_ALGS_CTOS] = myproposal[PROPOSAL_COMP_ALGS_STOC] = "z...@openssh.com,zlib,none"; @@ -188,23 +182,22 @@ ssh_kex2(char *host, struct sockaddr *ho myproposal[PROPOSAL_COMP_ALGS_CTOS] = myproposal[PROPOSAL_COMP_ALGS_STOC] = "none,z...@openssh.com,zlib"; } - if (options.macs != NULL) { - myproposal[PROPOSAL_MAC_ALGS_CTOS] = - myproposal[PROPOSAL_MAC_ALGS_STOC] = options.macs; - } - if (options.hostkeyalgorithms != NULL) + myproposal[PROPOSAL_MAC_ALGS_CTOS] = + myproposal[PROPOSAL_MAC_ALGS_STOC] = options.macs; + if (options.hostkeyalgorithms != NULL) { + if (kex_assemble_names(KEX_DEFAULT_PK_ALG, + &options.hostkeyalgorithms) != 0) + fatal("%s: kex_assemble_namelist", __func__); myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = compat_pkalg_proposal(options.hostkeyalgorithms); - else { + } else { + /* Enforce default */ + options.hostkeyalgorithms = xstrdup(KEX_DEFAULT_PK_ALG); /* Prefer algorithms that we already have keys for */ myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = compat_pkalg_proposal( 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) packet_set_rekey_limits((u_int32_t)options.rekey_limit, @@ -1352,6 +1345,26 @@ pubkey_cleanup(Authctxt *authctxt) } } +static int +try_identity(Identity *id) +{ + if (!id->key) + return (0); + if (match_pattern_list(sshkey_ssh_name(id->key), + options.pubkey_key_types, 0) != 1) { + debug("Skipping %s key %s for not in PubkeyAcceptedKeyTypes", + sshkey_ssh_name(id->key), id->filename); + return (0); + } + if (key_type_plain(id->key->type) == KEY_RSA && + (datafellows & SSH_BUG_RSASIGMD5) != 0) { + debug("Skipped %s key %s for RSA/MD5 server", + key_type(id->key), id->filename); + return (0); + } + return (id->key->type != KEY_RSA1); +} + int userauth_pubkey(Authctxt *authctxt) { @@ -1370,11 +1383,7 @@ userauth_pubkey(Authctxt *authctxt) * private key instead */ if (id->key != NULL) { - if (key_type_plain(id->key->type) == KEY_RSA && - (datafellows & SSH_BUG_RSASIGMD5) != 0) { - debug("Skipped %s key %s for RSA/MD5 server", - key_type(id->key), id->filename); - } else if (id->key->type != KEY_RSA1) { + if (try_identity(id)) { debug("Offering %s public key: %s", key_type(id->key), id->filename); sent = send_pubkey_test(authctxt, id); @@ -1384,13 +1393,8 @@ userauth_pubkey(Authctxt *authctxt) id->key = load_identity_file(id->filename, id->userprovided); if (id->key != NULL) { - id->isprivate = 1; - if (key_type_plain(id->key->type) == KEY_RSA && - (datafellows & SSH_BUG_RSASIGMD5) != 0) { - debug("Skipped %s key %s for RSA/MD5 " - "server", key_type(id->key), - id->filename); - } else { + if (try_identity(id)) { + id->isprivate = 1; sent = sign_and_send_pubkey( authctxt, id); } Index: src/crypto/external/bsd/openssh/dist/sshd.c diff -u src/crypto/external/bsd/openssh/dist/sshd.c:1.20 src/crypto/external/bsd/openssh/dist/sshd.c:1.21 --- src/crypto/external/bsd/openssh/dist/sshd.c:1.20 Mon Jul 6 11:09:17 2015 +++ src/crypto/external/bsd/openssh/dist/sshd.c Thu Aug 13 06:33:21 2015 @@ -1,5 +1,5 @@ -/* $NetBSD: sshd.c,v 1.20 2015/07/06 15:09:17 christos Exp $ */ -/* $OpenBSD: sshd.c,v 1.450 2015/05/24 23:39:16 djm Exp $ */ +/* $NetBSD: sshd.c,v 1.21 2015/08/13 10:33:21 christos Exp $ */ +/* $OpenBSD: sshd.c,v 1.457 2015/07/30 00:01:34 djm Exp $ */ /* * Author: Tatu Ylonen <y...@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <y...@cs.hut.fi>, Espoo, Finland @@ -44,7 +44,7 @@ */ #include "includes.h" -__RCSID("$NetBSD: sshd.c,v 1.20 2015/07/06 15:09:17 christos Exp $"); +__RCSID("$NetBSD: sshd.c,v 1.21 2015/08/13 10:33:21 christos Exp $"); #include <sys/types.h> #include <sys/param.h> #include <sys/ioctl.h> @@ -81,6 +81,7 @@ __RCSID("$NetBSD: sshd.c,v 1.20 2015/07/ #include "log.h" #include "buffer.h" #include "misc.h" +#include "match.h" #include "servconf.h" #include "uidswap.h" #include "compat.h" @@ -789,8 +790,15 @@ list_hostkey_types(void) key = sensitive_data.host_keys[i]; if (key == NULL) key = sensitive_data.host_pubkeys[i]; - if (key == NULL) + if (key == NULL || key->type == KEY_RSA1) + continue; + /* Check that the key is accepted in HostkeyAlgorithms */ + if (match_pattern_list(sshkey_ssh_name(key), + options.hostkeyalgorithms, 0) != 1) { + debug3("%s: %s key not permitted by HostkeyAlgorithms", + __func__, sshkey_ssh_name(key)); continue; + } switch (key->type) { case KEY_RSA: case KEY_DSA: @@ -807,8 +815,6 @@ list_hostkey_types(void) if (key == NULL) continue; switch (key->type) { - case KEY_RSA_CERT_V00: - case KEY_DSA_CERT_V00: case KEY_RSA_CERT: case KEY_DSA_CERT: case KEY_ECDSA_CERT: @@ -835,8 +841,6 @@ get_hostkey_by_type(int type, int nid, i for (i = 0; i < options.num_host_key_files; i++) { switch (type) { - case KEY_RSA_CERT_V00: - case KEY_DSA_CERT_V00: case KEY_RSA_CERT: case KEY_DSA_CERT: case KEY_ECDSA_CERT: @@ -1813,8 +1817,8 @@ main(int ac, char **av) #ifdef WITH_SSH1 /* Check certain values for sanity. */ if (options.protocol & SSH_PROTO_1) { - if (options.server_key_bits < 512 || - options.server_key_bits > 32768) { + if (options.server_key_bits < SSH_RSA_MINIMUM_MODULUS_SIZE || + options.server_key_bits > OPENSSL_RSA_MAX_MODULUS_BITS) { fprintf(stderr, "Bad server key size.\n"); exit(1); } @@ -2446,9 +2450,7 @@ sshd_hostkey_sign(Key *privkey, Key *pub return 0; } -/* - * SSH2 key exchange: diffie-hellman-group1-sha1 - */ +/* SSH2 key exchange */ static void do_ssh2_kex(void) { @@ -2456,23 +2458,27 @@ do_ssh2_kex(void) struct kex *kex; int r; - if (options.ciphers != NULL) { - myproposal[PROPOSAL_ENC_ALGS_CTOS] = - myproposal[PROPOSAL_ENC_ALGS_STOC] = options.ciphers; - } else if (options.none_enabled == 1) { + myproposal[PROPOSAL_KEX_ALGS] = compat_kex_proposal( + options.kex_algorithms); + + if (strcmp(options.ciphers, KEX_SERVER_ENCRYPT) == 0 && + options.none_enabled == 1) { debug ("WARNING: None cipher enabled"); myproposal[PROPOSAL_ENC_ALGS_CTOS] = - myproposal[PROPOSAL_ENC_ALGS_STOC] = KEX_CLIENT_ENCRYPT_INCLUDE_NONE; + myproposal[PROPOSAL_ENC_ALGS_STOC] = KEX_SERVER_ENCRYPT_INCLUDE_NONE; + } else { + myproposal[PROPOSAL_ENC_ALGS_CTOS] = + myproposal[PROPOSAL_ENC_ALGS_STOC] = options.ciphers; } + myproposal[PROPOSAL_ENC_ALGS_CTOS] = compat_cipher_proposal(myproposal[PROPOSAL_ENC_ALGS_CTOS]); myproposal[PROPOSAL_ENC_ALGS_STOC] = compat_cipher_proposal(myproposal[PROPOSAL_ENC_ALGS_STOC]); - if (options.macs != NULL) { - myproposal[PROPOSAL_MAC_ALGS_CTOS] = - myproposal[PROPOSAL_MAC_ALGS_STOC] = options.macs; - } + myproposal[PROPOSAL_MAC_ALGS_CTOS] = + myproposal[PROPOSAL_MAC_ALGS_STOC] = options.macs; + if (options.compression == COMP_NONE) { myproposal[PROPOSAL_COMP_ALGS_CTOS] = myproposal[PROPOSAL_COMP_ALGS_STOC] = "none"; @@ -2480,11 +2486,6 @@ do_ssh2_kex(void) myproposal[PROPOSAL_COMP_ALGS_CTOS] = myproposal[PROPOSAL_COMP_ALGS_STOC] = "none,z...@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) packet_set_rekey_limits((u_int32_t)options.rekey_limit,