1
0
mirror of https://github.com/moepman/acertmgr.git synced 2024-11-13 06:45:24 +01:00

Add checks for errors during certificate creation

This commit is contained in:
David Klaftenegger 2016-01-11 21:38:09 +01:00 committed by Markus Hauschild
parent d2a47fbd6a
commit a614df5d3a

View File

@ -80,12 +80,16 @@ def cert_get(domain, settings):
raise FileExistsError("A temporary file already exists!")
cr = subprocess.check_output(['openssl', 'req', '-new', '-sha256', '-key', key_file, '-out', csr_file, '-subj', '/CN=%s' % domain])
try:
cr = subprocess.check_output(['openssl', 'req', '-new', '-sha256', '-key', key_file, '-out', csr_file, '-subj', '/CN=%s' % domain])
# get certificate
crt = acme_tiny.get_crt(acc_file, csr_file, CHALLENGE_DIR, CA = LE_CA)
with open(crt_file, "w") as crt_fd:
crt_fd.write(crt)
# get certificate
crt = acme_tiny.get_crt(acc_file, csr_file, CHALLENGE_DIR, CA = LE_CA)
with open(crt_file, "w") as crt_fd:
crt_fd.write(crt)
except Exception:
os.remove(csr_file)
raise
# TODO check if resulting certificate is valid