DNS: recommend DKIM record without space in between for some DNS web interfaces

This commit is contained in:
missytake
2025-01-07 18:35:14 +01:00
parent c3190dd51a
commit 9c08cbfbec
2 changed files with 9 additions and 2 deletions

View File

@@ -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:

View File

@@ -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
@@ -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):