Skip to content

Commit 4868e92

Browse files
authored
Merge pull request #11151 from sethmlarson/truststore-user-guide
Add section on 'truststore' feature to User Guide
2 parents ae324d1 + 5565717 commit 4868e92

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed

docs/html/user_guide.rst

+77
Original file line numberDiff line numberDiff line change
@@ -1137,3 +1137,80 @@ announcements on the `low-traffic packaging announcements list`_ and
11371137
.. _our survey on upgrades that create conflicts: https://docs.google.com/forms/d/e/1FAIpQLSeBkbhuIlSofXqCyhi3kGkLmtrpPOEBwr6iJA6SzHdxWKfqdA/viewform
11381138
.. _the official Python blog: https://blog.python.org/
11391139
.. _Python Windows launcher: https://docs.python.org/3/using/windows.html#launcher
1140+
1141+
Using system trust stores for verifying HTTPS
1142+
=============================================
1143+
1144+
pip 22.2 added **experimental** support for using system trust stores to verify HTTPS certificates
1145+
instead of certifi. Using system trust stores has advantages over certifi like automatically supporting
1146+
corporate proxy certificates without additional configuration.
1147+
1148+
In order to use system trust stores you must be using Python 3.10+ and install the package `truststore`_ from PyPI.
1149+
1150+
.. tab:: Unix/macOS
1151+
1152+
.. code-block:: console
1153+
1154+
# Requires Python 3.10 or later
1155+
$ python --version
1156+
Python 3.10.4
1157+
1158+
# Install the 'truststore' package from PyPI
1159+
$ python -m pip install truststore
1160+
[...]
1161+
1162+
# Use '--use-feature=truststore' flag to enable
1163+
$ python -m pip install SomePackage --use-feature=truststore
1164+
[...]
1165+
Successfully installed SomePackage
1166+
1167+
.. tab:: Windows
1168+
1169+
.. code-block:: console
1170+
1171+
# Requires Python 3.10 or later
1172+
C:\> py --version
1173+
Python 3.10.4
1174+
1175+
# Install the 'truststore' package from PyPI
1176+
C:\> py -m pip install truststore
1177+
[...]
1178+
1179+
# Use '--use-feature=truststore' flag to enable
1180+
C:\> py -m pip install SomePackage --use-feature=truststore
1181+
[...]
1182+
Successfully installed SomePackage
1183+
1184+
When to use system trust stores
1185+
-------------------------------
1186+
1187+
You should try using system trust stores when there is a custom certificate chain configured for your
1188+
system that pip isn't aware of. Typically this situation will manifest with an ``SSLCertVerificationError``
1189+
with the message "certificate verify failed: unable to get local issuer certificate":
1190+
1191+
.. code-block:: console
1192+
1193+
$ python -m pip install -U SomePackage
1194+
1195+
[...]
1196+
1197+
Could not fetch URL https://pypi.org/simple/SomePackage/:
1198+
There was a problem confirming the ssl certificate:
1199+
1200+
[...]
1201+
1202+
(Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED]
1203+
certificate verify failed: unable to get local issuer certificate (_ssl.c:997)'))) - skipping
1204+
1205+
This error means that OpenSSL wasn't able to find a trust anchor to verify the chain against.
1206+
Using system trust stores instead of certifi will likely solve this issue.
1207+
1208+
Follow up
1209+
---------
1210+
1211+
If you encounter a TLS/SSL error when using the ``truststore`` feature you should open an issue
1212+
on the `truststore GitHub issue tracker`_ instead of pip's issue tracker. The maintainers of truststore
1213+
will help diagnose and fix the issue.
1214+
1215+
.. _truststore: https://truststore.readthedocs.io
1216+
.. _truststore GitHub issue tracker: https://github.com/sethmlarson/truststore/issues

0 commit comments

Comments
 (0)