Skip to content

Commit

Permalink
DNS: recommend DKIM record without space in between for some DNS web …
Browse files Browse the repository at this point in the history
…interfaces
  • Loading branch information
missytake committed Jan 7, 2025
1 parent 5b8de76 commit 80c5651
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions cmdeploy/src/cmdeploy/dns.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ def check_full_zone(sshexec, remote_data, out, zonefile) -> int:
out(line)
out("")
returncode = 1
if remote_data.get("dkim_entry") in required_diff:
out("If the DKIM entry above does not work with your DNS provider, you can try this one:\n")
out(remote_data.get("web_dkim_entry") + "\n")
if recommended_diff:
out("WARNING: these recommended DNS entries are not set:\n")
for line in recommended_diff:
Expand Down
8 changes: 6 additions & 2 deletions cmdeploy/src/cmdeploy/remote/rdns.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def perform_initial_checks(mail_domain):

res = dict(mail_domain=mail_domain, A=A, AAAA=AAAA, MTA_STS=MTA_STS, WWW=WWW)
res["acme_account_url"] = shell("acmetool account-url", fail_ok=True)
res["dkim_entry"] = get_dkim_entry(mail_domain, dkim_selector="opendkim")
res["dkim_entry"], res["web_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
Expand All @@ -48,7 +48,11 @@ def get_dkim_entry(mail_domain, dkim_selector):
return
dkim_value_raw = f"v=DKIM1;k=rsa;p={dkim_pubkey};s=email;t=s"
dkim_value = '" "'.join(re.findall(".{1,255}", dkim_value_raw))
return f'{dkim_selector}._domainkey.{mail_domain}. TXT "{dkim_value}"'
web_dkim_value = ''.join(re.findall(".{1,255}", dkim_value_raw))
return (
f'{dkim_selector}._domainkey.{mail_domain}. TXT "{dkim_value}"',
f'{dkim_selector}._domainkey.{mail_domain}. TXT "{web_dkim_value}"',
)


def query_dns(typ, domain):
Expand Down

0 comments on commit 80c5651

Please sign in to comment.