Merge pull request #55 from ecobytes/master
update SSL logic to accomodate pregenerated certificates
This commit is contained in:
@@ -11,16 +11,19 @@ class CertificateBackend(object):
|
|||||||
def __init__(self, config):
|
def __init__(self, config):
|
||||||
"""Set path to certificates."""
|
"""Set path to certificates."""
|
||||||
self.config = config
|
self.config = config
|
||||||
for base_dir in ["/etc/pki/tls", "/etc/ssl"]:
|
if not config.has_option("general", "tls_key_file"):
|
||||||
if os.path.exists(base_dir):
|
for base_dir in ["/etc/pki/tls", "/etc/ssl"]:
|
||||||
self.config.set(
|
if os.path.exists(base_dir):
|
||||||
"general", "tls_key_file",
|
self.config.set(
|
||||||
"{}/private/%(hostname)s.key".format(base_dir))
|
"general", "tls_key_file",
|
||||||
self.config.set(
|
"{}/private/%(hostname)s.key".format(base_dir))
|
||||||
"general", "tls_cert_file",
|
self.config.set(
|
||||||
"{}/certs/%(hostname)s.cert".format(base_dir))
|
"general", "tls_cert_file",
|
||||||
return
|
"{}/certs/%(hostname)s.cert".format(base_dir))
|
||||||
raise RuntimeError("Cannot find a directory to store certificate")
|
return
|
||||||
|
raise RuntimeError("Cannot find a directory to store certificate")
|
||||||
|
else:
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
class SelfSignedCertificate(CertificateBackend):
|
class SelfSignedCertificate(CertificateBackend):
|
||||||
|
|||||||
Reference in New Issue
Block a user