mirror of
https://github.com/simple-login/app.git
synced 2025-02-25 00:03:03 +08:00
fix DKIM cname check
This commit is contained in:
parent
9991723f5e
commit
4ca6b02047
2 changed files with 4 additions and 3 deletions
|
@ -74,7 +74,7 @@ def domain_detail_dns(custom_domain_id):
|
|||
spf_errors = get_txt_record(custom_domain.domain)
|
||||
|
||||
elif request.form.get("form-name") == "check-dkim":
|
||||
dkim_record = get_cname_record(custom_domain.domain)
|
||||
dkim_record = get_cname_record("dkim._domainkey." + custom_domain.domain)
|
||||
if dkim_record == dkim_cname:
|
||||
flash("DKIM is setup correctly.", "success")
|
||||
custom_domain.dkim_verified = True
|
||||
|
|
|
@ -13,14 +13,15 @@ def _get_dns_resolver():
|
|||
|
||||
|
||||
def get_cname_record(hostname) -> Optional[str]:
|
||||
"""Return the CNAME record if exists for a domain"""
|
||||
"""Return the CNAME record if exists for a domain, WITHOUT the trailing period at the end"""
|
||||
try:
|
||||
answers = _get_dns_resolver().query(hostname, "CNAME")
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
for a in answers:
|
||||
return a
|
||||
ret = a.to_text()
|
||||
return ret[:-1]
|
||||
|
||||
return None
|
||||
|
||||
|
|
Loading…
Reference in a new issue