From 9e0aedca41b68f21befa62971d3debb78939e060 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 13 Jun 2019 03:16:09 -0600 Subject: [PATCH] v3.2.1: bugfix new dns-01 tests --- index.js | 17 +++++++++-------- package.json | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/index.js b/index.js index 8d6ef24..6df82d1 100644 --- a/index.js +++ b/index.js @@ -100,9 +100,9 @@ function testEach(type, domains, challenger) { }); var rnd = crypto.randomBytes(2).toString('hex'); + console.info("Testing each of '%s'", domains.join(', ')); return chr.zones({ dnsHosts: domains }).then(function(zones) { return mapAsync(all, function(opts) { - console.info("TEST '%s'", opts.domain); var zone = pluckZone(zones, opts.domain); opts.challenge = fakeChallenge(type, zone, opts.domain, rnd); var ch = opts.challenge; @@ -129,6 +129,8 @@ function testEach(type, domains, challenger) { // one for the bare domain, and the other if and only if there's a wildcard query.wildcard = ch.wildcard; query.dnsAuthorization = ch.dnsAuthorization; + query.dnsZone = ch.dnsZone; + query.dnsPrefix = ch.dnsPrefix; } else { query = JSON.parse(JSON.stringify(ch)); query.comment = 'unknown challenge type, supplying everything'; @@ -307,18 +309,11 @@ function fakeChallenge(type, zone, altname, rnd) { thumbprint: thumb, keyAuthorization: keyAuth, url: null, // completed below - dnsZone: zone, dnsHost: '_' + rnd.slice(0, 2) + '-acme-challenge-' + rnd.slice(2) + '.', // completed below dnsAuthorization: dnsAuth, altname: altname, _test: true // used by CLI referenced implementations }; - if (zone) { - challenge.dnsZone = zone; - challenge.dnsPrefix = challenge.dnsHost - .replace(newZoneRegExp(zone), '') - .replace(/\.$/, ''); - } if ('*.' === altname.slice(0, 2)) { challenge.wildcard = true; altname = altname.slice(2); @@ -327,6 +322,12 @@ function fakeChallenge(type, zone, altname, rnd) { challenge.url = 'http://' + altname + '/.well-known/acme-challenge/' + challenge.token; challenge.dnsHost += altname; + if (zone) { + challenge.dnsZone = zone; + challenge.dnsPrefix = challenge.dnsHost + .replace(newZoneRegExp(zone), '') + .replace(/\.$/, ''); + } return challenge; } diff --git a/package.json b/package.json index a9d7a50..6d35022 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "acme-challenge-test", - "version": "3.2.0", + "version": "3.2.1", "description": "ACME challenge test harness for Let's Encrypt integrations. Any `acme-http-01-` or `acme-dns-01-` challenge strategy or Greenlock plugin should be able to pass these tests.", "main": "index.js", "homepage": "https://git.rootprojects.org/root/acme-challenge-test.js",