From 7e037663a1bd97702e27a656a539d18ed0b22b14 Mon Sep 17 00:00:00 2001 From: Pierre Jaury Date: Sun, 12 Feb 2017 16:58:58 +0100 Subject: [PATCH] Use relative path for certificates, fixes #35 (cherry picked from commit e6c18e6ac3803ffe6fcd2c418b44496dfccce4ce) --- admin/mailu/certbot.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/admin/mailu/certbot.py b/admin/mailu/certbot.py index 7b476a19..b58ea68a 100644 --- a/admin/mailu/certbot.py +++ b/admin/mailu/certbot.py @@ -28,15 +28,17 @@ def certbot_install(domain): path = app.config["CERTS_PATH"] cert = os.path.join(path, "cert.pem") key = os.path.join(path, "key.pem") - live_cert = os.path.join(path, "live", domain, "fullchain.pem") - live_key = os.path.join(path, "live", domain, "privkey.pem") + live_cert = os.path.join("live", domain, "fullchain.pem") + live_key = os.path.join("live", domain, "privkey.pem") if not os.path.islink(cert) or os.readlink(cert) != live_cert: must_reload = True - os.unlink(cert) + if os.path.exists(cert): + os.unlink(cert) os.symlink(live_cert, cert) if not os.path.islink(key) or os.readlink(key) != live_key: must_reload = True - os.unlink(key) + if os.path.exists(key): + os.unlink(key) os.symlink(live_key, key) return must_reload