This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author christian.heimes
Recipients alex, christian.heimes, dstufft, giampaolo.rodola, hynek, janssen, ncoghlan, pitrou
Date 2014-09-20.10:35:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1411209339.34.0.91149685596.issue22449@psf.upfronthosting.co.za>
In-reply-to
Content
The behavior of SSLContext.load_verify_locations is rather inconsistent across platforms:

On most POSIX platforms (Linux, BSD, non-Apple builds of OpenSSL) it loads certificates from predefined locations. The locations are defined during compile time and usually differ between vendors and platforms. My WiP "Improve TLS/SSL support" PEP lists all common locations and the packages that offer the certs. On these platforms SSL_CERT_DIR and SSL_CERT_FILE overwrite the location.

On Windows SSL_CERT_DIR and SSL_CERT_FILE are never taken into account by SSLContext.load_verify_locations because it doesn't call SSLContext.set_default_verify_paths(). The attached patch is a semi-fix for the problem. With the patch certs from SSL_CERT_DIR and SSL_CERT_FILE are only *added* to trusted root CA certs. The certs from Windows' cert store 'CA' and 'ROOT' are still loaded.

On OSX with Apple's custom build of OpenSSL SSL_CERT_DIR and SSL_CERT_FILE take effect. But there is a twist! In case a root CA cert is not found Apple's Trust Evaluation Agent (TEA) kicks in and looks up certs from Apple's keychain. It's almost the same situation as on Windows but more magical. In order to disable TEA one has to set the env var OPENSSL_X509_TEA_DISABLE=1 *before* the first cert is validated. After that the env var has no effect as the value is cached. Hynek has documted it in his blog: https://hynek.me/articles/apple-openssl-verification-surprises/
History
Date User Action Args
2014-09-20 10:35:39christian.heimessetrecipients: + christian.heimes, ncoghlan, janssen, pitrou, giampaolo.rodola, alex, hynek, dstufft
2014-09-20 10:35:39christian.heimessetmessageid: <1411209339.34.0.91149685596.issue22449@psf.upfronthosting.co.za>
2014-09-20 10:35:39christian.heimeslinkissue22449 messages
2014-09-20 10:35:38christian.heimescreate