diff --git a/README.md b/README.md index 6acc9d4..9a878b5 100644 --- a/README.md +++ b/README.md @@ -186,6 +186,9 @@ Options: --standalone [BOOLEAN] Obtain certs using a "standalone" webserver. (Default is true) + --manual [BOOLEAN] Print the token and key to the screen and wait for you to hit enter, + giving you time to copy it somewhere before continuing. (Default is false) + --webroot BOOLEAN Obtain certs by placing files in a webroot directory. --webroot-path STRING public_html / webroot path. diff --git a/bin/letsencrypt.js b/bin/letsencrypt.js index 252cc3d..211e798 100755 --- a/bin/letsencrypt.js +++ b/bin/letsencrypt.js @@ -22,7 +22,7 @@ cli.parse({ , 'config-dir': [ false, " Configuration directory.", 'string', '~/letsencrypt/etc/' ] , server: [ false, " ACME Directory Resource URI.", 'string', 'https://acme-v01.api.letsencrypt.org/directory)' ] , standalone: [ false, " Obtain certs using a \"standalone\" webserver.", 'boolean', false ] -//, manual: [ false, " Provide laborious manual instructions for obtaining a cert (default: false)", 'boolean', false ] +, manual: [ false, " Print the token and key to the screen and wait for you to hit enter, giving you time to copy it somewhere before continuing (default: false)", 'boolean', false ] , webroot: [ false, " Obtain certs by placing files in a webroot directory.", 'boolean', false ] , 'webroot-path': [ false, " public_html / webroot path.", 'string' ] //, 'standalone-supported-challenges': [ false, " Supported challenges, order preferences are randomly chosen. (default: http-01,tls-sni-01)", 'string', 'http-01,tls-sni-01'] diff --git a/index.js b/index.js index bbbf671..ef3b65f 100644 --- a/index.js +++ b/index.js @@ -19,12 +19,16 @@ module.exports.run = function (args) { challengeType = 'http-01'; } - if (args.webrootPath) { + if (args.manual) { + leChallenge = require('le-challenge-manual').create({}); + } + else if (args.webrootPath) { // webrootPath is all that really matters here + // TODO rename le-challenge-fs to le-challenge-webroot leChallenge = require('./lib/webroot').create({ webrootPath: args.webrootPath }); } else if (USE_DNS !== args.standalone) { - leChallenge = require('./lib/standalone').create({}); + leChallenge = require('le-challenge-standalone').create({}); servers = require('./lib/servers').create(leChallenge).startServers( args.http01Port || [80], args.tlsSni01Port || [443, 5001] , { debug: args.debug } diff --git a/lib/standalone.js b/lib/standalone.js deleted file mode 100644 index d74cbd6..0000000 --- a/lib/standalone.js +++ /dev/null @@ -1,32 +0,0 @@ -'use strict'; - -module.exports.create = function (defaults) { - var handlers = { - getOptions: function () { - return defaults; - } - // - // set,get,remove challenges - // - // Note: this is fine for a one-off CLI tool - // but a webserver using node-cluster or multiple - // servers should use a database of some sort - , _challenges: {} - , set: function (args, domain, token, secret, cb) { - handlers._challenges[token] = secret; - cb(null); - } - , get: function (args, domain, token, cb) { - // TODO keep in mind that, generally get args are just args.domains - // and it is disconnected from the flow of setChallenge and removeChallenge - cb(null, handlers._challenges[token]); - } - , remove: function (args, domain, token, cb) { - delete handlers._challenges[token]; - cb(null); - } - - }; - - return handlers; -}; diff --git a/package.json b/package.json index e5f9cf4..592c669 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,8 @@ "cli": "^0.11.1", "homedir": "^0.6.0", "le-acme-core": "^2.0.5", + "le-challenge-manual": "^2.0.0", + "le-challenge-standalone": "^2.0.0", "le-store-certbot": "^2.0.2", "letsencrypt": "^2.0.3", "localhost.daplie.com-certificates": "^1.2.0",