@@ -36,8 +36,8 @@ On Windows, the `wincertstore`_ module is required when using PyPy3 < 3.5.
3636.. _wincertstore : https://pypi.python.org/pypi/wincertstore
3737.. _certifi : https://pypi.python.org/pypi/certifi
3838
39- .. warning :: Industry best practices, and some regulations, require the use
40- of TLS 1.1 or newer. Though no application changes are required for
39+ .. warning :: Industry best practices recommend , and some regulations require,
40+ the use of TLS 1.1 or newer. Though no application changes are required for
4141 PyMongo to make use of the newest protocols, some operating systems or
4242 versions may not provide an OpenSSL version new enough to support them.
4343
@@ -165,3 +165,42 @@ to decrypt encrypted private keys. Use the `ssl_pem_passphrase` option::
165165
166166
167167These options can also be passed as part of the MongoDB URI.
168+
169+ Troubleshooting TLS Errors
170+ ..........................
171+
172+ TLS errors often fall into two categories, certificate verification failure or
173+ protocol version mismatch. An error message similar to the following means that
174+ OpenSSL was not able to verify the server's certificate::
175+
176+ [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed
177+
178+ This often occurs because OpenSSL does not have access to the system's
179+ root certificates or the certificates are out of date. Linux users should
180+ ensure that they have the latest root certificate updates installed from
181+ their Linux vendor. macOS users using Python 3.6.0 or newer downloaded
182+ from python.org `may have to run a script included with python
183+ <https://bugs.python.org/issue29065#msg283984> `_ to install
184+ root certificates::
185+
186+ open "/Applications/Python <YOUR PYTHON VERSION>/Install Certificates.command"
187+
188+ Users of older PyPy and PyPy3 portable versions may have to `set an environment
189+ variable <https://github.com/squeaky-pl/portable-pypy/issues/15> `_ to tell
190+ OpenSSL where to find root certificates. This is easily done using the `certifi
191+ module <https://pypi.org/project/certifi/> `_ from pypi::
192+
193+ $ pypy -m pip install certifi
194+ $ export SSL_CERT_FILE=$(pypy -c "import certifi; print(certifi.where())")
195+
196+ An error message similar to the following message means that the OpenSSL
197+ version used by Python does not support a new enough TLS protocol to connect
198+ to the server::
199+
200+ [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version
201+
202+ Industry best practices recommend, and some regulations require, that older
203+ TLS protocols be disabled in some MongoDB deployments. Some deployments may
204+ disable TLS 1.0, others may disable TLS 1.0 and TLS 1.1. See the warning
205+ earlier in this document for troubleshooting steps and solutions.
206+
0 commit comments