This commit is contained in:
AJ ONeal 2018-04-16 01:28:05 +00:00
parent 2b5877e495
commit 4cd1a03d8a
3 changed files with 88 additions and 11 deletions

View File

@ -1,12 +1,16 @@
greenlock (node-letsencrypt) greenlock (node-letsencrypt)
========= =========
Now supports **Let's Encrypt v2**!!
| [acme-v2.js](https://git.coolaj86.com/coolaj86/acme-v2.js)
| **greenlock** | **greenlock**
| [greenlock-cli](https://git.coolaj86.com/coolaj86/greenlock-cli.js) | [greenlock-cli](https://git.coolaj86.com/coolaj86/greenlock-cli.js)
| [greenlock-express](https://git.coolaj86.com/coolaj86/greenlock-express.js) | [greenlock-express](https://git.coolaj86.com/coolaj86/greenlock-express.js)
| [greenlock-cluster](https://git.coolaj86.com/coolaj86/greenlock-cluster.js) | [greenlock-cluster](https://git.coolaj86.com/coolaj86/greenlock-cluster.js)
| [greenlock-koa](https://git.coolaj86.com/coolaj86/greenlock-koa.js) | [greenlock-koa](https://git.coolaj86.com/coolaj86/greenlock-koa.js)
| [greenlock-hapi](https://git.coolaj86.com/coolaj86/greenlock-hapi.js) | [greenlock-hapi](https://git.coolaj86.com/coolaj86/greenlock-hapi.js)
| Sponsored by [ppl](https://ppl.family) | Sponsored by [ppl](https://ppl.family)
Automatic [Let's Encrypt](https://letsencrypt.org) (ACME) HTTPS / TLS / SSL Certificates for node.js Automatic [Let's Encrypt](https://letsencrypt.org) (ACME) HTTPS / TLS / SSL Certificates for node.js
@ -125,7 +129,18 @@ function leAgree(opts, agreeCb) {
} }
le = LE.create({ le = LE.create({
server: LE.stagingServerUrl // or LE.productionServerUrl version: 'draft-11' // 'draft-11' or 'v01'
// 'draft-11' is for Let's Encrypt v2 otherwise known as ACME draft 11
// 'v02' is an alias for 'draft-11'
// 'v01' is for the pre-spec Let's Encrypt v1
//
// staging API
server: 'https://acme-staging-v02.api.letsencrypt.org/directory'
//
// production API
//server: 'https://acme-v02.api.letsencrypt.org/directory'
, store: leStore // handles saving of config, accounts, and certificates , store: leStore // handles saving of config, accounts, and certificates
, challenges: { , challenges: {
'http-01': leHttpChallenge // handles /.well-known/acme-challege keys and tokens 'http-01': leHttpChallenge // handles /.well-known/acme-challege keys and tokens

View File

@ -2,7 +2,7 @@
var DAY = 24 * 60 * 60 * 1000; var DAY = 24 * 60 * 60 * 1000;
//var MIN = 60 * 1000; //var MIN = 60 * 1000;
var ACME = require('le-acme-core').ACME; var ACME = require('acme-v2/compat').ACME;
var LE = module.exports; var LE = module.exports;
LE.LE = LE; LE.LE = LE;
@ -19,12 +19,12 @@ function _log(debug) {
} }
LE.defaults = { LE.defaults = {
productionServerUrl: ACME.productionServerUrl productionServerUrl: 'https://acme-v02.api.letsencrypt.org/directory'
, stagingServerUrl: ACME.stagingServerUrl , stagingServerUrl: 'https://acme-staging-v02.api.letsencrypt.org/directory'
, rsaKeySize: ACME.rsaKeySize || 2048 , rsaKeySize: ACME.rsaKeySize || 2048
, challengeType: ACME.challengeType || 'http-01' , challengeType: ACME.challengeType || 'http-01'
, challengeTypes: ACME.challengeTypes || [ 'http-01', 'tls-sni-01', 'dns-01' ] , challengeTypes: ACME.challengeTypes || [ 'http-01', 'dns-01' ]
, acmeChallengePrefix: ACME.acmeChallengePrefix , acmeChallengePrefix: ACME.acmeChallengePrefix
}; };
@ -53,6 +53,7 @@ LE._undefined = {
, rsaKeySize: u , rsaKeySize: u
, challengeType: u , challengeType: u
, server: u , server: u
, version: u
, agreeToTerms: u , agreeToTerms: u
, _ipc: u , _ipc: u
, duplicate: u , duplicate: u
@ -70,7 +71,6 @@ LE._undefine = function (le) {
LE.create = function (le) { LE.create = function (le) {
var PromiseA = require('bluebird'); var PromiseA = require('bluebird');
le.acme = le.acme || ACME.create({ debug: le.debug });
le.store = le.store || require('le-store-certbot').create({ debug: le.debug }); le.store = le.store || require('le-store-certbot').create({ debug: le.debug });
le.core = require('./lib/core'); le.core = require('./lib/core');
var log = le.log || _log; var log = le.log || _log;
@ -81,9 +81,11 @@ LE.create = function (le) {
if (!le.challenges['http-01']) { if (!le.challenges['http-01']) {
le.challenges['http-01'] = require('le-challenge-fs').create({ debug: le.debug }); le.challenges['http-01'] = require('le-challenge-fs').create({ debug: le.debug });
} }
/*
if (!le.challenges['tls-sni-01']) { if (!le.challenges['tls-sni-01']) {
le.challenges['tls-sni-01'] = require('le-challenge-sni').create({ debug: le.debug }); le.challenges['tls-sni-01'] = require('le-challenge-sni').create({ debug: le.debug });
} }
*/
if (!le.challenges['dns-01']) { if (!le.challenges['dns-01']) {
try { try {
le.challenges['dns-01'] = require('le-challenge-ddns').create({ debug: le.debug }); le.challenges['dns-01'] = require('le-challenge-ddns').create({ debug: le.debug });
@ -118,6 +120,42 @@ LE.create = function (le) {
le.server = LE.productionServerUrl; le.server = LE.productionServerUrl;
} }
if (-1 !== [ 'https://acme-v01.api.letsencrypt.org/directory'
, 'https://acme-staging.api.letsencrypt.org/directory' ].indexOf(le.server)) {
ACME = require('le-acme-core').ACME;
console.warn("Let's Encrypt v1 is deprecated. Please update to Let's Encrypt v2 (ACME draft 11)");
}
else if (-1 !=== [ 'https://acme-v02.api.letsencrypt.org/directory'
, 'https://acme-staging-v02.api.letsencrypt.org/directory' ].indexOf(le.server)) {
if ('v02' !== le.version && 'draft-11' !== le.version) {
ACME = require('le-acme-core').ACME;
if ('v01' !== le.version) {
//console.warn("Please specify version: 'v01' (Let's Encrypt v1) or 'draft-11' (Let's Encrypt v2 / ACME draft 11)");
console.warn("");
console.warn("");
console.warn("");
console.warn("====================================================================");
console.warn("== greenlock.js (v2.2.0+) ==");
console.warn("====================================================================");
console.warn("");
console.warn("Please specify 'version' option:");
console.warn("");
console.warn(" 'v01' for Let's Encrypt v1");
console.warn(" or");
console.warn(" 'draft-11' for Let's Encrypt v2 and ACME draft 11");
console.warn(" ('v02' is an alias of 'draft-11'");
console.warn("");
console.warn("====================================================================");
console.warn("== this will be required from version v2.3 forward ==");
console.warn("====================================================================");
console.warn("");
console.warn("");
console.warn("");
}
}
}
le.acme = le.acme || ACME.create({ debug: le.debug });
if (le.acme.create) { if (le.acme.create) {
le.acme = le.acme.create(le); le.acme = le.acme.create(le);
} }
@ -183,6 +221,7 @@ LE.create = function (le) {
+ " You must define removeChallenge as function (opts, domain, token, cb) { }"); + " You must define removeChallenge as function (opts, domain, token, cb) { }");
} }
/*
if (!le._challengeWarn && (!challenger.loopback || 4 !== challenger.loopback.length)) { if (!le._challengeWarn && (!challenger.loopback || 4 !== challenger.loopback.length)) {
le._challengeWarn = true; le._challengeWarn = true;
console.warn("le.challenges[" + challengeType + "].loopback should be defined as function (opts, domain, token, cb) { ... } and should prove (by external means) that the ACME server challenge '" + challengeType + "' will succeed"); console.warn("le.challenges[" + challengeType + "].loopback should be defined as function (opts, domain, token, cb) { ... } and should prove (by external means) that the ACME server challenge '" + challengeType + "' will succeed");
@ -191,6 +230,7 @@ LE.create = function (le) {
le._challengeWarn = true; le._challengeWarn = true;
console.warn("le.challenges[" + challengeType + "].test should be defined as function (opts, domain, token, keyAuthorization, cb) { ... } and should prove (by external means) that the ACME server challenge '" + challengeType + "' will succeed"); console.warn("le.challenges[" + challengeType + "].test should be defined as function (opts, domain, token, keyAuthorization, cb) { ... } and should prove (by external means) that the ACME server challenge '" + challengeType + "' will succeed");
} }
*/
}); });
le.sni = le.sni || null; le.sni = le.sni || null;

View File

@ -1,6 +1,6 @@
{ {
"name": "greenlock", "name": "greenlock",
"version": "2.1.17", "version": "2.2.0",
"description": "Let's Encrypt for node.js on npm", "description": "Let's Encrypt for node.js on npm",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
@ -11,14 +11,35 @@
"url": "git+https://git.coolaj86.com/coolaj86/greenlock.js.git" "url": "git+https://git.coolaj86.com/coolaj86/greenlock.js.git"
}, },
"keywords": [ "keywords": [
"greenlock", "acmev2",
"acmev02",
"acme-v2",
"acme-v02",
"acme",
"acme2",
"acme11",
"acme-draft11",
"acme-draft-11",
"draft",
"11",
"free",
"ssl",
"tls",
"https",
"Let's Encrypt",
"letsencrypt", "letsencrypt",
"letsencrypt-v2",
"letsencrypt-v02",
"letsencryptv2",
"letsencryptv02",
"letsencrypt2",
"v2",
"v02",
"greenlock",
"letsencrypt.org", "letsencrypt.org",
"le", "le",
"Let's Encrypt",
"lejs", "lejs",
"le.js", "le.js",
"acme",
"node", "node",
"nodejs", "nodejs",
"node.js", "node.js",
@ -35,11 +56,12 @@
}, },
"optionalDependencies": {}, "optionalDependencies": {},
"dependencies": { "dependencies": {
"acme-v2": "git+https://git.coolaj86.com/coolaj86/acme-v2.js.git#master",
"asn1js": "^1.2.12", "asn1js": "^1.2.12",
"bluebird": "^3.0.6", "bluebird": "^3.0.6",
"certpem": "^1.0.0", "certpem": "^1.0.0",
"homedir": "^0.6.0", "homedir": "^0.6.0",
"le-acme-core": "^2.0.5", "le-acme-core": "^2.1.2",
"le-challenge-fs": "^2.0.2", "le-challenge-fs": "^2.0.2",
"le-challenge-sni": "^2.0.0", "le-challenge-sni": "^2.0.0",
"le-sni-auto": "^2.1.0", "le-sni-auto": "^2.1.0",