diff options
author | Ben Lindstrom <mouring@eviladmin.org> | 2001-04-17 18:11:36 +0000 |
---|---|---|
committer | Ben Lindstrom <mouring@eviladmin.org> | 2001-04-17 18:11:36 +0000 |
commit | 982dbbcfda7ab9e56c4caccfba6f8920529421b7 (patch) | |
tree | 1c7d3ed45ad2f89c2e0009a188b76e6171d593a2 | |
parent | 4c8cff14ddac08f1bdb393d71d9e0907d9a9215e (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-- | ChangeLog | 7 | ||||
-rw-r--r-- | key.c | 24 | ||||
-rw-r--r-- | key.h | 3 | ||||
-rw-r--r-- | readconf.c | 19 | ||||
-rw-r--r-- | readconf.h | 3 | ||||
-rw-r--r-- | ssh.1 | 7 | ||||
-rw-r--r-- | sshconnect2.c | 5 |
7 files changed, 59 insertions, 9 deletions
@@ -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 | ||
16 | 20010416 | 19 | 20010416 |
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 $ |
@@ -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" |
35 | RCSID("$OpenBSD: key.c,v 1.24 2001/04/16 08:26:04 deraadt Exp $"); | 35 | RCSID("$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 | ||
632 | int | ||
633 | key_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 | |||
632 | Key * | 654 | Key * |
633 | key_from_blob(char *blob, int blen) | 655 | key_from_blob(char *blob, int blen) |
634 | { | 656 | { |
@@ -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); | |||
67 | Key *key_from_blob(char *blob, int blen); | 67 | Key *key_from_blob(char *blob, int blen); |
68 | int key_to_blob(Key *key, u_char **blobp, u_int *lenp); | 68 | int key_to_blob(Key *key, u_char **blobp, u_int *lenp); |
69 | char *key_ssh_name(Key *k); | 69 | char *key_ssh_name(Key *k); |
70 | int key_names_valid2(const char *names); | ||
70 | 71 | ||
71 | int | 72 | int |
72 | key_sign( | 73 | key_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" |
15 | RCSID("$OpenBSD: readconf.c,v 1.75 2001/04/15 21:28:35 stevesk Exp $"); | 15 | RCSID("$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 */ |
@@ -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 | |||
776 | in the known_hosts files. | 776 | in the known_hosts files. |
777 | This option is useful for tunneling ssh connections | 777 | This option is useful for tunneling ssh connections |
778 | or if you have multiple servers running on a single host. | 778 | or if you have multiple servers running on a single host. |
779 | .It Cm HostKeyAlgorithms | ||
780 | Specfies the protocol version 2 host key algorithms | ||
781 | that the client wants to use in order of preference. | ||
782 | The default for this option is: | ||
783 | .Dq ssh-rsa,ssh-dss | ||
779 | .It Cm HostName | 784 | .It Cm HostName |
780 | Specifies the real host name to log into. | 785 | Specifies the real host name to log into. |
781 | This can be used to specify nicknames or abbreviations for hosts. | 786 | This 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" |
26 | RCSID("$OpenBSD: sshconnect2.c,v 1.69 2001/04/15 08:43:47 markus Exp $"); | 26 | RCSID("$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); |