From bd8b672e753a9af5b4180a11da292eb1221f4987 Mon Sep 17 00:00:00 2001 From: Markus Hauschild Date: Tue, 12 Jan 2016 17:33:20 +0100 Subject: [PATCH] Use challenge dir from configuration --- acertmgr.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/acertmgr.py b/acertmgr.py index e257bdf..70207d1 100755 --- a/acertmgr.py +++ b/acertmgr.py @@ -18,7 +18,6 @@ import yaml ACME_DIR="/etc/acme/" ACME_CONF=ACME_DIR + "acme.conf" ACME_CONFD=ACME_DIR + "domains.d/" -CHALLENGE_DIR="/var/www/acme/" LE_CA="https://acme-staging.api.letsencrypt.org" @@ -79,12 +78,15 @@ def cert_get(domain, settings): if os.path.lexists(csr_file) or os.path.lexists(crt_file): raise FileExistsError("A temporary file already exists!") + challenge_dir = settings.get("webdir", "/var/www/acme-challenge/") + if not os.path.isdir(challenge_dir): + raise FileNotFoundError("Challenge directory (%s) does not exist!" % challenge_dir) 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) + 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: