v3.1.2: keep same random prefix per test set
This commit is contained in:
		
							parent
							
								
									ea508c68f4
								
							
						
					
					
						commit
						dda7ecb497
					
				@ -3,10 +3,10 @@
 | 
			
		||||
//var tester = require('acme-challenge-test');
 | 
			
		||||
var tester = require('./');
 | 
			
		||||
 | 
			
		||||
var type = 'http-01';
 | 
			
		||||
var challenger = require('acme-http-01-cli').create({});
 | 
			
		||||
//var type = 'dns-01';
 | 
			
		||||
//var challenger = require('acme-dns-01-cli').create({});
 | 
			
		||||
//var type = 'http-01';
 | 
			
		||||
//var challenger = require('acme-http-01-cli').create({});
 | 
			
		||||
var type = 'dns-01';
 | 
			
		||||
var challenger = require('acme-dns-01-cli').create({});
 | 
			
		||||
//var challenger = require('./YOUR-CHALLENGE-STRATEGY').create({});
 | 
			
		||||
//var type = 'YOUR-TYPE-01';
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										7
									
								
								index.js
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								index.js
									
									
									
									
									
								
							@ -76,10 +76,11 @@ function testEach(type, domains, challenger) {
 | 
			
		||||
	var all = domains.map(function(d) {
 | 
			
		||||
		return { domain: d };
 | 
			
		||||
	});
 | 
			
		||||
	var rnd = crypto.randomBytes(2).toString('hex');
 | 
			
		||||
 | 
			
		||||
	return mapAsync(all, function(opts) {
 | 
			
		||||
		console.info("TEST '%s'", opts.domain);
 | 
			
		||||
		opts.challenge = getChallenge(type, opts.domain);
 | 
			
		||||
		opts.challenge = fakeChallenge(type, opts.domain, rnd);
 | 
			
		||||
		var ch = opts.challenge;
 | 
			
		||||
		if ('http-01' === ch.type && ch.wildname) {
 | 
			
		||||
			throw new Error('http-01 cannot be used for wildcard domains');
 | 
			
		||||
@ -234,7 +235,7 @@ function wrapChallenger(challenger) {
 | 
			
		||||
	return { set: set, get: get, remove: remove };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function getChallenge(type, altname) {
 | 
			
		||||
function fakeChallenge(type, altname, rnd) {
 | 
			
		||||
	var expires = new Date(Date.now() + 10 * 60 * 1000).toISOString();
 | 
			
		||||
	var token = crypto.randomBytes(8).toString('hex');
 | 
			
		||||
	var thumb = crypto.randomBytes(16).toString('hex');
 | 
			
		||||
@ -257,7 +258,7 @@ function getChallenge(type, altname) {
 | 
			
		||||
		thumbprint: thumb,
 | 
			
		||||
		keyAuthorization: keyAuth,
 | 
			
		||||
		url: null, // completed below
 | 
			
		||||
		dnsHost: '_acme-challenge-' + token.slice(0, 4) + '.', // completed below
 | 
			
		||||
		dnsHost: '_' + rnd.slice(0, 2) + '-acme-challenge-' + rnd.slice(2) + '.', // completed below
 | 
			
		||||
		dnsAuthorization: dnsAuth,
 | 
			
		||||
		altname: altname,
 | 
			
		||||
		_test: true // used by CLI referenced implementations
 | 
			
		||||
 | 
			
		||||
@ -1,9 +1,13 @@
 | 
			
		||||
{
 | 
			
		||||
	"name": "acme-challenge-test",
 | 
			
		||||
	"version": "3.1.1",
 | 
			
		||||
	"version": "3.1.2",
 | 
			
		||||
	"description": "The base set of tests for all ACME challenge strategies. Any `acme-http-01-`, `acme-dns-01-`, `acme-challenge-`, or greenlock plugin should be able to pass these tests.",
 | 
			
		||||
	"main": "index.js",
 | 
			
		||||
	"homepage": "https://git.rootprojects.org/root/acme-challenge-test.js",
 | 
			
		||||
	"files": [
 | 
			
		||||
		"example.js",
 | 
			
		||||
		"lib"
 | 
			
		||||
	],
 | 
			
		||||
	"dependencies": {},
 | 
			
		||||
	"devDependencies": {},
 | 
			
		||||
	"scripts": {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user