Remove SimpleHTTP TLS from standalone 2.0

This commit is contained in:
Jakub Warmuz
2015-10-07 20:06:41 +00:00
parent 7102f9ef4b
commit 5afb0ebd1c
4 changed files with 9 additions and 33 deletions
+2 -5
View File
@@ -37,8 +37,7 @@ class NamespaceConfig(object):
self.namespace = namespace
# XXX: breaks renewer in some bizarre way
#if self.no_simple_http_tls and (
# self.simple_http_port == self.dvsni_port):
#if self.simple_http_port == self.dvsni_port:
# raise errors.Error(
# "Trying to run SimpleHTTP non-TLS and DVSNI "
# "on the same port ({0})".format(self.dvsni_port))
@@ -82,10 +81,8 @@ class NamespaceConfig(object):
def simple_http_port(self): # pylint: disable=missing-docstring
if self.namespace.simple_http_port is not None:
return self.namespace.simple_http_port
if self.no_simple_http_tls:
return challenges.SimpleHTTPResponse.PORT
else:
return challenges.SimpleHTTPResponse.TLS_PORT
return challenges.SimpleHTTPResponse.PORT
class RenewerConfiguration(object):
+5 -10
View File
@@ -5,7 +5,6 @@ import functools
import logging
import random
import socket
import sys
import threading
import OpenSSL
@@ -198,12 +197,7 @@ class Authenticator(common.Plugin):
def get_chall_pref(self, domain):
# pylint: disable=unused-argument,missing-docstring
supported_challenges = self.supported_challenges
if not self.config.no_simple_http_tls and not (
acme_standalone.ACMETLSServer.SIMPLE_HTTP_SUPPORT):
logger.debug("SimpleHTTPS not supported: %s", sys.version)
supported_challenges.discard(challenges.SimpleHTTP)
chall_pref = list(supported_challenges)
chall_pref = list(self.supported_challenges)
random.shuffle(chall_pref) # 50% for each challenge
return chall_pref
@@ -231,12 +225,13 @@ class Authenticator(common.Plugin):
def perform2(self, achalls):
"""Perform achallenges without IDisplay interaction."""
responses = []
tls = not self.config.no_simple_http_tls
for achall in achalls:
if isinstance(achall, achallenges.SimpleHTTP):
server = self.servers.run(self.config.simple_http_port, tls=tls)
response, validation = achall.gen_response_and_validation(tls=tls)
server = self.servers.run(
self.config.simple_http_port, tls=False)
response, validation = achall.gen_response_and_validation(
tls=False)
self.simple_http_resources.add(
acme_standalone.SimpleHTTPRequestHandler.SimpleHTTPResource(
chall=achall.chall, response=response,
+2 -13
View File
@@ -107,20 +107,9 @@ class AuthenticatorTest(unittest.TestCase):
self.assertRaises(errors.MisconfigurationError, self.auth.prepare)
mock_util.already_listening.assert_called_once_with(1234)
@mock.patch("letsencrypt.plugins.standalone.acme_standalone")
def test_get_chall_pref_tls_supported(self, mock_astandalone):
mock_astandalone.ACMETLSServer.SIMPLE_HTTP_SUPPORT = True
for no_simple_http_tls in True, False:
self.config.no_simple_http_tls = no_simple_http_tls
self.assertEqual(set(self.auth.get_chall_pref(domain=None)),
set([challenges.DVSNI, challenges.SimpleHTTP]))
@mock.patch("letsencrypt.plugins.standalone.acme_standalone")
def test_get_chall_pref_simple_tls_not_supported(self, mock_astandalone):
mock_astandalone.ACMETLSServer.SIMPLE_HTTP_SUPPORT = False
self.config.no_simple_http_tls = False
def test_get_chall_pref(self):
self.assertEqual(set(self.auth.get_chall_pref(domain=None)),
set([challenges.DVSNI]))
set([challenges.DVSNI, challenges.SimpleHTTP]))
@mock.patch("letsencrypt.plugins.standalone.zope.component.getUtility")
def test_perform(self, unused_mock_get_utility):
-5
View File
@@ -49,14 +49,9 @@ class NamespaceConfigTest(unittest.TestCase):
def test_simple_http_port(self):
self.assertEqual(4321, self.config.simple_http_port)
self.namespace.simple_http_port = None
self.namespace.no_simple_http_tls = True
self.assertEqual(80, self.config.simple_http_port)
self.namespace.no_simple_http_tls = False
self.assertEqual(443, self.config.simple_http_port)
class RenewerConfigurationTest(unittest.TestCase):
"""Test for letsencrypt.configuration.RenewerConfiguration."""