Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading