Skip to content

Commit

Permalink
fix: set acme_account_url even if some DNS records are not set
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
link2xt committed Oct 15, 2024
1 parent 7573ef9 commit a2f2e04
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmdeploy/src/cmdeploy/remote/rdns.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand Down

0 comments on commit a2f2e04

Please # to comment.