From a385086e2eca0110db0793b64be55eb6dbd1aa2c Mon Sep 17 00:00:00 2001 From: Noah Swartz Date: Wed, 21 Oct 2015 18:02:26 -0700 Subject: [PATCH 1/8] Fixed nits with plugin choice --- letsencrypt/display/ops.py | 2 +- letsencrypt/plugins/manual.py | 10 +++++----- letsencrypt/plugins/standalone.py | 16 ++++++---------- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/letsencrypt/display/ops.py b/letsencrypt/display/ops.py index 37ce66b62..c21b07c03 100644 --- a/letsencrypt/display/ops.py +++ b/letsencrypt/display/ops.py @@ -74,7 +74,7 @@ def pick_plugin(config, default, plugins, question, ifaces): if len(prepared) > 1: logger.debug("Multiple candidate plugins: %s", prepared) - plugin_ep = choose_plugin(prepared.values(), question) + plugin_ep = choose_plugin(prepared.values()[::-1], question) if plugin_ep is None: return None else: diff --git a/letsencrypt/plugins/manual.py b/letsencrypt/plugins/manual.py index f7717064b..26724580c 100644 --- a/letsencrypt/plugins/manual.py +++ b/letsencrypt/plugins/manual.py @@ -32,7 +32,7 @@ class Authenticator(common.Plugin): zope.interface.implements(interfaces.IAuthenticator) zope.interface.classProvides(interfaces.IPluginFactory) - description = "Manual Authenticator" + description = "Manually Edit Your Configuration" MESSAGE_TEMPLATE = """\ Make sure your web server displays the following content at @@ -82,10 +82,10 @@ s.serve_forever()" """ def more_info(self): # pylint: disable=missing-docstring,no-self-use return """\ This plugin requires user's manual intervention in setting up a HTTP -server for solving SimpleHTTP challenges and thus does not need to be -run as a privilidged process. Alternatively shows instructions on how -to use Python's built-in HTTP server and, in case of HTTPS, openssl -binary for temporary key/certificate generation.""".replace("\n", "") + server for solving SimpleHTTP challenges and thus does not need to be + run as a privilidged process. Alternatively shows instructions on how + to use Python's built-in HTTP server and, in case of HTTPS, openssl + binary for temporary key/certificate generation.""".replace("\n", "") def get_chall_pref(self, domain): # pylint: disable=missing-docstring,no-self-use,unused-argument diff --git a/letsencrypt/plugins/standalone.py b/letsencrypt/plugins/standalone.py index d4dddc7f6..b07067b4d 100644 --- a/letsencrypt/plugins/standalone.py +++ b/letsencrypt/plugins/standalone.py @@ -134,18 +134,10 @@ def supported_challenges_validator(data): class Authenticator(common.Plugin): - """Standalone Authenticator. - - This authenticator creates its own ephemeral TCP listener on the - necessary port in order to respond to incoming DVSNI and SimpleHTTP - challenges from the certificate authority. Therefore, it does not - rely on any existing server program. - - """ zope.interface.implements(interfaces.IAuthenticator) zope.interface.classProvides(interfaces.IPluginFactory) - description = "Standalone Authenticator" + description = "LE Will Automatically Test Your Domain" def __init__(self, *args, **kwargs): super(Authenticator, self).__init__(*args, **kwargs) @@ -182,7 +174,11 @@ class Authenticator(common.Plugin): self.conf("supported-challenges").split(",")) def more_info(self): # pylint: disable=missing-docstring - return self.__doc__ + return """\ +This authenticator creates its own ephemeral TCP listener on the + necessary port in order to respond to incoming DVSNI and SimpleHTTP + challenges from the certificate authority. Therefore, it does not + rely on any existing server program.""".replace("\n","") def prepare(self): # pylint: disable=missing-docstring pass From dd1df820adb5bc4e0d42a02480c1501a75547a60 Mon Sep 17 00:00:00 2001 From: Noah Swartz Date: Thu, 22 Oct 2015 16:09:47 -0700 Subject: [PATCH 2/8] hid manual option --- letsencrypt/display/ops.py | 2 +- letsencrypt/plugins/manual.py | 1 + letsencrypt/plugins/standalone.py | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/letsencrypt/display/ops.py b/letsencrypt/display/ops.py index c21b07c03..37ce66b62 100644 --- a/letsencrypt/display/ops.py +++ b/letsencrypt/display/ops.py @@ -74,7 +74,7 @@ def pick_plugin(config, default, plugins, question, ifaces): if len(prepared) > 1: logger.debug("Multiple candidate plugins: %s", prepared) - plugin_ep = choose_plugin(prepared.values()[::-1], question) + plugin_ep = choose_plugin(prepared.values(), question) if plugin_ep is None: return None else: diff --git a/letsencrypt/plugins/manual.py b/letsencrypt/plugins/manual.py index 26724580c..7c10bbcf3 100644 --- a/letsencrypt/plugins/manual.py +++ b/letsencrypt/plugins/manual.py @@ -31,6 +31,7 @@ class Authenticator(common.Plugin): """ zope.interface.implements(interfaces.IAuthenticator) zope.interface.classProvides(interfaces.IPluginFactory) + hidden = True description = "Manually Edit Your Configuration" diff --git a/letsencrypt/plugins/standalone.py b/letsencrypt/plugins/standalone.py index b07067b4d..a922275a6 100644 --- a/letsencrypt/plugins/standalone.py +++ b/letsencrypt/plugins/standalone.py @@ -134,6 +134,8 @@ def supported_challenges_validator(data): class Authenticator(common.Plugin): + """Standalone Authenticator.""" + zope.interface.implements(interfaces.IAuthenticator) zope.interface.classProvides(interfaces.IPluginFactory) @@ -178,7 +180,7 @@ class Authenticator(common.Plugin): This authenticator creates its own ephemeral TCP listener on the necessary port in order to respond to incoming DVSNI and SimpleHTTP challenges from the certificate authority. Therefore, it does not - rely on any existing server program.""".replace("\n","") + rely on any existing server program.""".replace("\n", "") def prepare(self): # pylint: disable=missing-docstring pass From 46ac0169b5d98ae7fc87e34022206eef7cfbd239 Mon Sep 17 00:00:00 2001 From: Noah Swartz Date: Thu, 22 Oct 2015 17:44:57 -0700 Subject: [PATCH 3/8] fixed unit test testing standalone desc --- letsencrypt/plugins/disco_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/letsencrypt/plugins/disco_test.py b/letsencrypt/plugins/disco_test.py index 8660d94a1..bc645d94e 100644 --- a/letsencrypt/plugins/disco_test.py +++ b/letsencrypt/plugins/disco_test.py @@ -50,7 +50,7 @@ class PluginEntryPointTest(unittest.TestCase): name, PluginEntryPoint.entry_point_to_plugin_name(entry_point)) def test_description(self): - self.assertEqual("Standalone Authenticator", self.plugin_ep.description) + self.assertEqual("LE Will Automatically Test Your Domain", self.plugin_ep.description) def test_description_with_name(self): self.plugin_ep.plugin_cls = mock.MagicMock(description="Desc") From 788cb5fc997918781fd6cffe69ebbfb46c595cfa Mon Sep 17 00:00:00 2001 From: Noah Swartz Date: Mon, 26 Oct 2015 13:24:42 -0700 Subject: [PATCH 4/8] moved info back to docstrings --- letsencrypt/plugins/manual.py | 16 +++++++--------- letsencrypt/plugins/standalone.py | 13 +++++++------ 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/letsencrypt/plugins/manual.py b/letsencrypt/plugins/manual.py index 7c10bbcf3..c974bb0ec 100644 --- a/letsencrypt/plugins/manual.py +++ b/letsencrypt/plugins/manual.py @@ -26,12 +26,15 @@ logger = logging.getLogger(__name__) class Authenticator(common.Plugin): """Manual Authenticator. - .. todo:: Support for `~.challenges.DVSNI`. - + This plugin requires user's manual intervention in setting up a HTTP + server for solving SimpleHTTP challenges and thus does not need to be + run as a privilidged process. Alternatively shows instructions on how + to use Python's built-in HTTP server and, in case of HTTPS, openssl + binary for temporary key/certificate generation. """ zope.interface.implements(interfaces.IAuthenticator) zope.interface.classProvides(interfaces.IPluginFactory) - hidden = True +# hidden = True description = "Manually Edit Your Configuration" @@ -81,12 +84,7 @@ s.serve_forever()" """ pass # pragma: no cover def more_info(self): # pylint: disable=missing-docstring,no-self-use - return """\ -This plugin requires user's manual intervention in setting up a HTTP - server for solving SimpleHTTP challenges and thus does not need to be - run as a privilidged process. Alternatively shows instructions on how - to use Python's built-in HTTP server and, in case of HTTPS, openssl - binary for temporary key/certificate generation.""".replace("\n", "") + return self.__doc__.replace("\n ", " ") def get_chall_pref(self, domain): # pylint: disable=missing-docstring,no-self-use,unused-argument diff --git a/letsencrypt/plugins/standalone.py b/letsencrypt/plugins/standalone.py index a922275a6..af1f5a905 100644 --- a/letsencrypt/plugins/standalone.py +++ b/letsencrypt/plugins/standalone.py @@ -134,8 +134,13 @@ def supported_challenges_validator(data): class Authenticator(common.Plugin): - """Standalone Authenticator.""" + """Standalone Authenticator. + This authenticator creates its own ephemeral TCP listener on the + necessary port in order to respond to incoming DVSNI and SimpleHTTP + challenges from the certificate authority. Therefore, it does not + rely on any existing server program. + """ zope.interface.implements(interfaces.IAuthenticator) zope.interface.classProvides(interfaces.IPluginFactory) @@ -176,11 +181,7 @@ class Authenticator(common.Plugin): self.conf("supported-challenges").split(",")) def more_info(self): # pylint: disable=missing-docstring - return """\ -This authenticator creates its own ephemeral TCP listener on the - necessary port in order to respond to incoming DVSNI and SimpleHTTP - challenges from the certificate authority. Therefore, it does not - rely on any existing server program.""".replace("\n", "") + return self.__doc__.replace("\n ", " ") def prepare(self): # pylint: disable=missing-docstring pass From e404961a7672d0a08eecf2569ba37e95533ae42e Mon Sep 17 00:00:00 2001 From: Noah Swartz Date: Wed, 28 Oct 2015 10:49:05 -0700 Subject: [PATCH 5/8] took into account bmw's suggestions --- letsencrypt/plugins/disco_test.py | 4 +++- letsencrypt/plugins/manual.py | 16 ++++++++-------- letsencrypt/plugins/standalone.py | 7 +++++-- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/letsencrypt/plugins/disco_test.py b/letsencrypt/plugins/disco_test.py index bc645d94e..7e9912b27 100644 --- a/letsencrypt/plugins/disco_test.py +++ b/letsencrypt/plugins/disco_test.py @@ -50,7 +50,9 @@ class PluginEntryPointTest(unittest.TestCase): name, PluginEntryPoint.entry_point_to_plugin_name(entry_point)) def test_description(self): - self.assertEqual("LE Will Automatically Test Your Domain", self.plugin_ep.description) + self.assertEqual( + "Run A Standalone Webserver To Prove That You Control Domains", + self.plugin_ep.description) def test_description_with_name(self): self.plugin_ep.plugin_cls = mock.MagicMock(description="Desc") diff --git a/letsencrypt/plugins/manual.py b/letsencrypt/plugins/manual.py index c974bb0ec..a70d6a3aa 100644 --- a/letsencrypt/plugins/manual.py +++ b/letsencrypt/plugins/manual.py @@ -26,17 +26,13 @@ logger = logging.getLogger(__name__) class Authenticator(common.Plugin): """Manual Authenticator. - This plugin requires user's manual intervention in setting up a HTTP - server for solving SimpleHTTP challenges and thus does not need to be - run as a privilidged process. Alternatively shows instructions on how - to use Python's built-in HTTP server and, in case of HTTPS, openssl - binary for temporary key/certificate generation. + .. todo:: Support for `~.challenges.DVSNI`. """ zope.interface.implements(interfaces.IAuthenticator) zope.interface.classProvides(interfaces.IPluginFactory) -# hidden = True + hidden = True - description = "Manually Edit Your Configuration" + description = "Manually Configure And Run A Simple Python Webserver" MESSAGE_TEMPLATE = """\ Make sure your web server displays the following content at @@ -84,7 +80,11 @@ s.serve_forever()" """ pass # pragma: no cover def more_info(self): # pylint: disable=missing-docstring,no-self-use - return self.__doc__.replace("\n ", " ") + return ("This plugin requires user's manual intervention in setting " + "up a HTTP server for solving SimpleHTTP challenges and thus " + "does not need to be run as a privilidged process. " + "Alternatively shows instructions on how to use Python's " + "built-in HTTP server.") def get_chall_pref(self, domain): # pylint: disable=missing-docstring,no-self-use,unused-argument diff --git a/letsencrypt/plugins/standalone.py b/letsencrypt/plugins/standalone.py index af1f5a905..b71c62763 100644 --- a/letsencrypt/plugins/standalone.py +++ b/letsencrypt/plugins/standalone.py @@ -144,7 +144,7 @@ class Authenticator(common.Plugin): zope.interface.implements(interfaces.IAuthenticator) zope.interface.classProvides(interfaces.IPluginFactory) - description = "LE Will Automatically Test Your Domain" + description = "Run A Standalone Webserver To Prove That You Control Domains" def __init__(self, *args, **kwargs): super(Authenticator, self).__init__(*args, **kwargs) @@ -181,7 +181,10 @@ class Authenticator(common.Plugin): self.conf("supported-challenges").split(",")) def more_info(self): # pylint: disable=missing-docstring - return self.__doc__.replace("\n ", " ") + return("This authenticator creates its own ephemeral TCP listener " + "on the necessary port in order to respond to incoming DVSNI " + "and SimpleHTTP challenges from the certificate authority. " + "Therefore, it does not rely on any existing server program.") def prepare(self): # pylint: disable=missing-docstring pass From 358c7b11f43919bc940c5283468c2e0e8985271f Mon Sep 17 00:00:00 2001 From: Noah Swartz Date: Wed, 28 Oct 2015 11:05:11 -0700 Subject: [PATCH 6/8] changed Standalone description --- letsencrypt/plugins/standalone.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/letsencrypt/plugins/standalone.py b/letsencrypt/plugins/standalone.py index b71c62763..6fcf62194 100644 --- a/letsencrypt/plugins/standalone.py +++ b/letsencrypt/plugins/standalone.py @@ -144,7 +144,7 @@ class Authenticator(common.Plugin): zope.interface.implements(interfaces.IAuthenticator) zope.interface.classProvides(interfaces.IPluginFactory) - description = "Run A Standalone Webserver To Prove That You Control Domains" + description = "Automatically configure and run a simple webserver" def __init__(self, *args, **kwargs): super(Authenticator, self).__init__(*args, **kwargs) From 09f9b6a348d7c18a5e660c06e80d3ec1c820db3c Mon Sep 17 00:00:00 2001 From: Noah Swartz Date: Wed, 28 Oct 2015 11:16:23 -0700 Subject: [PATCH 7/8] added back docstring to manual --- letsencrypt/plugins/manual.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/letsencrypt/plugins/manual.py b/letsencrypt/plugins/manual.py index a70d6a3aa..cb6c9af7e 100644 --- a/letsencrypt/plugins/manual.py +++ b/letsencrypt/plugins/manual.py @@ -26,13 +26,18 @@ logger = logging.getLogger(__name__) class Authenticator(common.Plugin): """Manual Authenticator. + This plugin requires user's manual intervention in setting up a HTTP + server for solving SimpleHTTP challenges and thus does not need to be + run as a privilidged process. Alternatively shows instructions on how + to use Python's built-in HTTP server. + .. todo:: Support for `~.challenges.DVSNI`. """ zope.interface.implements(interfaces.IAuthenticator) zope.interface.classProvides(interfaces.IPluginFactory) hidden = True - description = "Manually Configure And Run A Simple Python Webserver" + description = "Manually configure and run a simple Python webserver" MESSAGE_TEMPLATE = """\ Make sure your web server displays the following content at From 989c4d95149b19ca96b273ca46a72fb3b4abcece Mon Sep 17 00:00:00 2001 From: Noah Swartz Date: Wed, 28 Oct 2015 15:37:43 -0700 Subject: [PATCH 8/8] fixed tests to match updated description string --- letsencrypt/plugins/disco_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/letsencrypt/plugins/disco_test.py b/letsencrypt/plugins/disco_test.py index 7e9912b27..293c2b913 100644 --- a/letsencrypt/plugins/disco_test.py +++ b/letsencrypt/plugins/disco_test.py @@ -51,7 +51,7 @@ class PluginEntryPointTest(unittest.TestCase): def test_description(self): self.assertEqual( - "Run A Standalone Webserver To Prove That You Control Domains", + "Automatically configure and run a simple webserver", self.plugin_ep.description) def test_description_with_name(self):