Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 45 additions & 1 deletion source/includes/troubleshooting/tls.rst
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,48 @@ following steps:

- Downgrade Python to v3.9 or earlier
- Upgrade {+mdb-server+} to v4.2 or later
- Install {+driver-short+} with the :ref:`OCSP <pymongo-disable-ocsp>` option, which relies on PyOpenSSL
- Install {+driver-short+} with the :ref:`OCSP <pymongo-disable-ocsp>` option, which relies on PyOpenSSL

Unsafe Legacy Renegotiation Disabled
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

When using OpenSSL v3 or later, you might see an error similar to the following
message:

.. code-block:: python

MongoServerSelectionError: 886E0000:error:0A000152:SSL routines:final_renegotiate:unsafe legacy renegotiation disabled:c:\ws\deps\openssl\openssl\ssl\statem\extensions.c:922:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the Node error, the Python error would look like this:

 [SSL: UNSAFE_LEGACY_RENEGOTIATION_DISABLED] unsafe legacy renegotiation disabled


These types of errors occur due to outdated or buggy SSL proxies that mistakenly
enforce legacy `TLS renegotiation <https://www.ibm.com/docs/en/i/7.3?topic=settings-renegotiation>`__.

To resolve this issue, use the ``UnsafeLegacyServerConnect`` option with the
``OPENSSL_CONF`` environment variable. Create a configuration
file with the following content:

.. code-block:: shell

openssl_conf = openssl_init

[openssl_init]
ssl_conf = ssl_sect

[ssl_sect]
system_default = system_default_sect

[system_default_sect]
Options = UnsafeLegacyServerConnect

Then run Python using that OpenSSL config file:

.. code-block:: shell

OPENSSL_CONF=/path/to/the/config/file/above.cnf python ...

The ``UnsafeLegacyServerConnect`` option in ``OPENSSL_CONF`` requires OpenSSL v3.0.4
or greater.

.. warning::

This workaround should only be used as a last resort to address ``unsafe legacy
renegotiation disabled`` errors.
Loading