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

Seeing failures with get_short_name when used with cryptography >=40.0 #1203

Closed
blink1073 opened this issue Mar 27, 2023 · 3 comments
Closed

Comments

@blink1073
Copy link

blink1073 commented Mar 27, 2023

We started seeing the traceback below in our PyMongo test suite after the recent releases of pyOpenSSL 23.1.0 and cryptography 40.0.0. If we install pyOpenSSL==23.1.0 and cryptography<40, then the error does not appear. Any idea what the interaction might be?

 [2023/03/27 23:42:41.963]   File "/data/mci/2ea1ef6e08d225655a626e1898127fb5/src/pymongo/pyopenssl_context.py", line 377, in wrap_socket
 [2023/03/27 23:42:41.963]     _verify_hostname(ssl_conn, server_hostname)
 [2023/03/27 23:42:41.963]   File "/data/mci/2ea1ef6e08d225655a626e1898127fb5/src/venv-encryption/lib/python3.10/site-packages/service_identity/pyopenssl.py", line 49, in verify_hostname
 [2023/03/27 23:42:41.963]     cert_patterns=extract_ids(connection.get_peer_certificate()),
 [2023/03/27 23:42:41.963]   File "/data/mci/2ea1ef6e08d225655a626e1898127fb5/src/venv-encryption/lib/python3.10/site-packages/service_identity/pyopenssl.py", line 97, in extract_ids
 [2023/03/27 23:42:41.963]     if ext.get_short_name() == b"subjectAltName":
 [2023/03/27 23:42:41.963]   File "/data/mci/2ea1ef6e08d225655a626e1898127fb5/src/venv-encryption/lib/python3.10/site-packages/OpenSSL/crypto.py", line 907, in get_short_name
 [2023/03/27 23:42:41.963]     return _ffi.string(_lib.OBJ_nid2sn(nid))
 [2023/03/27 23:42:41.963] RuntimeError: cannot use string() on <cdata 'char *' NULL>

The system under test is Ubuntu 20.04 with OpenSSL 1.1.1f and Python 3.10.

@blink1073 blink1073 changed the title Seeing failures with get_short_name when used with cryptograpy >=40.0 Seeing failures with get_short_name when used with cryptography >=40.0 Mar 27, 2023
@reaperhulk
Copy link
Member

This is #1199 (fixed in #1204). It’s a bug with openssl 3.1.0 but we can work around it.

@reaperhulk
Copy link
Member

This should now be resolved in 23.1.1

@blink1073
Copy link
Author

I confirmed our tests are passing again, thank you!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants