httplib2 ssl certificate verification issue when retrieving remote metadata
httplib2, by default, uses it's own certificate authority for verifying ssl certificates. If the certificate used, in my case a self-signed cert used while developing, is not verifiable by that certificate authority, you get an error.
Error received from httplib2:
SSLHandshakeError: [Errno 1] _ssl.c:503: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
Trace back puts the error here:
File "/home/phoenix/phoenix-deploy/lib/python2.7/site-packages/saml2/metadata.py", line 478, in import_external_metadata (response, content) = self.http.request(url)
Solution would seem to be the same as is being done in the one other place that httplib2 is being used for making requests internally which is in soap.py. Here HttpClient is calling httplib2.Http() with the options for an alternate ca_certs file or disable_ssl_certificate_validation.
The call for retrieving remote metadata should include the same options.
Serge Domkowski skrev 2012-08-30 19:09:
httplib2, by default, uses it's own certificate authority for verifying ssl certificates. If the certificate used, in my case a self-signed cert used while developing, is not verifiable by that certificate authority, you get an error.
Error received from httplib2:
SSLHandshakeError: [Errno 1] _ssl.c:503: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
Trace back puts the error here:
File "/home/phoenix/phoenix-deploy/lib/python2.7/site-packages/saml2/metadata.py", line 478, in import_external_metadata (response, content) = self.http.request(url)
Solution would seem to be the same as is being done in the one other place that httplib2 is being used for making requests internally which is in soap.py. Here HttpClient is calling httplib2.Http() with the options for an alternate ca_certs file or disable_ssl_certificate_validation.
The call for retrieving remote metadata should include the same options.
Sounds reasonable, will fix.
-- Roland
Updated code