summaryrefslogtreecommitdiff
path: root/ssh.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2010-01-01 23:53:30 +0000
committerColin Watson <cjwatson@debian.org>2010-01-01 23:53:30 +0000
commitdf03186a4f9e0c2ece398b5c0571cb6263d7a752 (patch)
tree1aab079441dff9615274769b19f2d734ddf508dd /ssh.c
parent6ad6994c288662fca6949f42bf91fec2aff00bca (diff)
parent99b402ea4c8457b0a3cafff37f5b3410a8dc6476 (diff)
* New upstream release (closes: #536182). Yes, I know 5.3p1 has been out
for a while, but there's no GSSAPI patch available for it yet. - Change the default cipher order to prefer the AES CTR modes and the revised "arcfour256" mode to CBC mode ciphers that are susceptible to CPNI-957037 "Plaintext Recovery Attack Against SSH". - Add countermeasures to mitigate CPNI-957037-style attacks against the SSH protocol's use of CBC-mode ciphers. Upon detection of an invalid packet length or Message Authentication Code, ssh/sshd will continue reading up to the maximum supported packet length rather than immediately terminating the connection. This eliminates most of the known differences in behaviour that leaked information about the plaintext of injected data which formed the basis of this attack (closes: #506115, LP: #379329). - ForceCommand directive now accepts commandline arguments for the internal-sftp server (closes: #524423, LP: #362511). - Add AllowAgentForwarding to available Match keywords list (closes: #540623). - Make ssh(1) send the correct channel number for SSH2_MSG_CHANNEL_SUCCESS and SSH2_MSG_CHANNEL_FAILURE messages to avoid triggering 'Non-public channel' error messages on sshd(8) in openssh-5.1. - Avoid printing 'Non-public channel' warnings in sshd(8), since the ssh(1) has sent incorrect channel numbers since ~2004 (this reverts a behaviour introduced in openssh-5.1; closes: #496017). * Update to GSSAPI patch from http://www.sxw.org.uk/computing/patches/openssh-5.2p1-gsskex-all-20090726.patch, including cascading credentials support (LP: #416958).
Diffstat (limited to 'ssh.c')
-rw-r--r--ssh.c55
1 files changed, 25 insertions, 30 deletions
diff --git a/ssh.c b/ssh.c
index 2b55e6397..9e1a4b797 100644
--- a/ssh.c
+++ b/ssh.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh.c,v 1.318 2008/07/02 13:47:39 djm Exp $ */ 1/* $OpenBSD: ssh.c,v 1.324 2009/02/12 03:00:56 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -179,7 +179,7 @@ static void
179usage(void) 179usage(void)
180{ 180{
181 fprintf(stderr, 181 fprintf(stderr,
182"usage: ssh [-1246AaCfgKkMNnqsTtVvXxY] [-b bind_address] [-c cipher_spec]\n" 182"usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]\n"
183" [-D [bind_address:]port] [-e escape_char] [-F configfile]\n" 183" [-D [bind_address:]port] [-e escape_char] [-F configfile]\n"
184" [-i identity_file] [-L [bind_address:]port:host:hostport]\n" 184" [-i identity_file] [-L [bind_address:]port:host:hostport]\n"
185" [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]\n" 185" [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]\n"
@@ -203,7 +203,7 @@ void muxserver_listen(void);
203int 203int
204main(int ac, char **av) 204main(int ac, char **av)
205{ 205{
206 int i, opt, exit_status; 206 int i, opt, exit_status, use_syslog;
207 char *p, *cp, *line, buf[256]; 207 char *p, *cp, *line, buf[256];
208 struct stat st; 208 struct stat st;
209 struct passwd *pw; 209 struct passwd *pw;
@@ -269,10 +269,11 @@ main(int ac, char **av)
269 269
270 /* Parse command-line arguments. */ 270 /* Parse command-line arguments. */
271 host = NULL; 271 host = NULL;
272 use_syslog = 0;
272 273
273 again: 274 again:
274 while ((opt = getopt(ac, av, "1246ab:c:e:fgi:kl:m:no:p:qstvx" 275 while ((opt = getopt(ac, av, "1246ab:c:e:fgi:kl:m:no:p:qstvx"
275 "ACD:F:I:KL:MNO:PR:S:TVw:XY")) != -1) { 276 "ACD:F:I:KL:MNO:PR:S:TVw:XYy")) != -1) {
276 switch (opt) { 277 switch (opt) {
277 case '1': 278 case '1':
278 options.protocol = SSH_PROTO_1; 279 options.protocol = SSH_PROTO_1;
@@ -299,6 +300,9 @@ main(int ac, char **av)
299 case 'X': 300 case 'X':
300 options.forward_x11 = 1; 301 options.forward_x11 = 1;
301 break; 302 break;
303 case 'y':
304 use_syslog = 1;
305 break;
302 case 'Y': 306 case 'Y':
303 options.forward_x11 = 1; 307 options.forward_x11 = 1;
304 options.forward_x11_trusted = 1; 308 options.forward_x11_trusted = 1;
@@ -444,7 +448,7 @@ main(int ac, char **av)
444 break; 448 break;
445 case 'p': 449 case 'p':
446 options.port = a2port(optarg); 450 options.port = a2port(optarg);
447 if (options.port == 0) { 451 if (options.port <= 0) {
448 fprintf(stderr, "Bad port '%s'\n", optarg); 452 fprintf(stderr, "Bad port '%s'\n", optarg);
449 exit(255); 453 exit(255);
450 } 454 }
@@ -454,7 +458,7 @@ main(int ac, char **av)
454 break; 458 break;
455 459
456 case 'L': 460 case 'L':
457 if (parse_forward(&fwd, optarg)) 461 if (parse_forward(&fwd, optarg, 0, 0))
458 add_local_forward(&options, &fwd); 462 add_local_forward(&options, &fwd);
459 else { 463 else {
460 fprintf(stderr, 464 fprintf(stderr,
@@ -465,7 +469,7 @@ main(int ac, char **av)
465 break; 469 break;
466 470
467 case 'R': 471 case 'R':
468 if (parse_forward(&fwd, optarg)) { 472 if (parse_forward(&fwd, optarg, 0, 1)) {
469 add_remote_forward(&options, &fwd); 473 add_remote_forward(&options, &fwd);
470 } else { 474 } else {
471 fprintf(stderr, 475 fprintf(stderr,
@@ -476,30 +480,14 @@ main(int ac, char **av)
476 break; 480 break;
477 481
478 case 'D': 482 case 'D':
479 cp = p = xstrdup(optarg); 483 if (parse_forward(&fwd, optarg, 1, 0)) {
480 memset(&fwd, '\0', sizeof(fwd)); 484 add_local_forward(&options, &fwd);
481 fwd.connect_host = "socks";
482 if ((fwd.listen_host = hpdelim(&cp)) == NULL) {
483 fprintf(stderr, "Bad dynamic forwarding "
484 "specification '%.100s'\n", optarg);
485 exit(255);
486 }
487 if (cp != NULL) {
488 fwd.listen_port = a2port(cp);
489 fwd.listen_host =
490 cleanhostname(fwd.listen_host);
491 } else { 485 } else {
492 fwd.listen_port = a2port(fwd.listen_host); 486 fprintf(stderr,
493 fwd.listen_host = NULL; 487 "Bad dynamic forwarding specification "
494 } 488 "'%s'\n", optarg);
495
496 if (fwd.listen_port == 0) {
497 fprintf(stderr, "Bad dynamic port '%s'\n",
498 optarg);
499 exit(255); 489 exit(255);
500 } 490 }
501 add_local_forward(&options, &fwd);
502 xfree(p);
503 break; 491 break;
504 492
505 case 'C': 493 case 'C':
@@ -619,7 +607,7 @@ main(int ac, char **av)
619 */ 607 */
620 log_init(av[0], 608 log_init(av[0],
621 options.log_level == -1 ? SYSLOG_LEVEL_INFO : options.log_level, 609 options.log_level == -1 ? SYSLOG_LEVEL_INFO : options.log_level,
622 SYSLOG_FACILITY_USER, 1); 610 SYSLOG_FACILITY_USER, !use_syslog);
623 611
624 /* 612 /*
625 * Read per-user configuration file. Ignore the system wide config 613 * Read per-user configuration file. Ignore the system wide config
@@ -645,7 +633,7 @@ main(int ac, char **av)
645 channel_set_af(options.address_family); 633 channel_set_af(options.address_family);
646 634
647 /* reinit */ 635 /* reinit */
648 log_init(av[0], options.log_level, SYSLOG_FACILITY_USER, 1); 636 log_init(av[0], options.log_level, SYSLOG_FACILITY_USER, !use_syslog);
649 637
650 seed_rng(); 638 seed_rng();
651 639
@@ -854,9 +842,16 @@ ssh_confirm_remote_forward(int type, u_int32_t seq, void *ctxt)
854{ 842{
855 Forward *rfwd = (Forward *)ctxt; 843 Forward *rfwd = (Forward *)ctxt;
856 844
845 /* XXX verbose() on failure? */
857 debug("remote forward %s for: listen %d, connect %s:%d", 846 debug("remote forward %s for: listen %d, connect %s:%d",
858 type == SSH2_MSG_REQUEST_SUCCESS ? "success" : "failure", 847 type == SSH2_MSG_REQUEST_SUCCESS ? "success" : "failure",
859 rfwd->listen_port, rfwd->connect_host, rfwd->connect_port); 848 rfwd->listen_port, rfwd->connect_host, rfwd->connect_port);
849 if (type == SSH2_MSG_REQUEST_SUCCESS && rfwd->listen_port == 0) {
850 logit("Allocated port %u for remote forward to %s:%d",
851 packet_get_int(),
852 rfwd->connect_host, rfwd->connect_port);
853 }
854
860 if (type == SSH2_MSG_REQUEST_FAILURE) { 855 if (type == SSH2_MSG_REQUEST_FAILURE) {
861 if (options.exit_on_forward_failure) 856 if (options.exit_on_forward_failure)
862 fatal("Error: remote port forwarding failed for " 857 fatal("Error: remote port forwarding failed for "