[Openvpn-devel,v5,01/14] Allow changing fallback cipher from ccd files/client-connect
| Message ID | 20200711093655.23686-1-arne@rfc2549.org |
|---|---|
| State | Accepted |
| Headers |
Return-Path: <openvpn-devel-bounces@lists.sourceforge.net> Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director9.mail.ord1d.rsapps.net ([172.27.255.9]) by backend30.mail.ord1d.rsapps.net with LMTP id qAzTNnqICV+iPQAAIUCqbw for <patchwork@openvpn.net>; Sat, 11 Jul 2020 05:38:02 -0400 Received: from proxy6.mail.iad3a.rsapps.net ([172.27.255.9]) by director9.mail.ord1d.rsapps.net with LMTP id sBoaNHqICV98YwAAalYnBA ; Sat, 11 Jul 2020 05:38:02 -0400 Received: from smtp11.gate.iad3a ([172.27.255.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy6.mail.iad3a.rsapps.net with LMTP id kDtqLnqICV+3FgAA8udqhg ; Sat, 11 Jul 2020 05:38:02 -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: smtp11.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: 36724d8c-c35a-11ea-a799-5254005eb44a-1-1 Received: from [216.105.38.7] ([216.105.38.7:48994] helo=lists.sourceforge.net) by smtp11.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 A0/9F-14390-A78890F5; Sat, 11 Jul 2020 05:38:02 -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 <openvpn-devel-bounces@lists.sourceforge.net>) id 1juBwV-000473-CV; Sat, 11 Jul 2020 09:37:11 +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 <arne@kamera.blinkt.de>) id 1juBwT-00046c-Je for openvpn-devel@lists.sourceforge.net; Sat, 11 Jul 2020 09:37:09 +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=51KEHl6LxxhJuHALeQGyyDLg8JmTmn48RFnOIFHAe7E=; b=bPKGEsIh4zfAO/HhtFsN6CBfN1 eXpQ0pq38dbXfakQ/GmsybEFqSQXV7BRifqZ/IkKgw2smY58iiLHmkSqURFS67K8yCFR/xPciqtY7 usew4X/eFwZU7mf13Htydj4GHktU9GFWhAQHbSYFDuoRS0MHBVElpMmbfg1mpIOahWIc=; 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=51KEHl6LxxhJuHALeQGyyDLg8JmTmn48RFnOIFHAe7E=; b=FTP7F3HLtZgedsPVVzHwvvtR7P ELCU8Ttty6mwjq20pLpW0oJ/CzbrjmyD03HHbgUsKfuINVJDRvH7T5lbYdJMrFn2l9BN9bxTFHge1 QAt+Pm64639At7Co1xnNvqTyJD0rhup5OWGbMG5LiLm8uiBaReqfD4Eh9dYzdZQmvmc4=; Received: from mail.blinkt.de ([192.26.174.232]) by sfi-mx-4.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2) id 1juBwR-00GxtP-HR for openvpn-devel@lists.sourceforge.net; Sat, 11 Jul 2020 09:37:09 +0000 Received: from kamera.blinkt.de ([2001:638:502:390:20c:29ff:fec8:535c]) by mail.blinkt.de with smtp (Exim 4.94 (FreeBSD)) (envelope-from <arne@kamera.blinkt.de>) id 1juBwF-0002Q9-Lm for openvpn-devel@lists.sourceforge.net; Sat, 11 Jul 2020 11:36:55 +0200 Received: (nullmailer pid 23731 invoked by uid 10006); Sat, 11 Jul 2020 09:36:55 -0000 From: Arne Schwabe <arne@rfc2549.org> To: openvpn-devel@lists.sourceforge.net Date: Sat, 11 Jul 2020 11:36:42 +0200 Message-Id: <20200711093655.23686-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.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: 1juBwR-00GxtP-HR Subject: [Openvpn-devel] [PATCH v5 01/14] Allow changing fallback cipher from ccd files/client-connect 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,v5,01/14] Allow changing fallback cipher from ccd files/client-connect
|
|
Commit Message
Arne Schwabe
July 10, 2020, 11:36 p.m. UTC
This allows to control the fallback cipher that is used when the
client/server do have any common cipher on a per client basis.
The patch is similar to Steffan's
[PATCH v4] Allow changing cipher from a ccd file.
Steffan's old patch also moves the cipher negotiation to
multi_established_connection() which I independently discovered and
implemented in
Extract process_incoming_push_reply from process_incoming_push_msg
(#FIXME add commitsh when commited to master)
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
---
src/openvpn/options.c | 2 +-
src/openvpn/options.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
Comments
Acked-by: Gert Doering <gert@greenie.muc.de> The patch is trivial enough (it just allows "cipher" in ccd/ files, with no logic changes) - it's built on the changes in the previous patches, which makes it "just work". Without the patch, trying to set & push a cipher from ccd/: Jul 11 18:27:53 gentoo tap-udp-p2mp[12620]: Options error: option 'cipher' cannot be used in this context (ccd/freebsd-74-amd64) Jul 11 18:27:55 gentoo tap-udp-p2mp[12620]: ... SENT CONTROL [freebsd-74-amd64]: 'PUSH_REPLY,...,cipher CAMELLIA-128-CBC,...,cipher AES-256-GCM' (status=1) With the patch *and* forcing NCP on the server side by only allowing CAMELLIA-128-CBC: $ cat ccd/freebsd-74-amd64 ncp-ciphers CAMELLIA-128-CBC cipher CAMELLIA-128-CBC it will actually do that: Jul 11 18:42:37 gentoo tap-udp-p2mp[13661]: Outgoing Data Channel: Cipher 'CAMELLIA-128-CBC' initialized with 128 bit key Jul 11 18:42:37 gentoo tap-udp-p2mp[13661]: Incoming Data Channel: Cipher 'CAMELLIA-128-CBC' initialized with 128 bit key Jul 11 18:42:38 gentoo tap-udp-p2mp[13661]: SENT CONTROL [freebsd-74-amd64]: 'PUSH_REPLY,...,peer-id 2,cipher CAMELLIA-128-CBC' (status=1) (if I put "CAMELLIA and some of the AES-GCM variants" in there, I get the standard AES-256-GCM or AES-128-GCM variants - with no indication in the logs on why it doesn't want to take the cipher --> documenting this here, so it can be found by googling: if you want "cipher" to work in CCD/ files, you must also set "ncp-ciphers" accordingly). Your patch has been applied to the master branch. commit 6168f53d6b7274026d4f392a22e64524a9b264d6 Author: Arne Schwabe Date: Sat Jul 11 11:36:42 2020 +0200 Allow changing fallback cipher from ccd files/client-connect Signed-off-by: Arne Schwabe <arne@rfc2549.org> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <20200711093655.23686-1-arne@rfc2549.org> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg20281.html Signed-off-by: Gert Doering <gert@greenie.muc.de> -- kind regards, Gert Doering
Am 11.07.2020 um 18:48 schrieb Gert Doering: > Acked-by: Gert Doering <gert@greenie.muc.de> > > The patch is trivial enough (it just allows "cipher" in ccd/ files, with > no logic changes) - it's built on the changes in the previous patches, which > makes it "just work". > > Without the patch, trying to set & push a cipher from ccd/: > > Jul 11 18:27:53 gentoo tap-udp-p2mp[12620]: Options error: option 'cipher' cannot be used in this context (ccd/freebsd-74-amd64) > Jul 11 18:27:55 gentoo tap-udp-p2mp[12620]: ... SENT CONTROL [freebsd-74-amd64]: 'PUSH_REPLY,...,cipher CAMELLIA-128-CBC,...,cipher AES-256-GCM' (status=1) > > With the patch *and* forcing NCP on the server side by only allowing > CAMELLIA-128-CBC: > > $ cat ccd/freebsd-74-amd64 > ncp-ciphers CAMELLIA-128-CBC > cipher CAMELLIA-128-CBC > > it will actually do that: > > Jul 11 18:42:37 gentoo tap-udp-p2mp[13661]: Outgoing Data Channel: Cipher 'CAMELLIA-128-CBC' initialized with 128 bit key > Jul 11 18:42:37 gentoo tap-udp-p2mp[13661]: Incoming Data Channel: Cipher 'CAMELLIA-128-CBC' initialized with 128 bit key > Jul 11 18:42:38 gentoo tap-udp-p2mp[13661]: SENT CONTROL [freebsd-74-amd64]: 'PUSH_REPLY,...,peer-id 2,cipher CAMELLIA-128-CBC' (status=1) > > (if I put "CAMELLIA and some of the AES-GCM variants" in there, I get the > standard AES-256-GCM or AES-128-GCM variants - with no indication in the > logs on why it doesn't want to take the cipher --> documenting this here, > so it can be found by googling: if you want "cipher" to work in CCD/ files, cipher only sets the fallback cipher if we find no common cipher. All ciphers in ncp-ciphers are still preferred to cipher. So to have the server pick the --cipher from the either general config or ccd config, none of the cipher in ncp-ciphers may be supported by the peer (so not in ncp-ciphers/ncp-ciphers and not as --cipher) Arne
Hi, On Sun, Jul 12, 2020 at 01:28:56AM +0200, Arne Schwabe wrote: > > With the patch *and* forcing NCP on the server side by only allowing > > CAMELLIA-128-CBC: > > > > $ cat ccd/freebsd-74-amd64 > > ncp-ciphers CAMELLIA-128-CBC > > cipher CAMELLIA-128-CBC > > > > it will actually do that: [..] > > cipher only sets the fallback cipher if we find no common cipher. All > ciphers in ncp-ciphers are still preferred to cipher. So to have the > server pick the --cipher from the either general config or ccd config, > none of the cipher in ncp-ciphers may be supported by the peer (so not > in ncp-ciphers/ncp-ciphers and not as --cipher) More details on the scenario: The client here is a stock 2.4 client, with "nothing" in the config - so it sends IV_NCP=1, but no cipher list, and OCC cipher is "bf-cbc". In ccd/, if I have *just* "ncp-ciphers CAMELLIA-128-CBC", it will actually fallback to "bf-cbc". Which matches your description: no common ciphers (IV_NCP=1 = AES-128-GCM:AES-256-GCM) -> fallback cipher (bf-cbc). So, shorter: you're right :-) - and if we want to force a cipher for a NCP-capable client, it needs "cipher" *and* "ncp-ciphers" in ccd/, because otherwise NCP will just override our config. gert
grammar: On 11/07/2020 10:36, Arne Schwabe wrote: > This allows to control the fallback cipher that is used when the > client/server do have any common cipher on a per client basis. client/server do not have any common cipher > > The patch is similar to Steffan's > [PATCH v4] Allow changing cipher from a ccd file. > > Steffan's old patch also moves the cipher negotiation to > multi_established_connection() which I independently discovered and > implemented in implemented in: (otherwise it looks like you forgot "in what" - That is if my interpretation is correct) > > Extract process_incoming_push_reply from process_incoming_push_msg > (#FIXME add commitsh when commited to master) > > Signed-off-by: Arne Schwabe <arne@rfc2549.org> > --- > src/openvpn/options.c | 2 +- > src/openvpn/options.h | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/src/openvpn/options.c b/src/openvpn/options.c > index b93fd4fe..bf2760e1 100644 > --- a/src/openvpn/options.c > +++ b/src/openvpn/options.c > @@ -7892,7 +7892,7 @@ add_option(struct options *options, > } > else if (streq(p[0], "cipher") && p[1] && !p[2]) > { > - VERIFY_PERMISSION(OPT_P_NCP); > + VERIFY_PERMISSION(OPT_P_NCP|OPT_P_INSTANCE); > options->ciphername = p[1]; > } > else if (streq(p[0], "ncp-ciphers") && p[1] && !p[2]) > diff --git a/src/openvpn/options.h b/src/openvpn/options.h > index c83a46aa..c37006d3 100644 > --- a/src/openvpn/options.h > +++ b/src/openvpn/options.h > @@ -677,7 +677,7 @@ struct options > #define OPT_P_MTU (1<<14) /* TODO */ > #define OPT_P_NICE (1<<15) > #define OPT_P_PUSH (1<<16) > -#define OPT_P_INSTANCE (1<<17) > +#define OPT_P_INSTANCE (1<<17) /**< allowed in ccd, client-connect etc*/ > #define OPT_P_CONFIG (1<<18) > #define OPT_P_EXPLICIT_NOTIFY (1<<19) > #define OPT_P_ECHO (1<<20) >
Hi, On Mon, Jul 13, 2020 at 01:30:11PM +0100, tincanteksup wrote: > grammar: > > On 11/07/2020 10:36, Arne Schwabe wrote: > > This allows to control the fallback cipher that is used when the > > client/server do have any common cipher on a per client basis. > > client/server do not have any common cipher Too late, that patch went in yesterday already. > (otherwise it looks like you forgot "in what" - That is if my > interpretation is correct) It's missing the commit ID here, which I added :-) - so the commit message is a bit more complete. gert
diff --git a/src/openvpn/options.c b/src/openvpn/options.c index b93fd4fe..bf2760e1 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -7892,7 +7892,7 @@ add_option(struct options *options, } else if (streq(p[0], "cipher") && p[1] && !p[2]) { - VERIFY_PERMISSION(OPT_P_NCP); + VERIFY_PERMISSION(OPT_P_NCP|OPT_P_INSTANCE); options->ciphername = p[1]; } else if (streq(p[0], "ncp-ciphers") && p[1] && !p[2]) diff --git a/src/openvpn/options.h b/src/openvpn/options.h index c83a46aa..c37006d3 100644 --- a/src/openvpn/options.h +++ b/src/openvpn/options.h @@ -677,7 +677,7 @@ struct options #define OPT_P_MTU (1<<14) /* TODO */ #define OPT_P_NICE (1<<15) #define OPT_P_PUSH (1<<16) -#define OPT_P_INSTANCE (1<<17) +#define OPT_P_INSTANCE (1<<17) /**< allowed in ccd, client-connect etc*/ #define OPT_P_CONFIG (1<<18) #define OPT_P_EXPLICIT_NOTIFY (1<<19) #define OPT_P_ECHO (1<<20)