question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

setuptools fails in corporate MITM proxy with intermediate SSL cacerts

See original GitHub issue

I was looking at the following piece of code in package_index.py:

        use_ssl = (
            verify_ssl
            and ssl_support.is_available
            and (ca_bundle or ssl_support.find_ca_bundle())
        )
        if use_ssl:
            self.opener = ssl_support.opener_for(ca_bundle)

I have added/appened the corporate CA certificates to /etc/ssl/cert.pem but setuptools never actually picks it up or uses it. Did anyone ever solve this?

FYI I am on a MacOS and using Anaconda with Python 3.6

Error that I get:

Download error on https://pypi.org/simple/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833) -- Some packages may not be found!
No local packages or working download links found for textacy
error: Could not find suitable distribution for Requirement.parse('textacy')

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
bclodiuscommented, Oct 9, 2019

@eholic thanks worked like a charm! In my case to make it more “portable” I used

import os
import setuptools.ssl_support
setuptools.ssl_support.cert_paths = [os.environ.get('SSL_CERT_FILE')]

Note to others: I had to use full path /home/<some_path> and not relative path for home directory ~.

1reaction
eholiccommented, Oct 9, 2019

Temporal solution of https://github.com/pypa/setuptools/issues/1543, https://github.com/pypa/setuptools/pull/1821 is overwriting cert_paths in setup.py.

from setuptools import setup
import setuptools.ssl_support
setuptools.ssl_support.cert_paths = ['/path/to/cafile']

setup()

https://github.com/pypa/setuptools/blob/17ad2b72ed29c91fd32e939abf3625314fe7c4ed/setuptools/ssl_support.py#L21

Read more comments on GitHub >

github_iconTop Results From Across the Web

Certificates - mitmproxy docs
Quick Setup. By far the easiest way to install the mitmproxy CA certificate is to use the built-in certificate installation app. To do...
Read more >
pip always fails ssl verification - Stack Overflow
Please ensure your firewall/proxy allows access to/from: pypi.org; files.pythonhosted.org. So you could give a try to something like: $ python - ...
Read more >
HTTPS Certificates - pip documentation v22.3.1
This error means that OpenSSL wasn't able to find a trust anchor to verify the chain against. Using system trust stores instead of...
Read more >
How to Man in the Middle HTTPS Using mitmproxy - Earthly Blog
We are trying to man in the middle our own requests. To help overcome this, mitmproxy has generated a certificate. All we need...
Read more >
Installing SSL Security Certificates for Simplicity Studio Updates
Normally this is done by installing a company signed Root certificate onto ... If there is a man in the middle certificate then...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found