From owner-freebsd-bugs@FreeBSD.ORG Sat Nov 2 05:10:01 2013 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id DBD43BA4 for ; Sat, 2 Nov 2013 05:10:00 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id BBB1E20D6 for ; Sat, 2 Nov 2013 05:10:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id rA25A0TQ070330 for ; Sat, 2 Nov 2013 05:10:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id rA25A0Lk070319; Sat, 2 Nov 2013 05:10:00 GMT (envelope-from gnats) Resent-Date: Sat, 2 Nov 2013 05:10:00 GMT Resent-Message-Id: <201311020510.rA25A0Lk070319@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Michael Gmelin Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 5206DAF1 for ; Sat, 2 Nov 2013 04:59:54 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from oldred.freebsd.org (oldred.freebsd.org [8.8.178.121]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3F2372075 for ; Sat, 2 Nov 2013 04:59:54 +0000 (UTC) Received: from oldred.freebsd.org ([127.0.1.6]) by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id rA24xrEF067482 for ; Sat, 2 Nov 2013 04:59:53 GMT (envelope-from nobody@oldred.freebsd.org) Received: (from nobody@localhost) by oldred.freebsd.org (8.14.5/8.14.5/Submit) id rA24xr63067481; Sat, 2 Nov 2013 04:59:53 GMT (envelope-from nobody) Message-Id: <201311020459.rA24xr63067481@oldred.freebsd.org> Date: Sat, 2 Nov 2013 04:59:53 GMT From: Michael Gmelin To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: kern/183583: [patch] Support SNI in libfetch X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Nov 2013 05:10:01 -0000 >Number: 183583 >Category: kern >Synopsis: [patch] Support SNI in libfetch >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sat Nov 02 05:10:00 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Michael Gmelin >Release: 10.0-BETA2 >Organization: Grem Equity GmbH >Environment: FreeBSD srv15 10.0-BETA2 FreeBSD 10.0-BETA2 #0: Mon Oct 28 20:44:29 UTC 2013 root@:/usr/obj/usr/src/sys/GENERIC amd64 >Description: sbz@freebsd.org created and submitted a patch earlier this year [1] that made libfetch support SNI (server name indication) [2]. It seems like this overlapped with my more complex submission earlier this year and somehow got lost. I made the patch work with the current version of libfetch, should work in 10 as well as in 9. It's extremely trivial and auditing should be a matter of seconds. [1] http://en.wikipedia.org/wiki/Server_Name_Indication [2] http://lists.freebsd.org/pipermail/freebsd-hackers/2013-June/042938.html >How-To-Repeat: Try fetching https://sni.velo.ch before and after the patch, observe the difference. fetch https://sni.velo.ch (see the original patch listed above [2] for a more detailed explanation and procedure). >Fix: Apply the attached patch. cd /usr/src patch ssl, conn->sd); + +#if OPENSSL_VERSION_NUMBER >= 0x0090806fL && !defined(OPENSSL_NO_TLSEXT) + if (!SSL_set_tlsext_host_name(conn->ssl, URL->host)) { + fprintf(stderr, + "TLS server name indication extension failed for host %s\n", + URL->host); + return (-1); + } +#endif while ((ret = SSL_connect(conn->ssl)) == -1) { ssl_err = SSL_get_error(conn->ssl, ret); if (ssl_err != SSL_ERROR_WANT_READ && >Release-Note: >Audit-Trail: >Unformatted: