summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-04-17 18:11:36 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-04-17 18:11:36 +0000
commit982dbbcfda7ab9e56c4caccfba6f8920529421b7 (patch)
tree1c7d3ed45ad2f89c2e0009a188b76e6171d593a2
parent4c8cff14ddac08f1bdb393d71d9e0907d9a9215e (diff)
- markus@cvs.openbsd.org 2001/04/17 10:53:26
[key.c key.h readconf.c readconf.h ssh.1 sshconnect2.c] add HostKeyAlgorithms; based on patch from res@shore.net; ok provos@
-rw-r--r--ChangeLog7
-rw-r--r--key.c24
-rw-r--r--key.h3
-rw-r--r--readconf.c19
-rw-r--r--readconf.h3
-rw-r--r--ssh.17
-rw-r--r--sshconnect2.c5
7 files changed, 59 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index f5d9863ad..011bd960d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,9 +9,12 @@
9 - markus@cvs.openbsd.org 2001/04/17 08:14:01 9 - markus@cvs.openbsd.org 2001/04/17 08:14:01
10 [sshconnect1.c] 10 [sshconnect1.c]
11 check for key!=NULL, thanks to costa 11 check for key!=NULL, thanks to costa
12 - markus@cvs.openbsd.org 2001/04/17 09:52:48 12 - markus@cvs.openbsd.org 2001/04/17 09:52:48
13 [clientloop.c] 13 [clientloop.c]
14 handle EINTR/EAGAIN on read; ok deraadt@ 14 handle EINTR/EAGAIN on read; ok deraadt@
15 - markus@cvs.openbsd.org 2001/04/17 10:53:26
16 [key.c key.h readconf.c readconf.h ssh.1 sshconnect2.c]
17 add HostKeyAlgorithms; based on patch from res@shore.net; ok provos@
15 18
1620010416 1920010416
17 - OpenBSD CVS Sync 20 - OpenBSD CVS Sync
@@ -5137,4 +5140,4 @@
5137 - Wrote replacements for strlcpy and mkdtemp 5140 - Wrote replacements for strlcpy and mkdtemp
5138 - Released 1.0pre1 5141 - Released 1.0pre1
5139 5142
5140$Id: ChangeLog,v 1.1133 2001/04/17 18:09:42 mouring Exp $ 5143$Id: ChangeLog,v 1.1134 2001/04/17 18:11:36 mouring Exp $
diff --git a/key.c b/key.c
index fbd9f4efc..3b9f9f786 100644
--- a/key.c
+++ b/key.c
@@ -32,7 +32,7 @@
32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */ 33 */
34#include "includes.h" 34#include "includes.h"
35RCSID("$OpenBSD: key.c,v 1.24 2001/04/16 08:26:04 deraadt Exp $"); 35RCSID("$OpenBSD: key.c,v 1.25 2001/04/17 10:53:24 markus Exp $");
36 36
37#include <openssl/evp.h> 37#include <openssl/evp.h>
38 38
@@ -629,6 +629,28 @@ key_type_from_name(char *name)
629 return KEY_UNSPEC; 629 return KEY_UNSPEC;
630} 630}
631 631
632int
633key_names_valid2(const char *names)
634{
635 char *s, *cp, *p;
636
637 if (names == NULL || strcmp(names, "") == 0)
638 return 0;
639 s = cp = xstrdup(names);
640 for ((p = strsep(&cp, ",")); p && *p != '\0';
641 (p = strsep(&cp, ","))) {
642 switch (key_type_from_name(p)) {
643 case KEY_RSA1:
644 case KEY_UNSPEC:
645 xfree(s);
646 return 0;
647 }
648 }
649 debug3("key names ok: [%s]", names);
650 xfree(s);
651 return 1;
652}
653
632Key * 654Key *
633key_from_blob(char *blob, int blen) 655key_from_blob(char *blob, int blen)
634{ 656{
diff --git a/key.h b/key.h
index 251c565aa..cee31c30a 100644
--- a/key.h
+++ b/key.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: key.h,v 1.11 2001/03/12 22:02:01 markus Exp $ */ 1/* $OpenBSD: key.h,v 1.12 2001/04/17 10:53:24 markus Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2000 Markus Friedl. All rights reserved. 4 * Copyright (c) 2000 Markus Friedl. All rights reserved.
@@ -67,6 +67,7 @@ int key_type_from_name(char *name);
67Key *key_from_blob(char *blob, int blen); 67Key *key_from_blob(char *blob, int blen);
68int key_to_blob(Key *key, u_char **blobp, u_int *lenp); 68int key_to_blob(Key *key, u_char **blobp, u_int *lenp);
69char *key_ssh_name(Key *k); 69char *key_ssh_name(Key *k);
70int key_names_valid2(const char *names);
70 71
71int 72int
72key_sign( 73key_sign(
diff --git a/readconf.c b/readconf.c
index a14d0a55d..b30c61f28 100644
--- a/readconf.c
+++ b/readconf.c
@@ -12,7 +12,7 @@
12 */ 12 */
13 13
14#include "includes.h" 14#include "includes.h"
15RCSID("$OpenBSD: readconf.c,v 1.75 2001/04/15 21:28:35 stevesk Exp $"); 15RCSID("$OpenBSD: readconf.c,v 1.76 2001/04/17 10:53:25 markus Exp $");
16 16
17#include "ssh.h" 17#include "ssh.h"
18#include "xmalloc.h" 18#include "xmalloc.h"
@@ -110,7 +110,8 @@ typedef enum {
110 oUsePrivilegedPort, oLogLevel, oCiphers, oProtocol, oMacs, 110 oUsePrivilegedPort, oLogLevel, oCiphers, oProtocol, oMacs,
111 oGlobalKnownHostsFile2, oUserKnownHostsFile2, oPubkeyAuthentication, 111 oGlobalKnownHostsFile2, oUserKnownHostsFile2, oPubkeyAuthentication,
112 oKbdInteractiveAuthentication, oKbdInteractiveDevices, oHostKeyAlias, 112 oKbdInteractiveAuthentication, oKbdInteractiveDevices, oHostKeyAlias,
113 oDynamicForward, oPreferredAuthentications, oHostbasedAuthentication 113 oDynamicForward, oPreferredAuthentications, oHostbasedAuthentication,
114 oHostKeyAlgorithms
114} OpCodes; 115} OpCodes;
115 116
116/* Textual representations of the tokens. */ 117/* Textual representations of the tokens. */
@@ -175,6 +176,7 @@ static struct {
175 { "loglevel", oLogLevel }, 176 { "loglevel", oLogLevel },
176 { "dynamicforward", oDynamicForward }, 177 { "dynamicforward", oDynamicForward },
177 { "preferredauthentications", oPreferredAuthentications }, 178 { "preferredauthentications", oPreferredAuthentications },
179 { "hostkeyalgorithms", oHostKeyAlgorithms },
178 { NULL, 0 } 180 { NULL, 0 }
179}; 181};
180 182
@@ -527,6 +529,17 @@ parse_int:
527 options->macs = xstrdup(arg); 529 options->macs = xstrdup(arg);
528 break; 530 break;
529 531
532 case oHostKeyAlgorithms:
533 arg = strdelim(&s);
534 if (!arg || *arg == '\0')
535 fatal("%.200s line %d: Missing argument.", filename, linenum);
536 if (!key_names_valid2(arg))
537 fatal("%.200s line %d: Bad protocol 2 host key algorithms '%s'.",
538 filename, linenum, arg ? arg : "<NONE>");
539 if (*activep && options->hostkeyalgorithms == NULL)
540 options->hostkeyalgorithms = xstrdup(arg);
541 break;
542
530 case oProtocol: 543 case oProtocol:
531 intptr = &options->protocol; 544 intptr = &options->protocol;
532 arg = strdelim(&s); 545 arg = strdelim(&s);
@@ -732,6 +745,7 @@ initialize_options(Options * options)
732 options->cipher = -1; 745 options->cipher = -1;
733 options->ciphers = NULL; 746 options->ciphers = NULL;
734 options->macs = NULL; 747 options->macs = NULL;
748 options->hostkeyalgorithms = NULL;
735 options->protocol = SSH_PROTO_UNKNOWN; 749 options->protocol = SSH_PROTO_UNKNOWN;
736 options->num_identity_files = 0; 750 options->num_identity_files = 0;
737 options->hostname = NULL; 751 options->hostname = NULL;
@@ -824,6 +838,7 @@ fill_default_options(Options * options)
824 options->cipher = SSH_CIPHER_NOT_SET; 838 options->cipher = SSH_CIPHER_NOT_SET;
825 /* options->ciphers, default set in myproposals.h */ 839 /* options->ciphers, default set in myproposals.h */
826 /* options->macs, default set in myproposals.h */ 840 /* options->macs, default set in myproposals.h */
841 /* options->hostkeyalgorithms, default set in myproposals.h */
827 if (options->protocol == SSH_PROTO_UNKNOWN) 842 if (options->protocol == SSH_PROTO_UNKNOWN)
828 options->protocol = SSH_PROTO_1|SSH_PROTO_2; 843 options->protocol = SSH_PROTO_1|SSH_PROTO_2;
829 if (options->num_identity_files == 0) { 844 if (options->num_identity_files == 0) {
diff --git a/readconf.h b/readconf.h
index 680068b09..9e943f905 100644
--- a/readconf.h
+++ b/readconf.h
@@ -11,7 +11,7 @@
11 * called by a name other than "ssh" or "Secure Shell". 11 * called by a name other than "ssh" or "Secure Shell".
12 */ 12 */
13 13
14/* RCSID("$OpenBSD: readconf.h,v 1.29 2001/04/12 19:15:25 markus Exp $"); */ 14/* RCSID("$OpenBSD: readconf.h,v 1.30 2001/04/17 10:53:25 markus Exp $"); */
15 15
16#ifndef READCONF_H 16#ifndef READCONF_H
17#define READCONF_H 17#define READCONF_H
@@ -72,6 +72,7 @@ typedef struct {
72 int cipher; /* Cipher to use. */ 72 int cipher; /* Cipher to use. */
73 char *ciphers; /* SSH2 ciphers in order of preference. */ 73 char *ciphers; /* SSH2 ciphers in order of preference. */
74 char *macs; /* SSH2 macs in order of preference. */ 74 char *macs; /* SSH2 macs in order of preference. */
75 char *hostkeyalgorithms; /* SSH2 server key types in order of preference. */
75 int protocol; /* Protocol in order of preference. */ 76 int protocol; /* Protocol in order of preference. */
76 char *hostname; /* Real host to connect. */ 77 char *hostname; /* Real host to connect. */
77 char *host_key_alias; /* hostname alias for .ssh/known_hosts */ 78 char *host_key_alias; /* hostname alias for .ssh/known_hosts */
diff --git a/ssh.1 b/ssh.1
index e775d0dcb..9e0298bd3 100644
--- a/ssh.1
+++ b/ssh.1
@@ -34,7 +34,7 @@
34.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 34.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
35.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36.\" 36.\"
37.\" $OpenBSD: ssh.1,v 1.102 2001/04/10 09:13:22 itojun Exp $ 37.\" $OpenBSD: ssh.1,v 1.103 2001/04/17 10:53:26 markus Exp $
38.Dd September 25, 1999 38.Dd September 25, 1999
39.Dt SSH 1 39.Dt SSH 1
40.Os 40.Os
@@ -776,6 +776,11 @@ real host name when looking up or saving the host key
776in the known_hosts files. 776in the known_hosts files.
777This option is useful for tunneling ssh connections 777This option is useful for tunneling ssh connections
778or if you have multiple servers running on a single host. 778or if you have multiple servers running on a single host.
779.It Cm HostKeyAlgorithms
780Specfies the protocol version 2 host key algorithms
781that the client wants to use in order of preference.
782The default for this option is:
783.Dq ssh-rsa,ssh-dss
779.It Cm HostName 784.It Cm HostName
780Specifies the real host name to log into. 785Specifies the real host name to log into.
781This can be used to specify nicknames or abbreviations for hosts. 786This can be used to specify nicknames or abbreviations for hosts.
diff --git a/sshconnect2.c b/sshconnect2.c
index 4acdd0171..baa4e7028 100644
--- a/sshconnect2.c
+++ b/sshconnect2.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: sshconnect2.c,v 1.69 2001/04/15 08:43:47 markus Exp $"); 26RCSID("$OpenBSD: sshconnect2.c,v 1.70 2001/04/17 10:53:26 markus Exp $");
27 27
28#include <openssl/bn.h> 28#include <openssl/bn.h>
29#include <openssl/md5.h> 29#include <openssl/md5.h>
@@ -111,6 +111,9 @@ ssh_kex2(char *host, struct sockaddr *hostaddr)
111 myproposal[PROPOSAL_MAC_ALGS_CTOS] = 111 myproposal[PROPOSAL_MAC_ALGS_CTOS] =
112 myproposal[PROPOSAL_MAC_ALGS_STOC] = options.macs; 112 myproposal[PROPOSAL_MAC_ALGS_STOC] = options.macs;
113 } 113 }
114 if (options.hostkeyalgorithms != NULL)
115 myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] =
116 options.hostkeyalgorithms;
114 117
115 /* start key exchange */ 118 /* start key exchange */
116 kex = kex_setup(myproposal); 119 kex = kex_setup(myproposal);