diff --git a/README.md b/README.md index afdec70..89711a8 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,10 @@ An extremely simple reference implementation of an ACME (Let's Encrypt) http-01 challenge strategy for [Greenlock](https://git.coolaj86.com/coolaj86/greenlock-express.js) v2.7+ (and v3). +``` +GET http://example.com/.well-known/acme-challenge/xxxxxxxxxxxxxxxx +``` + * Prints the ACME challenge URL and Key Authorization to the terminal * (waits for you to hit enter before continuing) * Asks you to enter (or upload) the Key Authorization challenge response. diff --git a/index.js b/index.js index 1586769..451beea 100644 --- a/index.js +++ b/index.js @@ -40,6 +40,7 @@ Challenge.create = function (config) { // Prints the challenge URL and keyAuthorization to the screen // (so that you can go set it and then continue) +// if you need per-run / per-domain options set them in approveDomains() and they'll be on 'args' here. Challenge._setHttp = function (args, cb) { // Note: You can receive cb and use that, or omit cb and return a Promise @@ -79,7 +80,7 @@ Challenge._removeHttp = function (args) { var ch = args.challenge; console.info(""); - console.info("[ACME http-01 '" + ch.altname + "' COMPLETE]"); + console.info("[ACME http-01 '" + ch.altname + "' COMPLETE]: " + ch.status); console.info("Challenge complete. You may now remove the challenge file:"); console.info(""); console.info('\thttp://' + ch.altname + '/.well-known/acme-challenge/' + ch.token); @@ -89,9 +90,7 @@ Challenge._removeHttp = function (args) { return null; }; -// nothing to do here, that's why it's manual Challenge._getHttp = function (args) { - // Note: Here I'm You can receive cb and use that, or omit cb and return a Promise var ch = args.challenge; if (!Challenge._getCache[ch.altname + ':' + ch.token]) { diff --git a/test.js b/test.js index 496c77c..26e666b 100644 --- a/test.js +++ b/test.js @@ -16,35 +16,21 @@ function run() { } opts.challenge = { - type: 'http-01' + type: 'dns-01' , identifier: { type: 'dns', value: 'example.com' } -, wildcard: false +, wildcard: true , expires: '2012-01-01T12:00:00.000Z' , token: 'abc123' , thumbprint: '<>' , keyAuthorization: 'abc123.xxxx' , dnsHost: '_acme-challenge.example.com' , dnsAuthorization: 'yyyy' -, altname: 'example.com' +, altname: '*.example.com' }; run(opts).then(function () { - opts.challenge = { - type: 'dns-01' - , identifier: { type: 'dns', value: 'example.com' } - , wildcard: true - , expires: '2012-01-01T12:00:00.000Z' - , token: 'abc123' - , thumbprint: '<>' - , keyAuthorization: 'abc123.xxxx' - , dnsHost: '_acme-challenge.example.com' - , dnsAuthorization: 'yyyy' - , altname: '*.example.com' - }; - return run(opts); -}).then(function () { console.info("PASS"); }).catch(function (err) { console.error("FAIL"); console.error(err); - process.exit(17); + process.exit(19); });