summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjsing <>2020-02-16 16:39:01 +0000
committerjsing <>2020-02-16 16:39:01 +0000
commit5c10d8250250eed0abef10eabb0e9ae0cf1fe8c8 (patch)
tree9ce95afefe4c444bdd0e8c8928d9b58e9612999c /src
parent5f232a5347aa50b02963840b94a44e39ca4a5d4d (diff)
downloadopenbsd-5c10d8250250eed0abef10eabb0e9ae0cf1fe8c8.tar.gz
openbsd-5c10d8250250eed0abef10eabb0e9ae0cf1fe8c8.tar.bz2
openbsd-5c10d8250250eed0abef10eabb0e9ae0cf1fe8c8.zip
Add -tls1_3 and -notls1_3 options to openssl(1) s_client.
Also stop using version pinned methods, instead setting the min and max protocol versions. Requested by inoguchi@ ok inoguchi@ tb@
Diffstat (limited to 'src')
-rw-r--r--src/usr.bin/openssl/openssl.114
-rw-r--r--src/usr.bin/openssl/s_client.c46
2 files changed, 37 insertions, 23 deletions
diff --git a/src/usr.bin/openssl/openssl.1 b/src/usr.bin/openssl/openssl.1
index 598de60a30..ffdddb7e73 100644
--- a/src/usr.bin/openssl/openssl.1
+++ b/src/usr.bin/openssl/openssl.1
@@ -1,4 +1,4 @@
1.\" $OpenBSD: openssl.1,v 1.118 2019/12/18 12:38:15 sthen Exp $ 1.\" $OpenBSD: openssl.1,v 1.119 2020/02/16 16:39:01 jsing Exp $
2.\" ==================================================================== 2.\" ====================================================================
3.\" Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. 3.\" Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
4.\" 4.\"
@@ -110,7 +110,7 @@
110.\" copied and put under another distribution licence 110.\" copied and put under another distribution licence
111.\" [including the GNU Public Licence.] 111.\" [including the GNU Public Licence.]
112.\" 112.\"
113.Dd $Mdocdate: December 18 2019 $ 113.Dd $Mdocdate: February 16 2020 $
114.Dt OPENSSL 1 114.Dt OPENSSL 1
115.Os 115.Os
116.Sh NAME 116.Sh NAME
@@ -4213,6 +4213,7 @@ Verify the input data and output the recovered data.
4213.Op Fl no_tls1 4213.Op Fl no_tls1
4214.Op Fl no_tls1_1 4214.Op Fl no_tls1_1
4215.Op Fl no_tls1_2 4215.Op Fl no_tls1_2
4216.Op Fl no_tls1_3
4216.Op Fl pass Ar arg 4217.Op Fl pass Ar arg
4217.Op Fl pause 4218.Op Fl pause
4218.Op Fl policy_check 4219.Op Fl policy_check
@@ -4233,6 +4234,7 @@ Verify the input data and output the recovered data.
4233.Op Fl tls1 4234.Op Fl tls1
4234.Op Fl tls1_1 4235.Op Fl tls1_1
4235.Op Fl tls1_2 4236.Op Fl tls1_2
4237.Op Fl tls1_3
4236.Op Fl tlsextdebug 4238.Op Fl tlsextdebug
4237.Op Fl use_srtp Ar profiles 4239.Op Fl use_srtp Ar profiles
4238.Op Fl verify Ar depth 4240.Op Fl verify Ar depth
@@ -4370,8 +4372,8 @@ Can be used to override the implicit
4370.Fl ign_eof 4372.Fl ign_eof
4371after 4373after
4372.Fl quiet . 4374.Fl quiet .
4373.It Fl no_tls1 | no_tls1_1 | no_tls1_2 4375.It Fl no_tls1 | no_tls1_1 | no_tls1_2 | no_tls1_3
4374Disable the use of TLS1.0, 1.1, and 1.2, respectively. 4376Disable the use of TLS1.0, 1.1, 1.2 and 1.3 respectively.
4375.It Fl no_ticket 4377.It Fl no_ticket
4376Disable RFC 4507 session ticket support. 4378Disable RFC 4507 session ticket support.
4377.It Fl pass Ar arg 4379.It Fl pass Ar arg
@@ -4444,8 +4446,8 @@ Send a certificate status request to the server (OCSP stapling).
4444The server response (if any) is printed out. 4446The server response (if any) is printed out.
4445.It Fl timeout 4447.It Fl timeout
4446Enable send/receive timeout on DTLS connections. 4448Enable send/receive timeout on DTLS connections.
4447.It Fl tls1 | tls1_1 | tls1_2 4449.It Fl tls1 | tls1_1 | tls1_2 | tls1_3
4448Permit only TLS1.0, 1.1, or 1.2, respectively. 4450Permit only TLS1.0, 1.1, 1.2 or 1.3 respectively.
4449.It Fl tlsextdebug 4451.It Fl tlsextdebug
4450Print a hex dump of any TLS extensions received from the server. 4452Print a hex dump of any TLS extensions received from the server.
4451.It Fl use_srtp Ar profiles 4453.It Fl use_srtp Ar profiles
diff --git a/src/usr.bin/openssl/s_client.c b/src/usr.bin/openssl/s_client.c
index 1537ebcb26..443f00505e 100644
--- a/src/usr.bin/openssl/s_client.c
+++ b/src/usr.bin/openssl/s_client.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s_client.c,v 1.41 2020/01/23 03:35:54 beck Exp $ */ 1/* $OpenBSD: s_client.c,v 1.42 2020/02/16 16:39:01 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -222,12 +222,13 @@ sc_usage(void)
222 BIO_printf(bio_err, " -quiet - no s_client output\n"); 222 BIO_printf(bio_err, " -quiet - no s_client output\n");
223 BIO_printf(bio_err, " -ign_eof - ignore input eof (default when -quiet)\n"); 223 BIO_printf(bio_err, " -ign_eof - ignore input eof (default when -quiet)\n");
224 BIO_printf(bio_err, " -no_ign_eof - don't ignore input eof\n"); 224 BIO_printf(bio_err, " -no_ign_eof - don't ignore input eof\n");
225 BIO_printf(bio_err, " -tls1_3 - just use TLSv1.3\n");
225 BIO_printf(bio_err, " -tls1_2 - just use TLSv1.2\n"); 226 BIO_printf(bio_err, " -tls1_2 - just use TLSv1.2\n");
226 BIO_printf(bio_err, " -tls1_1 - just use TLSv1.1\n"); 227 BIO_printf(bio_err, " -tls1_1 - just use TLSv1.1\n");
227 BIO_printf(bio_err, " -tls1 - just use TLSv1\n"); 228 BIO_printf(bio_err, " -tls1 - just use TLSv1\n");
228 BIO_printf(bio_err, " -dtls1 - just use DTLSv1\n"); 229 BIO_printf(bio_err, " -dtls1 - just use DTLSv1\n");
229 BIO_printf(bio_err, " -mtu - set the link layer MTU\n"); 230 BIO_printf(bio_err, " -mtu - set the link layer MTU\n");
230 BIO_printf(bio_err, " -no_tls1_2/-no_tls1_1/-no_tls1/-no_ssl3/-no_ssl2 - turn off that protocol\n"); 231 BIO_printf(bio_err, " -no_tls1_3/-no_tls1_2/-no_tls1_1/-no_tls1 - turn off that protocol\n");
231 BIO_printf(bio_err, " -bugs - Switch on all SSL implementation bug workarounds\n"); 232 BIO_printf(bio_err, " -bugs - Switch on all SSL implementation bug workarounds\n");
232 BIO_printf(bio_err, " -cipher - preferred cipher to use, use the 'openssl ciphers'\n"); 233 BIO_printf(bio_err, " -cipher - preferred cipher to use, use the 'openssl ciphers'\n");
233 BIO_printf(bio_err, " command to see what is available\n"); 234 BIO_printf(bio_err, " command to see what is available\n");
@@ -334,6 +335,7 @@ s_client_main(int argc, char **argv)
334 int peerlen = sizeof(peer); 335 int peerlen = sizeof(peer);
335 int enable_timeouts = 0; 336 int enable_timeouts = 0;
336 long socket_mtu = 0; 337 long socket_mtu = 0;
338 uint16_t min_version = 0, max_version = 0;
337 339
338 if (single_execution) { 340 if (single_execution) {
339 if (pledge("stdio cpath wpath rpath inet dns tty", NULL) == -1) { 341 if (pledge("stdio cpath wpath rpath inet dns tty", NULL) == -1) {
@@ -342,7 +344,7 @@ s_client_main(int argc, char **argv)
342 } 344 }
343 } 345 }
344 346
345 meth = SSLv23_client_method(); 347 meth = TLS_client_method();
346 348
347 c_Pause = 0; 349 c_Pause = 0;
348 c_quiet = 0; 350 c_quiet = 0;
@@ -445,15 +447,21 @@ s_client_main(int argc, char **argv)
445 nbio_test = 1; 447 nbio_test = 1;
446 else if (strcmp(*argv, "-state") == 0) 448 else if (strcmp(*argv, "-state") == 0)
447 state = 1; 449 state = 1;
448 else if (strcmp(*argv, "-tls1_2") == 0) 450 else if (strcmp(*argv, "-tls1_3") == 0) {
449 meth = TLSv1_2_client_method(); 451 min_version = TLS1_3_VERSION;
450 else if (strcmp(*argv, "-tls1_1") == 0) 452 max_version = TLS1_3_VERSION;
451 meth = TLSv1_1_client_method(); 453 } else if (strcmp(*argv, "-tls1_2") == 0) {
452 else if (strcmp(*argv, "-tls1") == 0) 454 min_version = TLS1_2_VERSION;
453 meth = TLSv1_client_method(); 455 max_version = TLS1_2_VERSION;
456 } else if (strcmp(*argv, "-tls1_1") == 0) {
457 min_version = TLS1_1_VERSION;
458 max_version = TLS1_1_VERSION;
459 } else if (strcmp(*argv, "-tls1") == 0) {
460 min_version = TLS1_VERSION;
461 max_version = TLS1_VERSION;
454#ifndef OPENSSL_NO_DTLS1 462#ifndef OPENSSL_NO_DTLS1
455 else if (strcmp(*argv, "-dtls1") == 0) { 463 } else if (strcmp(*argv, "-dtls1") == 0) {
456 meth = DTLSv1_client_method(); 464 meth = DTLS_client_method();
457 socket_type = SOCK_DGRAM; 465 socket_type = SOCK_DGRAM;
458 } else if (strcmp(*argv, "-timeout") == 0) 466 } else if (strcmp(*argv, "-timeout") == 0)
459 enable_timeouts = 1; 467 enable_timeouts = 1;
@@ -489,7 +497,9 @@ s_client_main(int argc, char **argv)
489 if (--argc < 1) 497 if (--argc < 1)
490 goto bad; 498 goto bad;
491 CAfile = *(++argv); 499 CAfile = *(++argv);
492 } else if (strcmp(*argv, "-no_tls1_2") == 0) 500 } else if (strcmp(*argv, "-no_tls1_3") == 0)
501 off |= SSL_OP_NO_TLSv1_3;
502 else if (strcmp(*argv, "-no_tls1_2") == 0)
493 off |= SSL_OP_NO_TLSv1_2; 503 off |= SSL_OP_NO_TLSv1_2;
494 else if (strcmp(*argv, "-no_tls1_1") == 0) 504 else if (strcmp(*argv, "-no_tls1_1") == 0)
495 off |= SSL_OP_NO_TLSv1_1; 505 off |= SSL_OP_NO_TLSv1_1;
@@ -550,17 +560,14 @@ s_client_main(int argc, char **argv)
550 starttls_proto = PROTO_XMPP; 560 starttls_proto = PROTO_XMPP;
551 else 561 else
552 goto bad; 562 goto bad;
553 } 563 } else if (strcmp(*argv, "-4") == 0) {
554 else if (strcmp(*argv, "-4") == 0) {
555 af = AF_INET; 564 af = AF_INET;
556 } else if (strcmp(*argv, "-6") == 0) { 565 } else if (strcmp(*argv, "-6") == 0) {
557 af = AF_INET6; 566 af = AF_INET6;
558 } 567 } else if (strcmp(*argv, "-servername") == 0) {
559 else if (strcmp(*argv, "-servername") == 0) {
560 if (--argc < 1) 568 if (--argc < 1)
561 goto bad; 569 goto bad;
562 servername = *(++argv); 570 servername = *(++argv);
563 /* meth=TLSv1_client_method(); */
564 } 571 }
565#ifndef OPENSSL_NO_SRTP 572#ifndef OPENSSL_NO_SRTP
566 else if (strcmp(*argv, "-use_srtp") == 0) { 573 else if (strcmp(*argv, "-use_srtp") == 0) {
@@ -649,6 +656,11 @@ s_client_main(int argc, char **argv)
649 if (vpm) 656 if (vpm)
650 SSL_CTX_set1_param(ctx, vpm); 657 SSL_CTX_set1_param(ctx, vpm);
651 658
659 if (!SSL_CTX_set_min_proto_version(ctx, min_version))
660 goto end;
661 if (!SSL_CTX_set_max_proto_version(ctx, max_version))
662 goto end;
663
652#ifndef OPENSSL_NO_SRTP 664#ifndef OPENSSL_NO_SRTP
653 if (srtp_profiles != NULL) 665 if (srtp_profiles != NULL)
654 SSL_CTX_set_tlsext_use_srtp(ctx, srtp_profiles); 666 SSL_CTX_set_tlsext_use_srtp(ctx, srtp_profiles);