diff options
author | boyska <piuttosto@logorroici.org> | 2016-12-20 21:44:11 +0300 |
---|---|---|
committer | Yann Leboulanger <asterix@lagaule.org> | 2017-02-25 23:44:58 +0300 |
commit | c444ff797a82ec4284e452698c9222b73556afd4 (patch) | |
tree | f724b48e1ffe759ea41928127ffa90add85e176b | |
parent | deede80f80217ed0f0a3951e96d5ba62eb834855 (diff) |
[plugin_installer] letsencrypt CA pinning
-rw-r--r-- | plugin_installer/DST_Root_CA_X3.pem | 20 | ||||
-rw-r--r-- | plugin_installer/plugin_installer.py | 9 |
2 files changed, 28 insertions, 1 deletions
diff --git a/plugin_installer/DST_Root_CA_X3.pem b/plugin_installer/DST_Root_CA_X3.pem new file mode 100644 index 0000000..b2e43c9 --- /dev/null +++ b/plugin_installer/DST_Root_CA_X3.pem @@ -0,0 +1,20 @@ +-----BEGIN CERTIFICATE----- +MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/ +MSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT +DkRTVCBSb290IENBIFgzMB4XDTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVow +PzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QgQ28uMRcwFQYDVQQD +Ew5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB +AN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmTrE4O +rz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEq +OLl5CjH9UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9b +xiqKqy69cK3FCxolkHRyxXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw +7BZy1SbsOFU5Q9D8/RhcQPGX69Wam40dutolucbY38EVAjqr2m7xPi71XAicPNaD +aeQQmxkqtilX4+U9m5/wAl0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNV +HQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMSnsaR7LHH62+FLkHX/xBVghYkQMA0GCSqG +SIb3DQEBBQUAA4IBAQCjGiybFwBcqR7uKGY3Or+Dxz9LwwmglSBd49lZRNI+DT69 +ikugdB/OEIKcdBodfpga3csTS7MgROSR6cz8faXbauX+5v3gTt23ADq1cEmv8uXr +AvHRAosZy5Q6XkjEGB5YGV8eAlrwDPGxrancWYaLbumR9YbK+rlmM6pZW87ipxZz +R8srzJmwN0jP41ZL9c8PDHIyh8bwRLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5 +JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubSfZGL+T0yjWW06XyxV3bqxbYo +Ob8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ +-----END CERTIFICATE----- diff --git a/plugin_installer/plugin_installer.py b/plugin_installer/plugin_installer.py index 7c1bcd2..ee36b3c 100644 --- a/plugin_installer/plugin_installer.py +++ b/plugin_installer/plugin_installer.py @@ -138,7 +138,14 @@ class PluginInstaller(GajimPlugin): location = posixpath.join(directory, fname) uri = urlparse.urljoin(server, location) log.debug('Fetching {}'.format(uri)) - request = urllib2.urlopen(uri) + ssl_args = {} + if 'cafile' in inspect.getargspec(urllib2.urlopen).args: + log.info('You are using HTTPS CA pinning, very good!') + ssl_args['cafile'] = self.local_file_path('DST_Root_CA_X3.pem') + else: + log.warning('Your python version does not support HTTPS CA pinning') + request = urllib2.urlopen(uri, **ssl_args) + manifest_buffer = io.BytesIO(request.read()) return manifest_buffer |