Print more helpful error message when csc-verification record is missing

This commit is contained in:
Eric Li 2023-10-23 20:45:16 -04:00
parent 2aca16688d
commit de93ea744a
1 changed files with 5 additions and 1 deletions

View File

@ -111,9 +111,11 @@ class VHostManager:
rootname = tldextract.extract(domain).registered_domain
try:
records = dns.resolver.resolve(rootname, "TXT").rrset
records_text = []
for x in records:
records_text.append(x.to_text())
if record in x.to_text():
print(f"found correct`csc-verification` record at {rootname}")
print(f"found correct `csc-verification` record at {rootname}")
return True
except dns.resolver.NoAnswer as e:
@ -124,6 +126,8 @@ class VHostManager:
return False
print(f"cannot find a `csc-verification` record at {rootname}")
print(f"EXPECTED: \"{record}\"")
print(f"FOUND: \n" + '\n'.join(records_text))
return False # deny by default