update SSL logic to accomodate pregenerated certificates
The @ecobytes instance showed a misbehaviour concerning TLS certificates which had been set in instance.cfg. Ultimately 89cdc314ea9ad93d7951d1800e525f85ec47eaac#diff-c226f84131b50059e044a64c41fe782c added a logic which would not account for preconfigured TLS certificates anymore. This commit introduces a small change to revive usage of third-party certificates without overwriting their configuration options.
This commit is contained in:
@@ -11,6 +11,7 @@ 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
|
||||||
|
if not config.has_option("general", "tls_key_file"):
|
||||||
for base_dir in ["/etc/pki/tls", "/etc/ssl"]:
|
for base_dir in ["/etc/pki/tls", "/etc/ssl"]:
|
||||||
if os.path.exists(base_dir):
|
if os.path.exists(base_dir):
|
||||||
self.config.set(
|
self.config.set(
|
||||||
@@ -21,6 +22,8 @@ class CertificateBackend(object):
|
|||||||
"{}/certs/%(hostname)s.cert".format(base_dir))
|
"{}/certs/%(hostname)s.cert".format(base_dir))
|
||||||
return
|
return
|
||||||
raise RuntimeError("Cannot find a directory to store certificate")
|
raise RuntimeError("Cannot find a directory to store certificate")
|
||||||
|
else:
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
class SelfSignedCertificate(CertificateBackend):
|
class SelfSignedCertificate(CertificateBackend):
|
||||||
|
|||||||
Reference in New Issue
Block a user