@@ -122,4 +122,67 @@ following steps:
122
122
123
123
- Downgrade Python to v3.9 or earlier
124
124
- Upgrade {+mdb-server+} to v4.2 or later
125
- - Install {+driver-short+} with the :ref: `OCSP <pymongo-disable-ocsp >` option, which relies on PyOpenSSL
125
+ - Install {+driver-short+} with the :ref: `OCSP <pymongo-disable-ocsp >` option, which relies on PyOpenSSL
126
+
127
+ Unsafe Legacy Renegotiation Disabled
128
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
129
+
130
+ When using OpenSSL v3 or later, you might see an error similar to the following
131
+ message:
132
+
133
+ .. code-block :: python
134
+
135
+ [SSL : UNSAFE_LEGACY_RENEGOTIATION_DISABLED ] unsafe legacy renegotiation disabled
136
+
137
+ These types of errors occur because of outdated or buggy SSL proxies that mistakenly
138
+ enforce legacy `TLS renegotiation <https://www.ibm.com/docs/en/i/7.3?topic=settings-renegotiation >`__.
139
+
140
+ To resolve this issue, perform the following steps:
141
+
142
+ .. procedure ::
143
+ :style: normal
144
+
145
+ .. step :: Check OpenSSL Version
146
+
147
+ Run the following command to ensure that you have OpenSSL vv3.0.4 or
148
+ later installed:
149
+
150
+ .. code-block :: bash
151
+
152
+ openssl version
153
+
154
+ .. step :: Use the ``UnsafeLegacyServerConnect`` Option
155
+
156
+ Create a configuration file that includes the
157
+ ``UnsafeLegacyServerConnect `` option. The following example shows how to set
158
+ the ``UnsafeLegacyServerConnect `` option:
159
+
160
+ .. code-block :: shell
161
+ :emphasize-lines: 10
162
+
163
+ openssl_conf = openssl_init
164
+
165
+ [openssl_init]
166
+ ssl_conf = ssl_sect
167
+
168
+ [ssl_sect]
169
+ system_default = system_default_sect
170
+
171
+ [system_default_sect]
172
+ Options = UnsafeLegacyServerConnect
173
+
174
+ .. step :: Run Python with OpenSSL Configuration
175
+
176
+ Run Python while setting the ``OPENSSL_CONF `` environment variable to use
177
+ the OpenSSL configuration file you just created:
178
+
179
+ .. code-block :: shell
180
+
181
+ OPENSSL_CONF=/path/to/the/config/file/above.cnf python ...
182
+
183
+ .. important ::
184
+
185
+ Because setting the ``UnsafeLegacyServerConnect `` option has
186
+ `security implications <https://docs.openssl.org/3.0/man3/SSL_CTX_set_options/#patched-openssl-client-and-unpatched-server >`__,
187
+ use this workaround as a last
188
+ resort to address ``unsafe legacy renegotiation disabled `` errors.
0 commit comments