Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: module 'lib' has no attribute 'X509_V_FLAG_CB_ISSUER_CHECK' #378

Closed
johan-westin-private opened this issue Apr 27, 2022 · 7 comments

Comments

@johan-westin-private
Copy link

Hi,

Thank you for a fine and very usefull Python package!!

Today I got the below fatal error, using stomp.py==8.0.0 (which depends on pyOpenSSL==20.0.1):

Traceback (most recent call last):
File "/projects/my_receiver/default/bin/my_receiver-request-receiver", line 5, in
from my_receiver.main.request_receiver import main
File "/projects/my_receiver/1.0.0+/lib/python3.7/site-packages/my_receiver/init.py", line 3, in
from .exception import (
File "/projects/my_receiver/1.0.0+/lib/python3.7/site-packages/my_receiver/exception.py", line 14, in
from my_commons import MyException
File "/projects/my_receiver/1.0.0+/lib/python3.7/site-packages/my_commons/init.py", line 293, in
from .config.setting import settings # do not move this
File "/projects/my_receiver/1.0.0+/lib/python3.7/site-packages/my_commons/config/init.py", line 75, in
from .ioc_configurator import configure, set_root_dir_path
File "/projects/my_receiver/1.0.0+/lib/python3.7/site-packages/my_commons/config/ioc_configurator.py", line 13, in
from my_commons.common.simple_workflow_context import SimpleWorkflowContext
File "/projects/my_receiver/1.0.0+/lib/python3.7/site-packages/my_commons/common/init.py", line 37, in
from .stomp_connect import stomp_connect
File "/projects/my_receiver/1.0.0+/lib/python3.7/site-packages/my_commons/common/stomp_connect.py", line 9, in
import stomp
File "/projects/my_receiver/1.0.0+/lib/python3.7/site-packages/stomp/init.py", line 13, in
import stomp.connect as connect
File "/projects/my_receiver/1.0.0+/lib/python3.7/site-packages/stomp/connect.py", line 9, in
from stomp.transport import *
File "/projects/my_receiver/1.0.0+/lib/python3.7/site-packages/stomp/transport.py", line 38, in
import OpenSSL
File "/projects/my_receiver/1.0.0+/lib/python3.7/site-packages/OpenSSL/init.py", line 8, in
from OpenSSL import crypto, SSL
File "/projects/my_receiver/1.0.0+/lib/python3.7/site-packages/OpenSSL/crypto.py", line 1556, in
class X509StoreFlags(object):
File "/projects/my_receiver/1.0.0+/lib/python3.7/site-packages/OpenSSL/crypto.py", line 1577, in X509StoreFlags
CB_ISSUER_CHECK = _lib.X509_V_FLAG_CB_ISSUER_CHECK
AttributeError: module 'lib' has no attribute 'X509_V_FLAG_CB_ISSUER_CHECK'

When install pyOpenSSL==22.0.0 with

python -m pip install --upgrade pip setuptools wheel pyOpenSSL==22.0.0

Installing collected packages: pyOpenSSL
Attempting uninstall: pyOpenSSL
Found existing installation: pyOpenSSL 20.0.1
Uninstalling pyOpenSSL-20.0.1:
Successfully uninstalled pyOpenSSL-20.0.1
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
stomp-py 8.0.0 requires PyOpenSSL<21.0.0,>=20.0.1, but you have pyopenssl 22.0.0 which is incompatible.

and ignoring the ERROR it works fine.

Which action do you propose?

Best regards,
Johan Westin

@johan-westin-private
Copy link
Author

OS: CentOS Linux release 7.9.2009
Linux kernel: 3.10.0-1160.24.1.el7.x86_64
OpenSSL: 1.1
Python: 3.7.2 (build with GCC 8.2.0)

@jertel
Copy link

jertel commented Apr 27, 2022

On Feb 16, an issue was created, requesting to upgrade to PyOpenSSL 22.0: #371

Later that day this commit was pushed, effectively upgrading PyOpenSSL to 22.0: 000de5e

Based on that it appears the code base is ready to go, and now we're waiting for a new pip package release.

However, it might be better to remove the dependency on PyOpenSSL altogether, and switch stomp/transport.py:56 to use the cryptography package directly to load the certificate. PyOpenSSL is not recommended for use at this point.

@johan-westin-private
Copy link
Author

My workaround is to pin cryptography==36.0.2

@eisraeli
Copy link

eisraeli commented Apr 27, 2022

I've encountered the same issue... Following...

../../../.local/share/virtualenvs/p/lib/python3.9/site-packages/stomp/init.py:13: in
import stomp.connect as connect
../../../.local/share/virtualenvs/p/lib/python3.9/site-packages/stomp/connect.py:9: in
from stomp.transport import *
../../../.local/share/virtualenvs/p/lib/python3.9/site-packages/stomp/transport.py:38: in
import OpenSSL
../../../.local/share/virtualenvs/p/lib/python3.9/site-packages/OpenSSL/init.py:8: in
from OpenSSL import crypto, SSL
../../../.local/share/virtualenvs/p/lib/python3.9/site-packages/OpenSSL/crypto.py:1556: in
class X509StoreFlags(object):
../../../.local/share/virtualenvs/p/lib/python3.9/site-packages/OpenSSL/crypto.py:1577: in X509StoreFlags
CB_ISSUER_CHECK = _lib.X509_V_FLAG_CB_ISSUER_CHECK
E AttributeError: module 'lib' has no attribute 'X509_V_FLAG_CB_ISSUER_CHECK'

@jertel
Copy link

jertel commented Apr 29, 2022

Some good news.. The pyca team released cryptography 37.0.1 which restored the symbol that this older PyOpenSSL package uses. They will be removing it again soon, so they still advise projects to upgrade to the latest PyOpenSSL lib. But for now we can continue using the Stomp 8.0.0 package.

@jasonrbriggs
Copy link
Owner

I've changed the code to use x509 from the cryptography module itself, and removed the dependency on PyOpenSSL. Added bonus... code is ever-so-slightly clean as well.

Version 8.0.1: https://pypi.org/project/stomp.py/8.0.1/

@johan-westin-private
Copy link
Author

Great news, thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants