v3.2.1: bugfix new dns-01 tests

This commit is contained in:
AJ ONeal 2019-06-13 03:16:09 -06:00
parent fa60eb0149
commit 9e0aedca41
2 changed files with 10 additions and 9 deletions

View File

@ -100,9 +100,9 @@ function testEach(type, domains, challenger) {
}); });
var rnd = crypto.randomBytes(2).toString('hex'); var rnd = crypto.randomBytes(2).toString('hex');
console.info("Testing each of '%s'", domains.join(', '));
return chr.zones({ dnsHosts: domains }).then(function(zones) { return chr.zones({ dnsHosts: domains }).then(function(zones) {
return mapAsync(all, function(opts) { return mapAsync(all, function(opts) {
console.info("TEST '%s'", opts.domain);
var zone = pluckZone(zones, opts.domain); var zone = pluckZone(zones, opts.domain);
opts.challenge = fakeChallenge(type, zone, opts.domain, rnd); opts.challenge = fakeChallenge(type, zone, opts.domain, rnd);
var ch = opts.challenge; 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 // one for the bare domain, and the other if and only if there's a wildcard
query.wildcard = ch.wildcard; query.wildcard = ch.wildcard;
query.dnsAuthorization = ch.dnsAuthorization; query.dnsAuthorization = ch.dnsAuthorization;
query.dnsZone = ch.dnsZone;
query.dnsPrefix = ch.dnsPrefix;
} else { } else {
query = JSON.parse(JSON.stringify(ch)); query = JSON.parse(JSON.stringify(ch));
query.comment = 'unknown challenge type, supplying everything'; query.comment = 'unknown challenge type, supplying everything';
@ -307,18 +309,11 @@ function fakeChallenge(type, zone, altname, rnd) {
thumbprint: thumb, thumbprint: thumb,
keyAuthorization: keyAuth, keyAuthorization: keyAuth,
url: null, // completed below url: null, // completed below
dnsZone: zone,
dnsHost: '_' + rnd.slice(0, 2) + '-acme-challenge-' + rnd.slice(2) + '.', // completed below dnsHost: '_' + rnd.slice(0, 2) + '-acme-challenge-' + rnd.slice(2) + '.', // completed below
dnsAuthorization: dnsAuth, dnsAuthorization: dnsAuth,
altname: altname, altname: altname,
_test: true // used by CLI referenced implementations _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)) { if ('*.' === altname.slice(0, 2)) {
challenge.wildcard = true; challenge.wildcard = true;
altname = altname.slice(2); altname = altname.slice(2);
@ -327,6 +322,12 @@ function fakeChallenge(type, zone, altname, rnd) {
challenge.url = challenge.url =
'http://' + altname + '/.well-known/acme-challenge/' + challenge.token; 'http://' + altname + '/.well-known/acme-challenge/' + challenge.token;
challenge.dnsHost += altname; challenge.dnsHost += altname;
if (zone) {
challenge.dnsZone = zone;
challenge.dnsPrefix = challenge.dnsHost
.replace(newZoneRegExp(zone), '')
.replace(/\.$/, '');
}
return challenge; return challenge;
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "acme-challenge-test", "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.", "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", "main": "index.js",
"homepage": "https://git.rootprojects.org/root/acme-challenge-test.js", "homepage": "https://git.rootprojects.org/root/acme-challenge-test.js",