| Message ID | 20200707121615.15736-4-arne@rfc2549.org |
|---|---|
| State | Rejected |
| Headers |
Return-Path: <openvpn-devel-bounces@lists.sourceforge.net> Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director12.mail.ord1d.rsapps.net ([172.27.255.55]) by backend30.mail.ord1d.rsapps.net with LMTP id WBS1JNBnBF+OIgAAIUCqbw for <patchwork@openvpn.net>; Tue, 07 Jul 2020 08:17:20 -0400 Received: from proxy19.mail.iad3a.rsapps.net ([172.27.255.55]) by director12.mail.ord1d.rsapps.net with LMTP id kERyItBnBF/BJAAAIasKDg ; Tue, 07 Jul 2020 08:17:20 -0400 Received: from smtp51.gate.iad3a ([172.27.255.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy19.mail.iad3a.rsapps.net with LMTP id oOTqHNBnBF8jFAAAXy6Yeg ; Tue, 07 Jul 2020 08:17:20 -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: smtp51.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: cd169fd4-c04b-11ea-902d-525400aaff7b-1-1 Received: from [216.105.38.7] ([216.105.38.7:57674] helo=lists.sourceforge.net) by smtp51.gate.iad3a.rsapps.net (envelope-from <openvpn-devel-bounces@lists.sourceforge.net>) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 4D/42-05432-EC7640F5; Tue, 07 Jul 2020 08:17:19 -0400 Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from <openvpn-devel-bounces@lists.sourceforge.net>) id 1jsmWX-0005fX-2j; Tue, 07 Jul 2020 12:16:33 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from <arne@kamera.blinkt.de>) id 1jsmWV-0005fK-SX for openvpn-devel@lists.sourceforge.net; Tue, 07 Jul 2020 12:16:31 +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=Gbx3vKIJE0W6JFmpLxdZMVQoTUbskAus6IkodUtPCOo=; b=nGJxZG8WTMmuJ11y1+gXlynx4E nw1kDT9iadCLfWujXRmX8hQ+RkyrV9QpWzz2va8Yyqb5hoCvEWehNJxSh55dj/Yytgy6CTG7THwKu 0aUs6QFgeO+47ZRlvR0MEkEdcFD7OsigrcV3T8hmiBKpTTYYPuftKeec059q1fNhGAmw=; 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=Gbx3vKIJE0W6JFmpLxdZMVQoTUbskAus6IkodUtPCOo=; b=V0a8d94puM4TfTHQ5DO9Te7WIR xSOJjgT+xfNqPVMqCi6H2yOQaS6zvu/9eBtMraM3aRVp5ADeWaPA48iGaVsetEqMEZSRfIWbFp9Dw cQo4rbmFzRXUp60NFa5kFmLvDXJMTMi++CS/DjRS0Ktigccc7PcQ0p5HT5euKUjoaRbc=; 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 1jsmWU-00G8Ch-Nq for openvpn-devel@lists.sourceforge.net; Tue, 07 Jul 2020 12:16:31 +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 <arne@kamera.blinkt.de>) id 1jsmWG-000O24-5h for openvpn-devel@lists.sourceforge.net; Tue, 07 Jul 2020 14:16:16 +0200 Received: (nullmailer pid 15791 invoked by uid 10006); Tue, 07 Jul 2020 12:16:16 -0000 From: Arne Schwabe <arne@rfc2549.org> To: openvpn-devel@lists.sourceforge.net Date: Tue, 7 Jul 2020 14:16:14 +0200 Message-Id: <20200707121615.15736-4-arne@rfc2549.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200707121615.15736-1-arne@rfc2549.org> References: <20200707121615.15736-1-arne@rfc2549.org> 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: 1jsmWU-00G8Ch-Nq Subject: [Openvpn-devel] [PATCH 2/3] Cleanup: Remove unused code of old poor man's NCP. X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: <openvpn-devel.lists.sourceforge.net> List-Unsubscribe: <https://lists.sourceforge.net/lists/options/openvpn-devel>, <mailto:openvpn-devel-request@lists.sourceforge.net?subject=unsubscribe> List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum_name=openvpn-devel> List-Post: <mailto:openvpn-devel@lists.sourceforge.net> List-Help: <mailto:openvpn-devel-request@lists.sourceforge.net?subject=help> List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/openvpn-devel>, <mailto:openvpn-devel-request@lists.sourceforge.net?subject=subscribe> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox |
| Series |
[Openvpn-devel] Add file to ignore reformatting changes
|
|
Commit Message
Arne Schwabe
July 7, 2020, 2:16 a.m. UTC
Ever since the NCPv2 the ncp_get_best_cipher uses the global
options->ncp_enabled option and ignore the tls_session->ncp_enabled
option.
The server side's poor man's NCP is implemented as seeing the list
of supported ciphers from the peer as just one cipher so this special
handling for poor man's NCP of the older NCP here is not needed anymore.
Theoretically we can now get rid of tls_session->ncp_enabled but doing
so requires more refactoring since options is not available in the
methods that still use it. And when we remove ncp-disable the variable
will be removed anyway.
Also document the remaining usage of tls_poor_mans_ncp better.
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
---
src/openvpn/init.c | 2 ++
src/openvpn/ssl.c | 15 +--------------
2 files changed, 3 insertions(+), 14 deletions(-)
Comments
Hi, As discusses in #openvpn-devel on IRC, this patch breaks interop with clients that don't pull, but that will be restored in a follow-up refactoring (before 2.5 rc1). I can live with that, but I think this should be mentioned in the commit message. On 07-07-2020 14:16, Arne Schwabe wrote: > Ever since the NCPv2 the ncp_get_best_cipher uses the global > options->ncp_enabled option and ignore the tls_session->ncp_enabled > option. > > The server side's poor man's NCP is implemented as seeing the list > of supported ciphers from the peer as just one cipher so this special > handling for poor man's NCP of the older NCP here is not needed anymore. > > Theoretically we can now get rid of tls_session->ncp_enabled but doing > so requires more refactoring since options is not available in the > methods that still use it. And when we remove ncp-disable the variable > will be removed anyway. > > Also document the remaining usage of tls_poor_mans_ncp better. > > Signed-off-by: Arne Schwabe <arne@rfc2549.org> > --- > src/openvpn/init.c | 2 ++ > src/openvpn/ssl.c | 15 +-------------- > 2 files changed, 3 insertions(+), 14 deletions(-) > > diff --git a/src/openvpn/init.c b/src/openvpn/init.c > index 91b919d5..e9c01629 100644 > --- a/src/openvpn/init.c > +++ b/src/openvpn/init.c > @@ -2376,6 +2376,8 @@ do_deferred_options(struct context *c, const unsigned int found) > } > else if (c->options.ncp_enabled) > { > + /* If the server did not push a --cipher, we will switch to the > + * remote cipher if it is in our ncp-ciphers list */ > tls_poor_mans_ncp(&c->options, c->c2.tls_multi->remote_ciphername); > } > struct frame *frame_fragment = NULL; > diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c > index 9df7552d..71565dd3 100644 > --- a/src/openvpn/ssl.c > +++ b/src/openvpn/ssl.c > @@ -2463,8 +2463,7 @@ key_method_2_write(struct buffer *buf, struct tls_session *session) > * generation is postponed until after the pull/push, so we can process pushed > * cipher directives. > */ > - if (session->opt->server && !(session->opt->ncp_enabled > - && session->opt->mode == MODE_SERVER && ks->key_id <= 0)) > + if (session->opt->server && !(session->opt->mode == MODE_SERVER && ks->key_id <= 0)) > { > if (ks->authenticated != KS_AUTH_FALSE) > { > @@ -2616,18 +2615,6 @@ key_method_2_read(struct buffer *buf, struct tls_multi *multi, struct tls_sessio > multi->remote_ciphername = > options_string_extract_option(options, "cipher", NULL); > > - if (!tls_peer_supports_ncp(multi->peer_info)) > - { > - /* Peer does not support NCP, but leave NCP enabled if the local and > - * remote cipher do not match to attempt 'poor-man's NCP'. > - */ > - if (multi->remote_ciphername == NULL > - || 0 == strcmp(multi->remote_ciphername, multi->opt.config_ciphername)) > - { > - session->opt->ncp_enabled = false; > - } > - } > - This removes the last user of tls_peer_supports_ncp(), should that be removed too? Other than this I think this looks good and moves in the right direction. I haven't tested this thoroughly. Since much of the logic will be changing soon anyway, I think it's okay to move forward nevertheless. But we do need some aggressive testing when all the changes are in. -Steffan
Hi, On Tue, Jul 07, 2020 at 02:16:14PM +0200, Arne Schwabe wrote: > Ever since the NCPv2 the ncp_get_best_cipher uses the global > options->ncp_enabled option and ignore the tls_session->ncp_enabled > option. For the record, this breaks "poor man's NCP" for big packets - tested with 2.3 client and 2.4 with "--ncp-disable". Session is negotiated fine, key material is generated perfectly fine, both sides agree on ciphers, but if I do the "ping 3000 byte test" I get this on the server: 13:00 <@cron2> Jul 8 12:59:19 gentoo tun-udp-p2mp[30281]: cron2-freebsd-tc-amd64-23/2001:608:0:814::f000:21 TCP/UDP packet too large on write to [AF_INET6]2001:608:0:814::f000:21:35389 (tried=1544,max=1542) so it seems to get confused about frame size values. No --mtu-disc involved, no --anything-mtu configured on the server (= all on defaults). I do remember that this is scary stuff all intertwined... gert
Am 08.07.20 um 13:15 schrieb Gert Doering: > Hi, > > On Tue, Jul 07, 2020 at 02:16:14PM +0200, Arne Schwabe wrote: >> Ever since the NCPv2 the ncp_get_best_cipher uses the global >> options->ncp_enabled option and ignore the tls_session->ncp_enabled >> option. > > For the record, this breaks "poor man's NCP" for big packets - tested > with 2.3 client and 2.4 with "--ncp-disable". Session is negotiated > fine, key material is generated perfectly fine, both sides agree on > ciphers, but if I do the "ping 3000 byte test" I get this on the > server: > > 13:00 <@cron2> Jul 8 12:59:19 gentoo tun-udp-p2mp[30281]: cron2-freebsd-tc-amd64-23/2001:608:0:814::f000:21 TCP/UDP packet too large on write to [AF_INET6]2001:608:0:814::f000:21:35389 (tried=1544,max=1542) > > so it seems to get confused about frame size values. > > No --mtu-disc involved, no --anything-mtu configured on the server (= all > on defaults). > > I do remember that this is scary stuff all intertwined... Looks like our frame calculation for NCP is somewhat broken and this change just exposed this bug better. This "fix" might work: --- a/src/openvpn/ssl.c +++ b/src/openvpn/ssl.c @@ -1986,6 +1986,12 @@ tls_session_update_crypto_params(struct tls_session *session, options->keysize = 0; } } + else + { + /* Very hacky workaround and quick fix for our calculation + * not correct to avoid a regression */ + return tls_session_generate_data_channel_keys(session); + } init_key_type(&session->opt->key_type, options->ciphername, options->authname, options->keysize, true, true);
Am 08.07.20 um 12:10 schrieb Steffan Karger: > Hi, > > As discusses in #openvpn-devel on IRC, this patch breaks interop with > clients that don't pull, but that will be restored in a follow-up > refactoring (before 2.5 rc1). I can live with that, but I think this > should be mentioned in the commit message. I can fix that by reordering the commits but I will that this moves generation of keys for this corner case. Arne
Hi, On Wed, Jul 08, 2020 at 03:15:49PM +0200, Arne Schwabe wrote: > +++ b/src/openvpn/ssl.c > @@ -1986,6 +1986,12 @@ tls_session_update_crypto_params(struct > tls_session *session, > options->keysize = 0; > } > } > + else > + { > + /* Very hacky workaround and quick fix for our calculation > + * not correct to avoid a regression */ > + return tls_session_generate_data_channel_keys(session); > + } Just for the record: that nasty hack made the server happy again. start client jobs... 23... Test sets succeeded: 1 1a 1b 1d 2 2a 2b 2c 2d 3 4 5 6 8 8a 9. Test sets failed: none. 24... Test sets succeeded: 1 1a 1b 1c 1d 1e 2 2a 2b 2c 2d 2e 3 4 4a 5 6 8 8a 9. Test sets failed: none. master... Test sets succeeded: 1 1a 1b 1c 1d 1e 2 2a 2b 2c 2d 2e 3 4 5 6 7 7a 8 8a 9 2f 4b. Test sets failed: none. So we decided to go "with the hack for now" and clean up the mine field arounding frame size stuff afterwards. Patch set incoming tomorrow. gert
diff --git a/src/openvpn/init.c b/src/openvpn/init.c index 91b919d5..e9c01629 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -2376,6 +2376,8 @@ do_deferred_options(struct context *c, const unsigned int found) } else if (c->options.ncp_enabled) { + /* If the server did not push a --cipher, we will switch to the + * remote cipher if it is in our ncp-ciphers list */ tls_poor_mans_ncp(&c->options, c->c2.tls_multi->remote_ciphername); } struct frame *frame_fragment = NULL; diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c index 9df7552d..71565dd3 100644 --- a/src/openvpn/ssl.c +++ b/src/openvpn/ssl.c @@ -2463,8 +2463,7 @@ key_method_2_write(struct buffer *buf, struct tls_session *session) * generation is postponed until after the pull/push, so we can process pushed * cipher directives. */ - if (session->opt->server && !(session->opt->ncp_enabled - && session->opt->mode == MODE_SERVER && ks->key_id <= 0)) + if (session->opt->server && !(session->opt->mode == MODE_SERVER && ks->key_id <= 0)) { if (ks->authenticated != KS_AUTH_FALSE) { @@ -2616,18 +2615,6 @@ key_method_2_read(struct buffer *buf, struct tls_multi *multi, struct tls_sessio multi->remote_ciphername = options_string_extract_option(options, "cipher", NULL); - if (!tls_peer_supports_ncp(multi->peer_info)) - { - /* Peer does not support NCP, but leave NCP enabled if the local and - * remote cipher do not match to attempt 'poor-man's NCP'. - */ - if (multi->remote_ciphername == NULL - || 0 == strcmp(multi->remote_ciphername, multi->opt.config_ciphername)) - { - session->opt->ncp_enabled = false; - } - } - if (tls_session_user_pass_enabled(session)) { /* Perform username/password authentication */