From patchwork Wed Feb 12 23:45:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 993 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director7.mail.ord1d.rsapps.net ([172.27.255.55]) by backend30.mail.ord1d.rsapps.net with LMTP id INhHGn8vRV6gawAAIUCqbw for ; Thu, 13 Feb 2020 06:14:07 -0500 Received: from proxy2.mail.iad3a.rsapps.net ([172.27.255.55]) by director7.mail.ord1d.rsapps.net with LMTP id cBWaF38vRV4FdQAAovjBpQ ; Thu, 13 Feb 2020 06:14:07 -0500 Received: from smtp36.gate.iad3a ([172.27.255.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy2.mail.iad3a.rsapps.net with LMTP id mCcvEX8vRV5LCAAABcWvHw ; Thu, 13 Feb 2020 06:14:07 -0500 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.iad3a.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: f2ca0408-4e51-11ea-9418-525400575b2b-1-1 Received: from [216.105.38.7] ([216.105.38.7:35550] helo=lists.sourceforge.net) by smtp36.gate.iad3a.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 83/B9-09713-E7F254E5; Thu, 13 Feb 2020 06:14:06 -0500 Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1j2CQX-000378-PZ; Thu, 13 Feb 2020 11:13:01 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1j2CQW-00036s-Fi for openvpn-devel@lists.sourceforge.net; Thu, 13 Feb 2020 11:13:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=References:In-Reply-To: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:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=bJSh6iYsx0Hu36CjU4qPEhovHaBoY+i+jPeHvvUx8wk=; b=c5WabUnFhQZlKb9PIo79eKSHlD 1zN6JNNqtGioKxPuX9yu156pX5O1GhGx5Lj1CbaU8/gZ9/1VV6oNj9XbAqGAUqxIQU+2B+4aBg0YS 3oXBpLR00fnjEDBvOLscKdEc50PcSeketXwIJ/HL+YZ+/Ljn8NKDine0sOduP96HhiF4=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=References:In-Reply-To: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:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=bJSh6iYsx0Hu36CjU4qPEhovHaBoY+i+jPeHvvUx8wk=; b=SUryacImjS2j45ISJ2dAaCom/k IeGVetLL8fQdxTj2i23PVwHFmZ6NLDbyxvCa3QQEQ1rnJX3TY1BTk5vGkKX3+lgXslgWAZB5S7GdZ wbLr6MqsTLJqcQITFBT9UzKI48m7gyHB+Nhls0vUJsIEKjHj/JE5NJDpM0rUl6/cmW3s=; Received: from mail.blinkt.de ([192.26.174.232]) by sfi-mx-3.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2) id 1j2CQS-0031mJ-Gt for openvpn-devel@lists.sourceforge.net; Thu, 13 Feb 2020 11:13:00 +0000 Received: from kamera.blinkt.de ([2001:638:502:390:20c:29ff:fec8:535c]) by mail.blinkt.de with smtp (Exim 4.92.3 (FreeBSD)) (envelope-from ) id 1j2C0F-00012O-Tp for openvpn-devel@lists.sourceforge.net; Thu, 13 Feb 2020 11:45:51 +0100 Received: (nullmailer pid 25210 invoked by uid 10006); Thu, 13 Feb 2020 10:45:51 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Thu, 13 Feb 2020 11:45:51 +0100 Message-Id: <20200213104551.25165-1-arne@rfc2549.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <38693ff6-f6d2-33a3-889c-96ee85ddb86c@karger.me> References: <38693ff6-f6d2-33a3-889c-96ee85ddb86c@karger.me> X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: rfc2549.org] 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 X-Headers-End: 1j2CQS-0031mJ-Gt Subject: [Openvpn-devel] [PATCH v2 1/4] 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. Patch V2: Remove unecessary restoring of ncp_ciphers Signed-off-by: Arne Schwabe --- doc/openvpn.8 | 2 ++ src/openvpn/init.c | 3 +++ src/openvpn/openvpn.h | 1 + src/openvpn/ssl.c | 4 +++- src/openvpn/ssl_common.h | 1 + 5 files changed, 10 insertions(+), 1 deletion(-) diff --git a/doc/openvpn.8 b/doc/openvpn.8 index 8feb3b9c..b8f2f042 100644 --- a/doc/openvpn.8 +++ b/doc/openvpn.8 @@ -4398,6 +4398,8 @@ NCP server (v2.4+) with "\-\-cipher BF\-CBC" and "\-\-ncp\-ciphers AES\-256\-GCM:AES\-256\-CBC" set can either specify "\-\-cipher BF\-CBC" or "\-\-cipher AES\-256\-CBC" and both will work. +Note, for using NCP with a OpenVPN 2.4 server this list must include +the AES\-256\-GCM and AES\-128\-GCM ciphers. .\"********************************************************* .TP .B \-\-ncp\-disable diff --git a/src/openvpn/init.c b/src/openvpn/init.c index 04207b61..d83b42b0 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -623,6 +623,7 @@ save_ncp_options(struct context *c) c->c1.ciphername = c->options.ciphername; c->c1.authname = c->options.authname; c->c1.keysize = c->options.keysize; + c->c1.ncp_ciphers = c->options.ncp_ciphers; } /* Restores NCP-negotiable options to original values */ @@ -2827,6 +2828,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; @@ -4532,6 +4534,7 @@ inherit_context_child(struct context *dest, dest->c1.ciphername = src->c1.ciphername; dest->c1.authname = src->c1.authname; dest->c1.keysize = src->c1.keysize; + dest->c1.ncp_ciphers = src->c1.ncp_ciphers; /* inherit auth-token */ dest->c1.ks.auth_token_key = src->c1.ks.auth_token_key; diff --git a/src/openvpn/openvpn.h b/src/openvpn/openvpn.h index 900db7e1..9e46ad6c 100644 --- a/src/openvpn/openvpn.h +++ b/src/openvpn/openvpn.h @@ -209,6 +209,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/ssl.c b/src/openvpn/ssl.c index e708fc93..b8351737 100644 --- a/src/openvpn/ssl.c +++ b/src/openvpn/ssl.c @@ -2322,7 +2322,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 8dd08862..fb82f610 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;