Commit d1f82711 authored by Adrien Dorsaz's avatar Adrien Dorsaz

acme_dns_tiny: fix use of join() string function to create final certificate chain

parent 07b48645
Pipeline #134 failed with stage
in 2 minutes and 19 seconds
......@@ -240,7 +240,7 @@ def get_crt(config, log=LOGGER):
})
if code != 201:
raise ValueError("Error signing certificate: {0} {1}".format(code, result))
certificate = "{0}{1}".format(os.linesep, textwrap.wrap(base64.b64encode(result).decode("utf8"), 64))
certificate = os.linesep.join(textwrap.wrap(base64.b64encode(result).decode("utf8"), 64))
# get the parent certificate which had created this one
certificate_parent_url = _get_url_link(headers, 'up')
......@@ -248,11 +248,13 @@ def get_crt(config, log=LOGGER):
if resp.getcode() not in [200, 201]:
raise ValueError("Error getting certificate chain from {0}: {1} {2}".format(
certificate_parent_url, code, resp.read()))
intermediary_certificate = "{0}{1}".format(os.linesep, textwrap.wrap(base64.b64encode(resp.read()).decode("utf8"), 64))
intermediary_certificate = os.linesep.join(textwrap.wrap(base64.b64encode(resp.read()).decode("utf8"), 64))
chainlist = ["-----BEGIN CERTIFICATE-----{0}{1}{0}-----END CERTIFICATE-----{0}".format(
os.linesep, cert) for cert in [certificate, intermediary_certificate]]
log.info("Certificate signed and received.")
return "".join("-----BEGIN CERTIFICATE-----{0}{1}{0}-----END CERTIFICATE-----{0}".format(
os.linesep, cert) for cert in [certificate, intermediary_certificate])
return "".join(chainlist)
def main(argv):
parser = argparse.ArgumentParser(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment