diff options
author | Brad Warren <bmw@users.noreply.github.com> | 2017-01-17 23:13:10 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-17 23:13:10 +0300 |
commit | 16ed5bdd47ddfa581d24a063bab400af91f65c40 (patch) | |
tree | 99efcd333bbc3c32c912d7d25ffe22e6549b5087 /certbot-compatibility-test | |
parent | 7f3109f185704ff0547c39b38b256a50f90527c0 (diff) |
encode to bytes as necessary in Validator.certificate (#4026)
Diffstat (limited to 'certbot-compatibility-test')
-rw-r--r-- | certbot-compatibility-test/certbot_compatibility_test/validator.py | 11 | ||||
-rw-r--r-- | certbot-compatibility-test/setup.py | 1 |
2 files changed, 11 insertions, 1 deletions
diff --git a/certbot-compatibility-test/certbot_compatibility_test/validator.py b/certbot-compatibility-test/certbot_compatibility_test/validator.py index 333b47296..62dd466a1 100644 --- a/certbot-compatibility-test/certbot_compatibility_test/validator.py +++ b/certbot-compatibility-test/certbot_compatibility_test/validator.py @@ -4,6 +4,8 @@ import socket import requests import zope.interface +import six + from acme import crypto_util from acme import errors as acme_errors from certbot import interfaces @@ -19,7 +21,14 @@ class Validator(object): def certificate(self, cert, name, alt_host=None, port=443): """Verifies the certificate presented at name is cert""" - host = alt_host if alt_host else socket.gethostbyname(name) + if alt_host is None: + host = socket.gethostbyname(name) + elif isinstance(alt_host, six.binary_type): + host = alt_host + else: + host = alt_host.encode() + name = name if isinstance(name, six.binary_type) else name.encode() + try: presented_cert = crypto_util.probe_sni(name, host, port) except acme_errors.Error as error: diff --git a/certbot-compatibility-test/setup.py b/certbot-compatibility-test/setup.py index fa49d9f3d..e515ede7b 100644 --- a/certbot-compatibility-test/setup.py +++ b/certbot-compatibility-test/setup.py @@ -9,6 +9,7 @@ version = '0.11.0.dev0' install_requires = [ 'certbot', 'certbot-apache', + 'six', 'requests', 'zope.interface', ] |