From a2f2e04ff9f64b4d5861d3260875a2859550e106 Mon Sep 17 00:00:00 2001 From: link2xt Date: Tue, 15 Oct 2024 14:36:41 +0000 Subject: [PATCH] fix: set acme_account_url even if some DNS records are not set perform_initial_checks may exit early and not add `acme_account_url` if required DNS records are not found. In this case other `cmdeploy run` fails with KeyError. To avoid this, `acme_account_url` should always be set. Unlike DNS checks, running acmetool may not fail due to network errors, so it is more reliable and should be checked first. --- cmdeploy/src/cmdeploy/remote/rdns.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmdeploy/src/cmdeploy/remote/rdns.py b/cmdeploy/src/cmdeploy/remote/rdns.py index 3c9bdabb..d378990a 100644 --- a/cmdeploy/src/cmdeploy/remote/rdns.py +++ b/cmdeploy/src/cmdeploy/remote/rdns.py @@ -27,12 +27,12 @@ def perform_initial_checks(mail_domain): WWW = query_dns("CNAME", f"www.{mail_domain}") res = dict(mail_domain=mail_domain, A=A, AAAA=AAAA, MTA_STS=MTA_STS, WWW=WWW) - if not MTA_STS or not WWW or (not A and not AAAA): - return res - res["acme_account_url"] = shell("acmetool account-url", fail_ok=True) res["dkim_entry"] = get_dkim_entry(mail_domain, dkim_selector="opendkim") + if not MTA_STS or not WWW or (not A and not AAAA): + return res + # parse out sts-id if exists, example: "v=STSv1; id=2090123" parts = query_dns("TXT", f"_mta-sts.{mail_domain}").split("id=") res["sts_id"] = parts[1].rstrip('"') if len(parts) == 2 else ""