From 5afb0ebd1c16442a2f94469ee3db4f27fc3a9852 Mon Sep 17 00:00:00 2001 From: Jakub Warmuz Date: Wed, 7 Oct 2015 19:42:32 +0000 Subject: [PATCH] Remove SimpleHTTP TLS from standalone 2.0 --- letsencrypt/configuration.py | 7 ++----- letsencrypt/plugins/standalone.py | 15 +++++---------- letsencrypt/plugins/standalone_test.py | 15 ++------------- letsencrypt/tests/configuration_test.py | 5 ----- 4 files changed, 9 insertions(+), 33 deletions(-) diff --git a/letsencrypt/configuration.py b/letsencrypt/configuration.py index 5f965cb6d..a2eab5ecb 100644 --- a/letsencrypt/configuration.py +++ b/letsencrypt/configuration.py @@ -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): diff --git a/letsencrypt/plugins/standalone.py b/letsencrypt/plugins/standalone.py index 551707263..97964e8cc 100644 --- a/letsencrypt/plugins/standalone.py +++ b/letsencrypt/plugins/standalone.py @@ -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, diff --git a/letsencrypt/plugins/standalone_test.py b/letsencrypt/plugins/standalone_test.py index a45935d2b..e99bd473a 100644 --- a/letsencrypt/plugins/standalone_test.py +++ b/letsencrypt/plugins/standalone_test.py @@ -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): diff --git a/letsencrypt/tests/configuration_test.py b/letsencrypt/tests/configuration_test.py index acf9273d0..c1eba8570 100644 --- a/letsencrypt/tests/configuration_test.py +++ b/letsencrypt/tests/configuration_test.py @@ -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."""