1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2025-04-21 03:02:09 +00:00
This commit is contained in:
George T. Gougoudis 2016-09-23 03:43:17 +00:00 committed by GitHub
commit 1d7b01985b
2 changed files with 24 additions and 3 deletions

View File

@ -238,8 +238,22 @@ def get_certificates_to_provision(env, show_extended_problems=True, force_domain
except Exception as e: except Exception as e:
problems[domain] = "DNS isn't configured properly for this domain: DNS lookup had an error: %s." % str(e) problems[domain] = "DNS isn't configured properly for this domain: DNS lookup had an error: %s." % str(e)
return False return False
if len(response) != 1 or str(response[0]) != value:
problems[domain] = "Domain control validation cannot be performed for this domain because DNS points the domain to another machine (%s %s)." % (rtype, ", ".join(str(r) for r in response)) if len(response) == 1:
try:
response_str = str(response[0])
except TypeError:
response_str = response[0].to_text().decode('utf8')
if len(response) != 1 or response_str != value:
addresses = list()
for r in response:
try:
addresses.append(str(r).rstrip('.'))
except TypeError:
addresses.append(r.to_text().decode('utf8').rstrip('.'))
err_txt = ", ".join(sorted(addresses))
problems[domain] = "Domain control validation cannot be performed for this domain because DNS points the domain to another machine (%s %s)." % (rtype, err_txt)
return False return False
return True return True

View File

@ -680,7 +680,14 @@ def query_dns(qname, rtype, nxdomain='[Not Set]', at=None):
# periods from responses since that's how qnames are encoded in DNS but is # periods from responses since that's how qnames are encoded in DNS but is
# confusing for us. The order of the answers doesn't matter, so sort so we # confusing for us. The order of the answers doesn't matter, so sort so we
# can compare to a well known order. # can compare to a well known order.
return "; ".join(sorted(str(r).rstrip('.') for r in response)) addresses = list()
for r in response:
try:
addresses.append(str(r).rstrip('.'))
except TypeError:
addresses.append(r.to_text().decode('utf8').rstrip('.'))
return "; ".join(sorted(addresses))
def check_ssl_cert(domain, rounded_time, ssl_certificates, env, output): def check_ssl_cert(domain, rounded_time, ssl_certificates, env, output):
# Check that TLS certificate is signed. # Check that TLS certificate is signed.