From 226f14e8c6a0edd9173ee50b0b0560d43e656fad Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Thu, 19 Nov 2020 01:24:15 +0100 Subject: [PATCH] #1786 only allow one letsencrypt subscription at a time (#1787) --- .../config.scripts/blitz.subscriptions.letsencrypt.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/home.admin/config.scripts/blitz.subscriptions.letsencrypt.py b/home.admin/config.scripts/blitz.subscriptions.letsencrypt.py index 6f9a4380c..d5c8b13ee 100755 --- a/home.admin/config.scripts/blitz.subscriptions.letsencrypt.py +++ b/home.admin/config.scripts/blitz.subscriptions.letsencrypt.py @@ -208,6 +208,15 @@ def dynu_update(domain, token, ip): ##################### def subscriptions_new(ip, dnsservice, domain, token, target): + + # check if already one subscrption exists (limit to just one) + # https://github.com/rootzoll/raspiblitz/issues/1786 + if Path(SUBSCRIPTIONS_FILE).is_file(): + subs = toml.load(SUBSCRIPTIONS_FILE) + if "subscriptions_letsencrypt" in subs: + if len(subs['subscriptions_letsencrypt']) > 0: + raise BlitzError("not more than one letsencrypt subscription", "cancel existing letsencrypt first") + # domain needs to be the full domain name if domain.find(".") == -1: raise BlitzError("not a fully qualified domain name", domain)