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