From patchwork Mon May 15 15:39:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Numan Siddique X-Patchwork-Id: 762578 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wRPsB09Fsz9s4s for ; Tue, 16 May 2017 01:39:41 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 676F3B6D; Mon, 15 May 2017 15:39:38 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 0258D957 for ; Mon, 15 May 2017 15:39:37 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id B73F016F for ; Mon, 15 May 2017 15:39:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1CE9E2657 for ; Mon, 15 May 2017 15:39:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 1CE9E2657 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=nusiddiq@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 1CE9E2657 Received: from nusiddiq.blr.redhat.com (dhcp-0-25.blr.redhat.com [10.70.1.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id 274A57D4E4; Mon, 15 May 2017 15:39:29 +0000 (UTC) From: nusiddiq@redhat.com To: dev@openvswitch.org Date: Mon, 15 May 2017 21:09:25 +0530 Message-Id: <20170515153925.23102-1-nusiddiq@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 15 May 2017 15:39:31 +0000 (UTC) X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH v2] python ovs: Fix SSL exceptions with pyOpenSSL v0.13 X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Numan Siddique Centos provides pyOpenSSL version pyOpenSSL-0.13.1-3.el7.x86_64. There are 2 issues using this version, which this patch fixes - The test case "simple idl verify notify - SSL" is skipped. This is because "python -m OpenSSL.SSL" is used to detect the presence of pyOpenSSL package. pyOpenSSL v0.13 has C python modules because of which the above command returns 1. So this patch fixes this by using 'python -c "import OpenSSL.SSL"'. - The SSL.Context class do not have the function "set_session_cache_mode" defined. Setting the session cache mode has an effect for server-side sessions and doesn't make much sense for client-side sessions. Since python ovs doesn't support "pssl" connection mode, this patch deletes the reference to this function. I have not tested with older versions (< 0.13) of pyOpenSSL. Signed-off-by: Numan Siddique Acked-by: Lance Richardson Tested-by: Marcin Mirecki --- python/ovs/stream.py | 1 - tests/ovsdb-idl.at | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/python/ovs/stream.py b/python/ovs/stream.py index fc0368c..660d8bb 100644 --- a/python/ovs/stream.py +++ b/python/ovs/stream.py @@ -767,7 +767,6 @@ class SSLStream(Stream): ctx = SSL.Context(SSL.SSLv23_METHOD) ctx.set_verify(SSL.VERIFY_PEER, SSLStream.verify_cb) ctx.set_options(SSL.OP_NO_SSLv2 | SSL.OP_NO_SSLv3) - ctx.set_session_cache_mode(SSL.SESS_CACHE_OFF) # If the client has not set the SSL configuration files # exception would be raised. ctx.use_privatekey_file(Stream._SSL_private_key_file) diff --git a/tests/ovsdb-idl.at b/tests/ovsdb-idl.at index d28dfc1..4eaf87f 100644 --- a/tests/ovsdb-idl.at +++ b/tests/ovsdb-idl.at @@ -1185,7 +1185,7 @@ m4_define([OVSDB_CHECK_IDL_NOTIFY_SSL_PY], [AT_SETUP([$1 - SSL]) AT_SKIP_IF([test "$HAVE_OPENSSL" = no]) AT_SKIP_IF([test $HAVE_PYTHON = no]) - $PYTHON -m OpenSSL.SSL + $PYTHON -c "import OpenSSL.SSL" SSL_PRESENT=$? AT_SKIP_IF([test $SSL_PRESENT != 0]) AT_KEYWORDS([ovsdb server idl Python notify - ssl socket])