@certd/acme-client 1.24.0 → 1.24.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/auto.js +41 -36
- package/src/crypto/index.js +0 -1
- package/src/http.js +1 -1
- package/src/index.js +1 -1
- package/src/verify.js +1 -1
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Simple and unopinionated ACME client",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "nmorsman",
|
|
6
|
-
"version": "1.24.
|
|
6
|
+
"version": "1.24.2",
|
|
7
7
|
"main": "src/index.js",
|
|
8
8
|
"types": "types/index.d.ts",
|
|
9
9
|
"license": "MIT",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"bugs": {
|
|
60
60
|
"url": "https://github.com/publishlab/node-acme-client/issues"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "c49ccbde93dbad7062ac39d4f18eca7d561f573f"
|
|
63
63
|
}
|
package/src/auto.js
CHANGED
|
@@ -13,8 +13,12 @@ const defaultOpts = {
|
|
|
13
13
|
termsOfServiceAgreed: false,
|
|
14
14
|
skipChallengeVerification: false,
|
|
15
15
|
challengePriority: ['http-01', 'dns-01'],
|
|
16
|
-
challengeCreateFn: async () => {
|
|
17
|
-
|
|
16
|
+
challengeCreateFn: async () => {
|
|
17
|
+
throw new Error('Missing challengeCreateFn()');
|
|
18
|
+
},
|
|
19
|
+
challengeRemoveFn: async () => {
|
|
20
|
+
throw new Error('Missing challengeRemoveFn()');
|
|
21
|
+
},
|
|
18
22
|
};
|
|
19
23
|
|
|
20
24
|
/**
|
|
@@ -209,6 +213,7 @@ module.exports = async (client, userOpts) => {
|
|
|
209
213
|
}
|
|
210
214
|
|
|
211
215
|
log(`[auto] challengeGroups:${allChallengePromises.length}`);
|
|
216
|
+
|
|
212
217
|
function runAllPromise(tasks) {
|
|
213
218
|
let promise = Promise.resolve();
|
|
214
219
|
tasks.forEach((task) => {
|
|
@@ -228,48 +233,48 @@ module.exports = async (client, userOpts) => {
|
|
|
228
233
|
return Promise.all(results);
|
|
229
234
|
}
|
|
230
235
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
throw new Error('用户取消');
|
|
240
|
-
}
|
|
241
|
-
// eslint-disable-next-line no-await-in-loop
|
|
242
|
-
await runPromisePa(challengePromises);
|
|
236
|
+
log(`开始challenge,共${allChallengePromises.length}组`);
|
|
237
|
+
let i = 0;
|
|
238
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
239
|
+
for (const challengePromises of allChallengePromises) {
|
|
240
|
+
i += 1;
|
|
241
|
+
log(`开始第${i}组`);
|
|
242
|
+
if (opts.signal && opts.signal.aborted) {
|
|
243
|
+
throw new Error('用户取消');
|
|
243
244
|
}
|
|
244
|
-
log('challenge结束');
|
|
245
|
-
|
|
246
|
-
// log('[auto] Waiting for challenge valid status');
|
|
247
|
-
// await Promise.all(challengePromises);
|
|
248
|
-
|
|
249
|
-
/**
|
|
250
|
-
* Finalize order and download certificate
|
|
251
|
-
*/
|
|
252
245
|
|
|
253
|
-
log('[auto] Finalizing order and downloading certificate');
|
|
254
|
-
const finalized = await client.finalizeOrder(order, opts.csr);
|
|
255
|
-
return await client.getCertificate(finalized, opts.preferredChain);
|
|
256
|
-
}
|
|
257
|
-
catch (e) {
|
|
258
|
-
log('证书申请失败');
|
|
259
|
-
log(e);
|
|
260
|
-
throw new Error(`证书申请失败:${e.message}`);
|
|
261
|
-
}
|
|
262
|
-
finally {
|
|
263
|
-
log(`清理challenge痕迹,length:${clearTasks.length}`);
|
|
264
246
|
try {
|
|
265
|
-
await
|
|
247
|
+
// eslint-disable-next-line no-await-in-loop
|
|
248
|
+
await runPromisePa(challengePromises);
|
|
266
249
|
}
|
|
267
250
|
catch (e) {
|
|
268
|
-
log(
|
|
269
|
-
|
|
251
|
+
log(`证书申请失败${e.message}`);
|
|
252
|
+
throw e;
|
|
253
|
+
}
|
|
254
|
+
finally {
|
|
255
|
+
log(`清理challenge痕迹,length:${clearTasks.length}`);
|
|
256
|
+
try {
|
|
257
|
+
// eslint-disable-next-line no-await-in-loop
|
|
258
|
+
await runAllPromise(clearTasks);
|
|
259
|
+
}
|
|
260
|
+
catch (e) {
|
|
261
|
+
log('清理challenge失败');
|
|
262
|
+
log(e);
|
|
263
|
+
}
|
|
270
264
|
}
|
|
271
265
|
}
|
|
266
|
+
log('challenge结束');
|
|
267
|
+
|
|
268
|
+
// log('[auto] Waiting for challenge valid status');
|
|
269
|
+
// await Promise.all(challengePromises);
|
|
270
|
+
/**
|
|
271
|
+
* Finalize order and download certificate
|
|
272
|
+
*/
|
|
272
273
|
|
|
274
|
+
log('[auto] Finalizing order and downloading certificate');
|
|
275
|
+
const finalized = await client.finalizeOrder(order, opts.csr);
|
|
276
|
+
const res = await client.getCertificate(finalized, opts.preferredChain);
|
|
277
|
+
return res;
|
|
273
278
|
// try {
|
|
274
279
|
// await Promise.allSettled(challengePromises);
|
|
275
280
|
// }
|
package/src/crypto/index.js
CHANGED
|
@@ -290,7 +290,6 @@ exports.readCsrDomains = (csrPem) => {
|
|
|
290
290
|
if (Buffer.isBuffer(csrPem)) {
|
|
291
291
|
csrPem = csrPem.toString();
|
|
292
292
|
}
|
|
293
|
-
|
|
294
293
|
const dec = x509.PemConverter.decodeFirst(csrPem);
|
|
295
294
|
const csr = new x509.Pkcs10CertificateRequest(dec);
|
|
296
295
|
return parseDomains(csr);
|
package/src/http.js
CHANGED
|
@@ -55,7 +55,7 @@ class HttpClient {
|
|
|
55
55
|
*/
|
|
56
56
|
|
|
57
57
|
async request(url, method, opts = {}) {
|
|
58
|
-
if (this.urlMapping && this.urlMapping.mappings) {
|
|
58
|
+
if (this.urlMapping && this.urlMapping.enabled && this.urlMapping.mappings) {
|
|
59
59
|
// eslint-disable-next-line no-restricted-syntax
|
|
60
60
|
for (const key in this.urlMapping.mappings) {
|
|
61
61
|
if (url.includes(key)) {
|
package/src/index.js
CHANGED
package/src/verify.js
CHANGED
|
@@ -111,7 +111,7 @@ async function verifyDnsChallenge(authz, challenge, keyAuthorization, prefix = '
|
|
|
111
111
|
log(`DNS query finished successfully, found ${recordValues.length} TXT records`);
|
|
112
112
|
|
|
113
113
|
if (!recordValues.length || !recordValues.includes(keyAuthorization)) {
|
|
114
|
-
throw new Error(`Authorization not found in DNS TXT record: ${recordName}`);
|
|
114
|
+
throw new Error(`Authorization not found in DNS TXT record: ${recordName},need:${keyAuthorization},found:${recordValues}`);
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
log(`Key authorization match for ${challenge.type}/${recordName}, ACME challenge verified`);
|