v3.2.1: bugfix new dns-01 tests
This commit is contained in:
		
							parent
							
								
									fa60eb0149
								
							
						
					
					
						commit
						9e0aedca41
					
				
							
								
								
									
										17
									
								
								index.js
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								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;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -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",
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user