Guest User

Untitled

a guest
Sep 20th, 2016
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.01 KB | None | 0 0
  1. diff --git a/management/status_checks.py b/management/status_checks.py
  2. index 13cbab1..d9ce484 100755
  3. --- a/management/status_checks.py
  4. +++ b/management/status_checks.py
  5. @@ -472,7 +472,7 @@ def check_dns_zone(domain, env, output, dns_zonefiles):
  6. % (existing_ns, correct_ns) )
  7.  
  8. # Check that each custom secondary nameserver resolves the IP address.
  9. -
  10. +
  11. if custom_secondary_ns and not probably_external_dns:
  12. for ns in custom_secondary_ns:
  13. # We must first resolve the nameserver to an IP address so we can query it.
  14. @@ -680,7 +680,14 @@ def query_dns(qname, rtype, nxdomain='[Not Set]', at=None):
  15. # periods from responses since that's how qnames are encoded in DNS but is
  16. # confusing for us. The order of the answers doesn't matter, so sort so we
  17. # can compare to a well known order.
  18. - return "; ".join(sorted(str(r).rstrip('.') for r in response))
  19. + arr = []
  20. + for r in response:
  21. + s = r.to_text()
  22. + if isinstance(s, bytes):
  23. + s = s.decode('utf-8')
  24. + arr.append(s)
  25. +
  26. + return "; ".join(sorted(str(r).rstrip('.') for r in arr))
  27.  
  28. def check_ssl_cert(domain, rounded_time, ssl_certificates, env, output):
  29. # Check that TLS certificate is signed.
  30. @@ -897,7 +904,7 @@ class FileOutput:
  31. class ConsoleOutput(FileOutput):
  32. def __init__(self):
  33. self.buf = sys.stdout
  34. -
  35. +
  36. # Do nice line-wrapping according to the size of the terminal.
  37. # The 'stty' program queries standard input for terminal information.
  38. if sys.stdin.isatty():
  39.  
  40. diff --git a/management/ssl_certificates.py b/management/ssl_certificates.py
  41. index c49443b..8d2683e 100755
  42. --- a/management/ssl_certificates.py
  43. +++ b/management/ssl_certificates.py
  44. @@ -196,7 +196,7 @@ def get_certificates_to_provision(env, show_extended_problems=True, force_domain
  45. if cert.issuer == cert.subject:
  46. # This is self-signed. Get a real one.
  47. domains.add(domain)
  48. -
  49. +
  50. # Valid certificate today, but is it expiring soon?
  51. elif cert.not_valid_after-now < datetime.timedelta(days=14):
  52. domains.add(domain)
  53. @@ -238,7 +238,12 @@ def get_certificates_to_provision(env, show_extended_problems=True, force_domain
  54. except Exception as e:
  55. problems[domain] = "DNS isn't configured properly for this domain: DNS lookup had an error: %s." % str(e)
  56. return False
  57. - if len(response) != 1 or str(response[0]) != value:
  58. +
  59. + response_arr = [response[0]]
  60. + if isinstance(response[0].to_text(), bytes):
  61. + response_arr[0] = response[0].to_text().decode('utf-8')
  62. +
  63. + if len(response) != 1 or str(response_arr[0]) != value:
  64. problems[domain] = "Domain control validation cannot be performed for this domain because DNS points the domain to another machine (%s %s)." % (r
  65. return False
  66.  
  67. @@ -406,7 +411,7 @@ def provision_certificates_cmdline():
  68. headless = False
  69. force_domains = None
  70. show_extended_problems = True
  71. -
  72. +
  73. args = list(sys.argv)
  74. args.pop(0) # program name
  75. if args and args[0] == "-v":
  76. @@ -488,7 +493,7 @@ control panel.
  77.  
  78. Do you agree to the agreement? Type Y or N and press <ENTER>: """
  79. % request["url"], end='', flush=True)
  80. -
  81. +
  82. if sys.stdin.readline().strip().upper() != "Y":
  83. print("\nYou didn't agree. Quitting.")
  84. sys.exit(1)
Advertisement
Add Comment
Please, Sign In to add comment