Interview Prep/Networking/TLS and certificate errors

Python `requests` fails with `SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain`.

BeginnerTroubleshootingTLS and certificate errors
Answer

Likely causes → A corporate TLS-inspection proxy or a private CA. requests uses certifi's bundle, not the OS trust store.

Diagnose →

python -c "import certifi; print(certifi.where())"
openssl s_client -connect pypi.org:443 -servername pypi.org -showcerts </dev/null | grep 'i:'

Fix → Point at the right bundle: export REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt (after adding the corporate CA to the OS store), or install truststore/pip-system-certs. Never set verify=False in production.

Prevent → Bake the corporate CA into base images and set REQUESTS_CA_BUNDLE, NODE_EXTRA_CA_CERTS and the Java truststore in one place.

All Networking questions Roadmap: Networking for DevOps

More on TLS and certificate errors