Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-2458

Incompatibilities with pyOpenSSL 20

    • Type: Icon: Bug Bug
    • Resolution: Gone away
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None

      Installing pyOpenSSL 20.0.0 breaks pymongo on some platforms. Note: this was fixed by pyopenssl 20.0.1. For example, on RHEL 7.0 with the default system python (2.7.5).

       [2020/12/04 23:27:52.215] Successfully installed pip-20.3.1 setuptools-44.1.1 wheel-0.36.1
       [2020/12/04 23:27:52.215] Looking in indexes: https://artifactory.corp.mongodb.com/artifactory/api/pypi/pypi/simple, https://pypi.org/simple
       [2020/12/04 23:27:52.216] Requirement already satisfied: pyopenssl in /usr/lib64/python2.7/site-packages (0.13.1)
       [2020/12/04 23:27:52.217] Requirement already satisfied: requests in /usr/lib/python2.7/site-packages (2.19.0)
       [2020/12/04 23:27:52.445] Collecting service_identity
       [2020/12/04 23:27:52.445]   Downloading https://artifactory.corp.mongodb.com/artifactory/api/pypi/pypi/packages/e9/7c/2195b890023e098f9618d43ebc337d83c8b38d414326685339eb024db2f6/service_identity-18.1.0-py2.py3-none-any.whl (11 kB)
       [2020/12/04 23:27:52.490] Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/lib/python2.7/site-packages (from requests) (3.0.4)
       [2020/12/04 23:27:52.494] Requirement already satisfied: certifi>=2017.4.17 in /usr/lib/python2.7/site-packages (from requests) (2019.11.28)
       [2020/12/04 23:27:52.496] Requirement already satisfied: idna<2.8,>=2.5 in /usr/lib/python2.7/site-packages (from requests) (2.7)
       [2020/12/04 23:27:52.499] Requirement already satisfied: urllib3<1.24,>=1.21.1 in /usr/lib/python2.7/site-packages (from requests) (1.23)
       [2020/12/04 23:27:52.517] Requirement already satisfied: pyasn1 in /usr/lib/python2.7/site-packages (from service_identity) (0.4.8)
       [2020/12/04 23:27:53.692] Collecting cryptography
       [2020/12/04 23:27:53.692]   Downloading https://artifactory.corp.mongodb.com/artifactory/api/pypi/pypi/packages/08/ef/e98bc93bfa2527cb954efde5f3c7538a40fe0e7a2e55d68707783fcdab5d/cryptography-3.2.1-cp27-cp27mu-manylinux2010_x86_64.whl (2.6 MB)
       [2020/12/04 23:27:53.985] Collecting ipaddress; python_version < "3.3"
       [2020/12/04 23:27:53.985]   Downloading https://artifactory.corp.mongodb.com/artifactory/api/pypi/pypi/packages/c2/f8/49697181b1651d8347d24c095ce46c7346c37335ddc7d255833e7cde674d/ipaddress-1.0.23-py2.py3-none-any.whl (18 kB)
       [2020/12/04 23:27:54.237] Collecting pyasn1-modules
       [2020/12/04 23:27:54.237]   Downloading https://artifactory.corp.mongodb.com/artifactory/api/pypi/pypi/packages/95/de/214830a981892a3e286c3794f41ae67a4495df1108c3da8a9f62159b9a9d/pyasn1_modules-0.2.8-py2.py3-none-any.whl (155 kB)
       [2020/12/04 23:27:54.441] Collecting attrs>=16.0.0
       [2020/12/04 23:27:54.441]   Downloading https://artifactory.corp.mongodb.com/artifactory/api/pypi/pypi/packages/c3/aa/cb45262569fcc047bf070b5de61813724d6726db83259222cd7b4c79821a/attrs-20.3.0-py2.py3-none-any.whl (49 kB)
       [2020/12/04 23:27:54.496] Requirement already satisfied: six>=1.4.1 in /usr/lib/python2.7/site-packages (from cryptography->service_identity) (1.9.0)
       [2020/12/04 23:27:54.497] Requirement already satisfied: cffi!=1.11.3,>=1.8 in /usr/lib64/python2.7/site-packages (from cryptography->service_identity) (1.12.3)
       [2020/12/04 23:27:54.500] Requirement already satisfied: enum34; python_version < "3" in /usr/lib/python2.7/site-packages (from cryptography->service_identity) (1.1.6)
       [2020/12/04 23:27:54.501] Requirement already satisfied: pycparser in /usr/lib/python2.7/site-packages (from cffi!=1.11.3,>=1.8->cryptography->service_identity) (2.19)
       [2020/12/04 23:27:55.489] Installing collected packages: ipaddress, cryptography, pyasn1-modules, attrs, service-identity
       [2020/12/04 23:27:55.863] Successfully installed attrs-20.3.0 cryptography-3.2.1 ipaddress-1.0.23 pyasn1-modules-0.2.8 service-identity-18.1.0
       [2020/12/04 23:27:56.494] Traceback (most recent call last):
       [2020/12/04 23:27:56.494]   File "<string>", line 1, in <module>
       [2020/12/04 23:27:56.494] ImportError: No module named xmlrunner
       [2020/12/04 23:27:56.504] Running auth tests over ssl with python python
       [2020/12/04 23:27:56.504] 2.7.5 (default, May  3 2017, 07:55:04)
       [2020/12/04 23:27:56.504] [GCC 4.8.5 20150623 (Red Hat 4.8.5-14)]
       [2020/12/04 23:27:56.885] running clean
       [2020/12/04 23:27:56.885] running build_ext
       [2020/12/04 23:27:56.885] building 'bson._cbson' extension
       [2020/12/04 23:27:56.885] creating build
       [2020/12/04 23:27:56.885] creating build/temp.linux-x86_64-2.7
       [2020/12/04 23:27:56.885] creating build/temp.linux-x86_64-2.7/bson
       [2020/12/04 23:27:56.885] gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Ibson -I/usr/include/python2.7 -c bson/_cbsonmodule.c -o build/temp.linux-x86_64-2.7/bson/_cbsonmodule.o
       [2020/12/04 23:27:57.513] gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Ibson -I/usr/include/python2.7 -c bson/time64.c -o build/temp.linux-x86_64-2.7/bson/time64.o
       [2020/12/04 23:27:57.678] gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Ibson -I/usr/include/python2.7 -c bson/buffer.c -o build/temp.linux-x86_64-2.7/bson/buffer.o
       [2020/12/04 23:27:57.745] gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Ibson -I/usr/include/python2.7 -c bson/encoding_helpers.c -o build/temp.linux-x86_64-2.7/bson/encoding_helpers.o
       [2020/12/04 23:27:57.769] gcc -pthread -shared -Wl,-z,relro build/temp.linux-x86_64-2.7/bson/_cbsonmodule.o build/temp.linux-x86_64-2.7/bson/time64.o build/temp.linux-x86_64-2.7/bson/buffer.o build/temp.linux-x86_64-2.7/bson/encoding_helpers.o -L/usr/lib64 -lpython2.7 -o /data/mci/166b76e311baec93a3f5b35c074f7b19/src/bson/_cbson.so
       [2020/12/04 23:27:57.789] building 'pymongo._cmessage' extension
       [2020/12/04 23:27:57.789] creating build/temp.linux-x86_64-2.7/pymongo
       [2020/12/04 23:27:57.789] gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Ibson -I/usr/include/python2.7 -c pymongo/_cmessagemodule.c -o build/temp.linux-x86_64-2.7/pymongo/_cmessagemodule.o
       [2020/12/04 23:27:58.137] gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Ibson -I/usr/include/python2.7 -c bson/buffer.c -o build/temp.linux-x86_64-2.7/bson/buffer.o
       [2020/12/04 23:27:58.202] gcc -pthread -shared -Wl,-z,relro build/temp.linux-x86_64-2.7/pymongo/_cmessagemodule.o build/temp.linux-x86_64-2.7/bson/buffer.o -L/usr/lib64 -lpython2.7 -o /data/mci/166b76e311baec93a3f5b35c074f7b19/src/pymongo/_cmessage.so
       [2020/12/04 23:27:58.341] /data/mci/166b76e311baec93a3f5b35c074f7b19/src/pyopenssltest/lib/python2.7/site-packages/service_identity/cryptography.py:9: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in a future release.
       [2020/12/04 23:27:58.341]   from cryptography.x509 import (
       [2020/12/04 23:27:58.799] Traceback (most recent call last):
       [2020/12/04 23:27:58.799]   File "<string>", line 1, in <module>
       [2020/12/04 23:27:58.799]   File "pymongo/__init__.py", line 87, in <module>
       [2020/12/04 23:27:58.799]     from pymongo.collection import ReturnDocument
       [2020/12/04 23:27:58.799]   File "pymongo/collection.py", line 29, in <module>
       [2020/12/04 23:27:58.799]     from pymongo import (common,
       [2020/12/04 23:27:58.799]   File "pymongo/common.py", line 35, in <module>
       [2020/12/04 23:27:58.799]     from pymongo.ssl_support import (validate_cert_reqs,
       [2020/12/04 23:27:58.799]   File "pymongo/ssl_support.py", line 27, in <module>
       [2020/12/04 23:27:58.799]     import pymongo.pyopenssl_context as _ssl
       [2020/12/04 23:27:58.799]   File "pymongo/pyopenssl_context.py", line 51, in <module>
       [2020/12/04 23:27:58.799]     OP_NO_COMPRESSION = _SSL.OP_NO_COMPRESSION
       [2020/12/04 23:27:58.836] AttributeError: 'module' object has no attribute 'OP_NO_COMPRESSION'
      

      And on Debian 9.2 with PyPy 3.6:

       [2020/12/04 23:32:38.198] + python -m pip install --prefer-binary pyopenssl requests service_identity
       [2020/12/04 23:32:39.467] Requirement already satisfied: requests in /opt/python/pypy3.6/site-packages (2.24.0)
       [2020/12/04 23:32:39.586] Collecting pyopenssl
       [2020/12/04 23:32:39.586]   Downloading pyOpenSSL-20.0.0-py2.py3-none-any.whl (54 kB)
       [2020/12/04 23:32:40.765] Requirement already satisfied: six>=1.5.2 in /opt/python/pypy3.6/site-packages (from pyopenssl) (1.15.0)
       [2020/12/04 23:32:40.804] Requirement already satisfied: chardet<4,>=3.0.2 in /opt/python/pypy3.6/site-packages (from requests) (3.0.4)
       [2020/12/04 23:32:40.807] Requirement already satisfied: idna<3,>=2.5 in /opt/python/pypy3.6/site-packages (from requests) (2.10)
       [2020/12/04 23:32:40.810] Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /opt/python/pypy3.6/site-packages (from requests) (1.25.10)
       [2020/12/04 23:32:40.812] Requirement already satisfied: certifi>=2017.4.17 in /opt/python/pypy3.6/site-packages (from requests) (2020.6.20)
       [2020/12/04 23:32:40.822] Collecting service_identity
       [2020/12/04 23:32:40.822]   Downloading service_identity-18.1.0-py2.py3-none-any.whl (11 kB)
       [2020/12/04 23:32:41.184] Collecting attrs>=16.0.0
       [2020/12/04 23:32:41.184]   Downloading attrs-20.3.0-py2.py3-none-any.whl (49 kB)
       [2020/12/04 23:32:41.742] Collecting cryptography>=3.2
       [2020/12/04 23:32:41.742]   Downloading cryptography-3.2.1.tar.gz (540 kB)
       [2020/12/04 23:32:41.742]   Installing build dependencies: started
       [2020/12/04 23:32:45.737]   Installing build dependencies: finished with status 'done'
       [2020/12/04 23:32:45.737]   Getting requirements to build wheel: started
       [2020/12/04 23:32:46.641]   Getting requirements to build wheel: finished with status 'done'
       [2020/12/04 23:32:46.642]   Installing backend dependencies: started
       [2020/12/04 23:32:54.436]   Installing backend dependencies: finished with status 'done'
       [2020/12/04 23:32:54.436]     Preparing wheel metadata: started
       [2020/12/04 23:32:58.607]     Preparing wheel metadata: finished with status 'done'
       [2020/12/04 23:32:58.607] Requirement already satisfied: six>=1.5.2 in /opt/python/pypy3.6/site-packages (from pyopenssl) (1.15.0)
       [2020/12/04 23:32:58.609] Requirement already satisfied: cffi!=1.11.3,>=1.8 in /opt/python/pypy3.6/lib_pypy (from cryptography>=3.2->pyopenssl) (1.14.2)
       [2020/12/04 23:32:58.683] Collecting pyasn1
       [2020/12/04 23:32:58.683]   Downloading pyasn1-0.4.8-py2.py3-none-any.whl (77 kB)
       [2020/12/04 23:32:58.683] Collecting pyasn1-modules
       [2020/12/04 23:32:58.802]   Downloading pyasn1_modules-0.2.8-py2.py3-none-any.whl (155 kB)
       [2020/12/04 23:32:58.802] Building wheels for collected packages: cryptography
       [2020/12/04 23:33:04.417]   Building wheel for cryptography (PEP 517): started
       [2020/12/04 23:33:04.417]   Building wheel for cryptography (PEP 517): finished with status 'done'
       [2020/12/04 23:33:04.422]   Created wheel for cryptography: filename=cryptography-3.2.1-pp36-pypy36_pp73-linux_x86_64.whl size=275210 sha256=86963145274b0f4c87992737a294417e057c489aab7b0d4aeb1340b081140b34
       [2020/12/04 23:33:04.422]   Stored in directory: /home/admin/.cache/pip/wheels/fa/9c/6a/32422310124b0ae3c3946ba062bec7cc78369bea2a8e525931
       [2020/12/04 23:33:05.258] Successfully built cryptography
       [2020/12/04 23:33:05.258] Installing collected packages: pyasn1, pyasn1-modules, cryptography, attrs, service-identity, pyopenssl
       [2020/12/04 23:33:06.059] Successfully installed attrs-20.3.0 cryptography-3.2.1 pyasn1-0.4.8 pyasn1-modules-0.2.8 pyopenssl-20.0.0 service-identity-18.1.0
       [2020/12/04 23:33:06.185] + OCSP_TLS_SHOULD_SUCCEED=true CA_FILE=/data/mci/51c6307ceedc9c7e5feaa54f98ae4266/drivers-tools/.evergreen/ocsp/rsa/ca.pem python test/ocsp/test_ocsp.py
       [2020/12/04 23:33:06.710] Traceback (most recent call last):
       [2020/12/04 23:33:06.710]   File "test/ocsp/test_ocsp.py", line 24, in <module>
       [2020/12/04 23:33:06.710]     import pymongo
       [2020/12/04 23:33:06.710]   File "/data/mci/51c6307ceedc9c7e5feaa54f98ae4266/src/pymongo/__init__.py", line 87, in <module>
       [2020/12/04 23:33:06.710]     from pymongo.collection import ReturnDocument
       [2020/12/04 23:33:06.710]   File "/data/mci/51c6307ceedc9c7e5feaa54f98ae4266/src/pymongo/collection.py", line 29, in <module>
       [2020/12/04 23:33:06.710]     from pymongo import (common,
       [2020/12/04 23:33:06.710]   File "/data/mci/51c6307ceedc9c7e5feaa54f98ae4266/src/pymongo/common.py", line 35, in <module>
       [2020/12/04 23:33:06.710]     from pymongo.ssl_support import (validate_cert_reqs,
       [2020/12/04 23:33:06.710]   File "/data/mci/51c6307ceedc9c7e5feaa54f98ae4266/src/pymongo/ssl_support.py", line 27, in <module>
       [2020/12/04 23:33:06.710]     import pymongo.pyopenssl_context as _ssl
       [2020/12/04 23:33:06.710]   File "/data/mci/51c6307ceedc9c7e5feaa54f98ae4266/src/pymongo/pyopenssl_context.py", line 27, in <module>
       [2020/12/04 23:33:06.710]     from OpenSSL import SSL as _SSL
       [2020/12/04 23:33:06.710]   File "/data/mci/51c6307ceedc9c7e5feaa54f98ae4266/src/ocsptest/site-packages/OpenSSL/__init__.py", line 8, in <module>
       [2020/12/04 23:33:06.710]     from OpenSSL import crypto, SSL
       [2020/12/04 23:33:06.710]   File "/data/mci/51c6307ceedc9c7e5feaa54f98ae4266/src/ocsptest/site-packages/OpenSSL/SSL.py", line 149, in <module>
       [2020/12/04 23:33:06.710]     OP_NO_TLSv1_3 = _lib.SSL_OP_NO_TLSv1_3
       [2020/12/04 23:33:06.710] AttributeError: module 'lib' has no attribute 'SSL_OP_NO_TLSv1_3'
      

            Assignee:
            shane.harvey@mongodb.com Shane Harvey
            Reporter:
            shane.harvey@mongodb.com Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: