From 9a8e6feb54cf8c3c9e723de11797607b8d416c86 Mon Sep 17 00:00:00 2001 From: Peter Eckersley Date: Tue, 17 Nov 2015 16:29:06 -0800 Subject: [PATCH] Implement --webroot --- letsencrypt/cli.py | 7 ++++++- letsencrypt/tests/cli_test.py | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/letsencrypt/cli.py b/letsencrypt/cli.py index e9cb31a21..13a5fa3a8 100644 --- a/letsencrypt/cli.py +++ b/letsencrypt/cli.py @@ -69,6 +69,7 @@ USAGE = SHORT_USAGE + """Choice of server plugins for obtaining and installing c %s --standalone Run a standalone webserver for authentication %s + --webroot Place files in a server's webroot folder for authentication OR use different servers to obtain (authenticate) the cert and then install it: @@ -80,7 +81,7 @@ More detailed help: the available topics are: all, automation, paths, security, testing, or any of the subcommands or - plugins (certonly, install, nginx, apache, standalone, etc) + plugins (certonly, install, nginx, apache, standalone, webroot, etc) """ @@ -408,6 +409,8 @@ def choose_configurator_plugins(args, config, plugins, verb): req_auth = set_configurator(req_auth, "apache") if args.standalone: req_auth = set_configurator(req_auth, "standalone") + if args.webroot: + req_auth = set_configurator(req_auth, "webroot") logger.debug("Requested authenticator %s and installer %s", req_auth, req_inst) # Try to meet the user's request and/or ask them to pick plugins @@ -1026,6 +1029,8 @@ def _plugins_parsing(helpful, plugins): help="Obtain and install certs using Nginx") helpful.add("plugins", "--standalone", action="store_true", help='Obtain certs using a "standalone" webserver.') + helpful.add("plugins", "--webroot", action="store_true", + help='Obtain certs by placing files in a webroot directory.') # things should not be reorder past/pre this comment: # plugins_group should be displayed in --help before plugin diff --git a/letsencrypt/tests/cli_test.py b/letsencrypt/tests/cli_test.py index 500ff074e..6f264b044 100644 --- a/letsencrypt/tests/cli_test.py +++ b/letsencrypt/tests/cli_test.py @@ -201,6 +201,10 @@ class CLITest(unittest.TestCase): # pylint: disable=too-many-public-methods self.assertTrue("Could not find configuration root" in ret) self.assertTrue("NoInstallationError" in ret) + args = ["certonly", "--webroot"] + ret, _, _, _ = self._call(args) + self.assertTrue("--webroot-path must be set" in ret) + with MockedVerb("certonly") as mock_certonly: self._call(["auth", "--standalone"]) self.assertEqual(1, mock_certonly.call_count)