From patchwork Thu Aug 13 22:06:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 1386 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director7.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net with LMTP id YEAgMElGNl8adwAAIUCqbw for ; Fri, 14 Aug 2020 04:07:37 -0400 Received: from proxy1.mail.ord1d.rsapps.net ([172.30.191.6]) by director7.mail.ord1d.rsapps.net with LMTP id uN8KMElGNl8cZwAAovjBpQ (envelope-from ) for ; Fri, 14 Aug 2020 04:07:37 -0400 Received: from smtp29.gate.ord1d ([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 WOggMElGNl9FQQAAasrz9Q ; Fri, 14 Aug 2020 04:07:37 -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: smtp29.gate.ord1d.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: 370789ae-de05-11ea-b867-525400f257a9-1-1 Received: from [216.105.38.7] ([216.105.38.7:38538] helo=lists.sourceforge.net) by smtp29.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 90/39-00992-946463F5; Fri, 14 Aug 2020 04:07:37 -0400 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 1k6Ujd-0007PW-D9; Fri, 14 Aug 2020 08:06:45 +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 1k6Ujb-0007PH-4l for openvpn-devel@lists.sourceforge.net; Fri, 14 Aug 2020 08:06:43 +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=GggzxG9ScoT6U+dkNMO75fv3KE+S1Jp62Jczb3bjDKY=; b=CG0Iizejv2l75kqydXe35TZMow 5ThHpiMuBbGwFCDY1h6AX7YnvHwdWHqsp/lGdDkctIfO2PxBAJR5DGu3H8u3in5v+b710UnlAiV2x aJ/pa9PCy2cxvsQFZz8A0xZSEtWWLGPIQbk6Cxa+Rb2eSJFDZStFCN4tNNbNGAExMnQo=; 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=GggzxG9ScoT6U+dkNMO75fv3KE+S1Jp62Jczb3bjDKY=; b=jreJzCvMqI356WkjdJ1SwfV8lA LsQh4npWPHRvAmPnqURyL9txeP/s3IxWt7EmQR5cRJ8jOqcUsQu6/OLKil1L+vjELxr8yNN2r2yQ8 79W/q48Wndkzd933/VH33gfk8TdNYTKvgdbrilBQQzFeqWEisFl9jTWvJ0ZSdhFSq5XA=; 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 1k6UjX-00BEyP-6m for openvpn-devel@lists.sourceforge.net; Fri, 14 Aug 2020 08:06:43 +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 ) id 1k6UjF-00039W-0s for openvpn-devel@lists.sourceforge.net; Fri, 14 Aug 2020 10:06:21 +0200 Received: (nullmailer pid 2153 invoked by uid 10006); Fri, 14 Aug 2020 08:06:19 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Fri, 14 Aug 2020 10:06:19 +0200 Message-Id: <20200814080619.2108-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.0 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: 1k6UjX-00BEyP-6m Subject: [Openvpn-devel] [PATCH] Fix client's poor man NCP fallback 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 OpenVPN 2.5 clients do not correctly do a fallback to the server server. This commit fixes that logic and also fixes --data-ciphers-fallback to be used in situations other than no OCC cipher. To reproduce the error use a client with only --data-ciphers set against a server without NCP. OPTIONS ERROR: failed to negotiate cipher with server. Add the server's cipher ('AES-256-CBC') to --data-ciphers (currently 'AES-256-CBC') if you want to connect to this server. Reported by: Richard Bonhomme Signed-off-by: Arne Schwabe Reported-by: Richard Bonhomme Tested-by: Richard Bonhomme Acked-by: Steffan Karger Signed-off-by: Arne Schwabe <arne@rfc2549.org>
--- src/openvpn/ssl_ncp.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/openvpn/ssl_ncp.c b/src/openvpn/ssl_ncp.c index f522b8f0..c9ab85ce 100644 --- a/src/openvpn/ssl_ncp.c +++ b/src/openvpn/ssl_ncp.c @@ -296,13 +296,14 @@ check_pull_client_ncp(struct context *c, const int found) } /* If the server did not push a --cipher, we will switch to the * remote cipher if it is in our ncp-ciphers list */ - bool useremotecipher = tls_poor_mans_ncp(&c->options, - c->c2.tls_multi->remote_ciphername); - + if(tls_poor_mans_ncp(&c->options, c->c2.tls_multi->remote_ciphername)) + { + return true; + } /* We could not figure out the peer's cipher but we have fallback * enabled */ - if (!useremotecipher && c->options.enable_ncp_fallback) + if (!c->c2.tls_multi->remote_ciphername && c->options.enable_ncp_fallback) { return true; }