From patchwork Tue Apr 21 00:11:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 1095 Return-Path: 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 mNCTDRfHnl4qBAAAIUCqbw for ; Tue, 21 Apr 2020 06:12:39 -0400 Received: from proxy18.mail.iad3a.rsapps.net ([172.27.255.9]) by director9.mail.ord1d.rsapps.net with LMTP id gIyxChfHnl5ZQwAAalYnBA ; Tue, 21 Apr 2020 06:12:39 -0400 Received: from smtp3.gate.iad3a ([172.27.255.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy18.mail.iad3a.rsapps.net with LMTP id gLqGAhfHnl7hEAAAon3hFg ; Tue, 21 Apr 2020 06:12:39 -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: smtp3.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: a0a838ec-83b8-11ea-b5ae-525400af4d07-1-1 Received: from [216.105.38.7] ([216.105.38.7:33322] helo=lists.sourceforge.net) by smtp3.gate.iad3a.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id D4/91-19635-617CE9E5; Tue, 21 Apr 2020 06:12:38 -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 1jQpsM-0000NY-VD; Tue, 21 Apr 2020 10:11:34 +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 1jQpsL-0000NR-N9 for openvpn-devel@lists.sourceforge.net; Tue, 21 Apr 2020 10:11:33 +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=MirV8VXmRnlILN3t+4FidZze7A74Quk3uTBH+cONWUg=; b=CU2uNQ8D6F+TGhIzT2AiXDALCv 2MCVwNGFW5yGunAB+MS/zDJUWCe6ihBzjV02FTq2VUIgkrgjLA3bgjSUIWs3IOpFIKtppmWpRWtbp +ICFh5AuyiLIl0dp7wVI/hnfQRR/sdXmhH6sU3zgFnrnRqddEkY6zD11Qbrgdw61F4ew=; 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=MirV8VXmRnlILN3t+4FidZze7A74Quk3uTBH+cONWUg=; b=T/hx22Z5UxFgPkgLfO+P0f47zY soFgNuy8+hMemRbp9D0fZ0w0KIJ64PGG4LtGwtxhFnQASYyhy/YGD9q/Xu9B0isWuHTlr7YKTSzv1 u8BnULPO66ohMyiRg4pXVllBIN4qnaelvMnQCJhIbM3qAR9n72ZIm+/pYqhAt3qB1BLw=; 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 1jQpsG-008JVR-Tr for openvpn-devel@lists.sourceforge.net; Tue, 21 Apr 2020 10:11:33 +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 1jQpsA-0008Cq-9T for openvpn-devel@lists.sourceforge.net; Tue, 21 Apr 2020 12:11:22 +0200 Received: (nullmailer pid 24335 invoked by uid 10006); Tue, 21 Apr 2020 10:11:22 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Tue, 21 Apr 2020 12:11:22 +0200 Message-Id: <20200421101122.24284-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 X-Headers-End: 1jQpsG-008JVR-Tr Subject: [Openvpn-devel] [PATCH] Fix tls_ctx_client/server_new leaving error on OpenSSL error stack 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 In the corner case that the global OpenSSL has an invalid command like MinProtocol = TLSv1.0 (Due to OpenSSL's idiosyncrasies MinProtocol = TLSv1 would be correct) the SSL_ctx_new function leaves the errors for parsing the config file on the stack. OpenSSL: error:14187180:SSL routines:ssl_do_config:bad value Since the later functions, especially the one of loading the certificates expected a clean error this error got reported at the wrong place. Print the warnings with crypto_msg when we detect that we are in this situation (this also clears the stack). Acked-by: Gert Doering --- src/openvpn/ssl_openssl.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/openvpn/ssl_openssl.c b/src/openvpn/ssl_openssl.c index 5955c6bd..555cbbdf 100644 --- a/src/openvpn/ssl_openssl.c +++ b/src/openvpn/ssl_openssl.c @@ -115,6 +115,11 @@ tls_ctx_server_new(struct tls_root_ctx *ctx) { crypto_msg(M_FATAL, "SSL_CTX_new SSLv23_server_method"); } + if (ERR_peek_error() != 0) + { + crypto_msg(M_WARN, "Warning: TLS server context initialisation " + "has warnings."); + } } void @@ -128,6 +133,11 @@ tls_ctx_client_new(struct tls_root_ctx *ctx) { crypto_msg(M_FATAL, "SSL_CTX_new SSLv23_client_method"); } + if (ERR_peek_error() != 0) + { + crypto_msg(M_WARN, "Warning: TLS client context initialisation " + "has warnings."); + } } void