-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Description
Description
Hello,
We don’t have direct Internet access in my company main network. But we have local pip repository.
Sadly pip on windows does not recognized the company certificates.
I was able to use pip with a ca-bundle.crt created with a very simple script:
import ssl
context = ssl.create_default_context()
der_certs = context.get_ca_certs(binary_form=True)
pem_certs = [ssl.DER_cert_to_PEM_cert(der) for der in der_certs]
with open('C:\Users\user\certs\ca-bundle.crt', 'w') as outfile:
for pem in pem_certs:
outfile.write(pem + '\n')
In _ssl.py file it’s written that is equivalent to ssl.create_default_context() but it’s not the case.
I was not able to change the _ssl.py file in order to have the expected behavior.
Regards
Michel
Expected behavior
pip should be able to use the windows certificates without any user action
pip version
21.3.1
Python version
3.6.6
OS
Windows 10 1909
How to Reproduce
add ini C:\Users\User\pip\pip.ini
[global]
index-url = htts://locarepo.company/pypi/simple
(you have to create a local server)
in Powershell
PS C:\Users\user\Documents\My Apps> & 'C:\Program Files\Python36\python.exe' -m pip install toto --user
result:
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(0, 'unknown error (_ssl.c:3630)'),)': /api/pypi/python_pypi/simple/toto/
Output
PS C:\Users\user\Documents\My Apps> & 'C:\Program Files\Python36\python.exe' -m pip install toto --user
Looking in indexes: https://repos.company/api/pypi/python_pypi/simple
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(0, 'unknown error (_ssl.c:3630)'),)': /api/pypi/python_pypi/simple/toto/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(0, 'unknown error (_ssl.c:3630)'),)': /api/pypi/python_pypi/simple/toto/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(0, 'unknown error (_ssl.c:3630)'),)': /api/pypi/python_pypi/simple/toto/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(0, 'unknown error (_ssl.c:3630)'),)': /api/pypi/python_pypi/simple/toto/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(0, 'unknown error (_ssl.c:3630)'),)': /api/pypi/python_pypi/simple/toto/
Could not fetch URL https:// repos.company/api/pypi/python_pypi/simple/toto/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host= 'repos.company', port=443): Max retries exceeded with url: /api/pypi/python_pypi/simple/toto/ (Caused by SSLError(SSLError(0, 'unknown error (_ssl.c:3630)'),)) - skipping
ERROR: Could not find a version that satisfies the requirement toto (from versions: none)
ERROR: No matching distribution found for totoCode of Conduct
- I agree to follow the PSF Code of Conduct.