Spotter-VM/lxc-apps/ckan/ckan-datapusher.image.d/bin/add-ca-cert

14 lines
413 B
Python
Executable File

#!/usr/bin/python
import ssl
with open('/etc/ckan-datapusher/add-ca-cert.env') as f:
env = dict(tuple(line.split('=')) for line in f.read().splitlines())
cert = ssl.get_server_certificate((env['HOST'], env['PORT']))
with open('/usr/lib/python2.7/site-packages/requests/cacert.pem', 'a') as f:
f.write(cert)
with open('/usr/lib/python2.7/site-packages/certifi/cacert.pem', 'a') as f:
f.write(cert)