python-httplib2/ca_certs_locater.py

23 lines
726 B
Python
Raw Normal View History

#
# httplib2 system SSL certificate bundle locator for openSUSE / SLES.
# openSUSE has /etc/ssl/ca-bundle.pem (from package ca-certificates) but on
# SLES, it's only individual files (from openssl-certs)
#
# Author: Sascha Peilicke <speilicke@suse.com>
#
def get():
for line in open("/etc/SuSE-release"):
if "SUSE Linux Enterprise Server" in line:
# Python-2.x doesn't support loading from a directory containing
# PEM files, thus we have to use a bundle created by hand (and
# refreshed with updates of either httpli2 or openssl-certs).
return "ca-bundle.pem"
else:
return "/etc/ssl/ca-bundle.pem"
if __name__ == "__main__":
print get()