From patchwork Mon Sep 23 03:32:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 834 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director8.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net with LMTP id eBnWJNrJiF3KEQAAIUCqbw for ; Mon, 23 Sep 2019 09:34:18 -0400 Received: from proxy1.mail.ord1d.rsapps.net ([172.30.191.6]) by director8.mail.ord1d.rsapps.net with LMTP id gN+ZJNrJiF3cJQAAfY0hYg ; Mon, 23 Sep 2019 09:34:18 -0400 Received: from smtp36.gate.ord1c ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy1.mail.ord1d.rsapps.net with LMTP id EA+pI9rJiF2GagAAasrz9Q ; Mon, 23 Sep 2019 09:34:18 -0400 X-Spam-Threshold: 95 X-Spam-Score: 0 X-Spam-Flag: NO X-Virus-Scanned: OK X-Orig-To: openvpnslackdevel@openvpn.net X-Originating-Ip: [216.105.38.7] Authentication-Results: smtp36.gate.ord1c.rsapps.net; iprev=pass policy.iprev="216.105.38.7"; spf=pass smtp.mailfrom="openvpn-devel-bounces@lists.sourceforge.net" smtp.helo="lists.sourceforge.net"; dkim=fail (signature verification failed) header.d=sourceforge.net; dkim=fail (signature verification failed) header.d=sf.net; dmarc=none (p=nil; dis=none) header.from=rfc2549.org X-Suspicious-Flag: YES X-Classification-ID: d681f3a2-de06-11e9-ae54-5452006630bd-1-1 Received: from [216.105.38.7] ([216.105.38.7:50136] helo=lists.sourceforge.net) by smtp36.gate.ord1c.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 75/33-27004-8D9C88D5; Mon, 23 Sep 2019 09:34:16 -0400 Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1iCOSE-0001oy-Mu; Mon, 23 Sep 2019 13:32:38 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1iCOSD-0001or-TY for openvpn-devel@lists.sourceforge.net; Mon, 23 Sep 2019 13:32:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=lTzaE38HDtsWwQrbt9eaExR7fQgi8bKapiaFbtUILcU=; b=gdxn3haCIx3BeakLD9XzR4i9a6 f0q9WnicdwHEx6S0WIbuV39TtHzMXMTGpgmm4JU8kJUeVjKwh6KCfFyH0gkwoQ9sMbRi8nKU2bHT9 VnryhKTpXW4qHxeEEjR1wqGOnZqqRibNsmzr3J3Mnqk2tWDVcvXhr/D6Ps1doG+GJx74=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc:MIME-Version: Content-Type:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=lTzaE38HDtsWwQrbt9eaExR7fQgi8bKapiaFbtUILcU=; b=dIqiLgku+MHNlpK+aDUY3rsLYJ HYOHPBdzMnijJ6DwMrmGnLn6nRhZGEY5pEQGquE0TYdXLCgToSOgApbzvrVZ3GTMnOwCx2+ngwIEJ 8KdoyjRfyKX086ElCc2dNo9aZNUTfr+s1c2miTjhto3QqbcQlV3t6DYClk+6jJDaInQo=; Received: from mail.blinkt.de ([192.26.174.232]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2) id 1iCOSC-005OyK-2I for openvpn-devel@lists.sourceforge.net; Mon, 23 Sep 2019 13:32:37 +0000 Received: from kamera.blinkt.de ([2001:638:502:390:20c:29ff:fec8:535c]) by mail.blinkt.de with smtp (Exim 4.92.2 (FreeBSD)) (envelope-from ) id 1iCOS1-0003ZZ-2L for openvpn-devel@lists.sourceforge.net; Mon, 23 Sep 2019 15:32:25 +0200 Received: (nullmailer pid 13944 invoked by uid 10006); Mon, 23 Sep 2019 13:32:24 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Mon, 23 Sep 2019 15:32:24 +0200 Message-Id: <20190923133224.13899-1-arne@rfc2549.org> X-Mailer: git-send-email 2.17.1 X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.2 AWL AWL: Adjusted score from AWL reputation of From: address X-Headers-End: 1iCOSC-005OyK-2I Subject: [Openvpn-devel] [PATCH] Only announce IV_NCP=2 when we are willing to support these ciphers X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox We currently always announce IV_NCP=2 when we support these ciphers even when we do not accept them. This lead to a server pushing a AES-GCM-128 cipher to clients and the client then rejecting it. --- src/openvpn/init.c | 1 + src/openvpn/openvpn.h | 1 + src/openvpn/options.c | 7 +++++++ src/openvpn/ssl.c | 4 +++- src/openvpn/ssl_common.h | 1 + 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/openvpn/init.c b/src/openvpn/init.c index b5a034dc..32f7bc7a 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -2795,6 +2795,7 @@ do_init_crypto_tls(struct context *c, const unsigned int flags) to.tcp_mode = link_socket_proto_connection_oriented(options->ce.proto); to.config_ciphername = c->c1.ciphername; to.config_authname = c->c1.authname; + to.config_ncp_ciphers = c->c1.ncp_ciphers; to.ncp_enabled = options->ncp_enabled; to.transition_window = options->transition_window; to.handshake_window = options->handshake_window; diff --git a/src/openvpn/openvpn.h b/src/openvpn/openvpn.h index 29d21f0a..1fdbfe3c 100644 --- a/src/openvpn/openvpn.h +++ b/src/openvpn/openvpn.h @@ -208,6 +208,7 @@ struct context_1 const char *ciphername; /**< Data channel cipher from config file */ const char *authname; /**< Data channel auth from config file */ + const char *ncp_ciphers; /**< NCP Ciphers */ int keysize; /**< Data channel keysize from config file */ #endif }; diff --git a/src/openvpn/options.c b/src/openvpn/options.c index c84b9d5e..cb25db5b 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -7687,6 +7687,13 @@ add_option(struct options *options, { VERIFY_PERMISSION(OPT_P_GENERAL|OPT_P_INSTANCE); options->ncp_ciphers = p[1]; + + if (!(tls_item_in_cipher_list("AES-128-GCM", options->ncp_ciphers) + && tls_item_in_cipher_list("AES-256-GCM", options->ncp_ciphers))) + { + msg(M_INFO, "Not including AES-128-GCM and AES-256-GCM in ncp-ciphers " + "disables announcing NCP support with IV_NCP=2"); + } } else if (streq(p[0], "ncp-disable") && !p[1]) { diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c index d5833ac6..f1719303 100644 --- a/src/openvpn/ssl.c +++ b/src/openvpn/ssl.c @@ -2327,7 +2327,9 @@ push_peer_info(struct buffer *buf, struct tls_session *session) /* support for Negotiable Crypto Parameters */ if (session->opt->ncp_enabled - && (session->opt->mode == MODE_SERVER || session->opt->pull)) + && (session->opt->mode == MODE_SERVER || session->opt->pull) + && tls_item_in_cipher_list("AES-128-GCM", session->opt->config_ncp_ciphers) + && tls_item_in_cipher_list("AES-256-GCM", session->opt->config_ncp_ciphers)) { buf_printf(&out, "IV_NCP=2\n"); } diff --git a/src/openvpn/ssl_common.h b/src/openvpn/ssl_common.h index 0312c1f8..133c3c22 100644 --- a/src/openvpn/ssl_common.h +++ b/src/openvpn/ssl_common.h @@ -290,6 +290,7 @@ struct tls_options const char *config_ciphername; const char *config_authname; + const char *config_ncp_ciphers; bool ncp_enabled; bool tls_crypt_v2;