encode to bytes as necessary in Validator.certificate (#4026)

This commit is contained in:
Brad Warren
2017-01-17 12:13:10 -08:00
committed by GitHub
parent 7f3109f185
commit 16ed5bdd47
2 changed files with 11 additions and 1 deletions
@@ -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:
+1
View File
@@ -9,6 +9,7 @@ version = '0.11.0.dev0'
install_requires = [
'certbot',
'certbot-apache',
'six',
'requests',
'zope.interface',
]