Compare commits
24 Commits
0e58683c7d
...
aece586c90
Author | SHA1 | Date | |
---|---|---|---|
aece586c90 | |||
aac4a85dc9 | |||
7dd64a33e9 | |||
502c639813 | |||
ff6cbf5064 | |||
b9aed7cdc9 | |||
cc624e716b | |||
157f6a7380 | |||
ef6672a5b4 | |||
c90cad6852 | |||
331a0ba166 | |||
f2d989ffed | |||
9e06859f62 | |||
0592f6c151 | |||
bf6d01bacb | |||
ed1bdc9092 | |||
a2ec361b12 | |||
ba7abf1897 | |||
24d1be590f | |||
a59f27ebe1 | |||
d7b105f742 | |||
8101b1d60e | |||
4c4c5bb2d8 | |||
|
b01bd20124 |
233
LICENSE
@ -1,221 +1,32 @@
|
|||||||
At your option you may choose either of the following licenses:
|
Copyright 2017 AJ ONeal
|
||||||
|
|
||||||
* The MIT License (MIT)
|
This is open source software; you can redistribute it and/or modify it under the
|
||||||
* The Apache License 2.0 (Apache-2.0)
|
terms of either:
|
||||||
|
|
||||||
|
a) the "MIT License"
|
||||||
|
b) the "Apache-2.0 License"
|
||||||
|
|
||||||
The MIT License (MIT)
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2015 AJ ONeal
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
The above copyright notice and this permission notice shall be included in all
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
copies or substantial portions of the Software.
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
copies or substantial portions of the Software.
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
Apache-2.0 License Summary
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
|
|
||||||
|
|
||||||
Apache License
|
|
||||||
Version 2.0, January 2004
|
|
||||||
http://www.apache.org/licenses/
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
||||||
|
|
||||||
1. Definitions.
|
|
||||||
|
|
||||||
"License" shall mean the terms and conditions for use, reproduction,
|
|
||||||
and distribution as defined by Sections 1 through 9 of this document.
|
|
||||||
|
|
||||||
"Licensor" shall mean the copyright owner or entity authorized by
|
|
||||||
the copyright owner that is granting the License.
|
|
||||||
|
|
||||||
"Legal Entity" shall mean the union of the acting entity and all
|
|
||||||
other entities that control, are controlled by, or are under common
|
|
||||||
control with that entity. For the purposes of this definition,
|
|
||||||
"control" means (i) the power, direct or indirect, to cause the
|
|
||||||
direction or management of such entity, whether by contract or
|
|
||||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
||||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
||||||
|
|
||||||
"You" (or "Your") shall mean an individual or Legal Entity
|
|
||||||
exercising permissions granted by this License.
|
|
||||||
|
|
||||||
"Source" form shall mean the preferred form for making modifications,
|
|
||||||
including but not limited to software source code, documentation
|
|
||||||
source, and configuration files.
|
|
||||||
|
|
||||||
"Object" form shall mean any form resulting from mechanical
|
|
||||||
transformation or translation of a Source form, including but
|
|
||||||
not limited to compiled object code, generated documentation,
|
|
||||||
and conversions to other media types.
|
|
||||||
|
|
||||||
"Work" shall mean the work of authorship, whether in Source or
|
|
||||||
Object form, made available under the License, as indicated by a
|
|
||||||
copyright notice that is included in or attached to the work
|
|
||||||
(an example is provided in the Appendix below).
|
|
||||||
|
|
||||||
"Derivative Works" shall mean any work, whether in Source or Object
|
|
||||||
form, that is based on (or derived from) the Work and for which the
|
|
||||||
editorial revisions, annotations, elaborations, or other modifications
|
|
||||||
represent, as a whole, an original work of authorship. For the purposes
|
|
||||||
of this License, Derivative Works shall not include works that remain
|
|
||||||
separable from, or merely link (or bind by name) to the interfaces of,
|
|
||||||
the Work and Derivative Works thereof.
|
|
||||||
|
|
||||||
"Contribution" shall mean any work of authorship, including
|
|
||||||
the original version of the Work and any modifications or additions
|
|
||||||
to that Work or Derivative Works thereof, that is intentionally
|
|
||||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
||||||
or by an individual or Legal Entity authorized to submit on behalf of
|
|
||||||
the copyright owner. For the purposes of this definition, "submitted"
|
|
||||||
means any form of electronic, verbal, or written communication sent
|
|
||||||
to the Licensor or its representatives, including but not limited to
|
|
||||||
communication on electronic mailing lists, source code control systems,
|
|
||||||
and issue tracking systems that are managed by, or on behalf of, the
|
|
||||||
Licensor for the purpose of discussing and improving the Work, but
|
|
||||||
excluding communication that is conspicuously marked or otherwise
|
|
||||||
designated in writing by the copyright owner as "Not a Contribution."
|
|
||||||
|
|
||||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
||||||
on behalf of whom a Contribution has been received by Licensor and
|
|
||||||
subsequently incorporated within the Work.
|
|
||||||
|
|
||||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
copyright license to reproduce, prepare Derivative Works of,
|
|
||||||
publicly display, publicly perform, sublicense, and distribute the
|
|
||||||
Work and such Derivative Works in Source or Object form.
|
|
||||||
|
|
||||||
3. Grant of Patent License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
(except as stated in this section) patent license to make, have made,
|
|
||||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
||||||
where such license applies only to those patent claims licensable
|
|
||||||
by such Contributor that are necessarily infringed by their
|
|
||||||
Contribution(s) alone or by combination of their Contribution(s)
|
|
||||||
with the Work to which such Contribution(s) was submitted. If You
|
|
||||||
institute patent litigation against any entity (including a
|
|
||||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
||||||
or a Contribution incorporated within the Work constitutes direct
|
|
||||||
or contributory patent infringement, then any patent licenses
|
|
||||||
granted to You under this License for that Work shall terminate
|
|
||||||
as of the date such litigation is filed.
|
|
||||||
|
|
||||||
4. Redistribution. You may reproduce and distribute copies of the
|
|
||||||
Work or Derivative Works thereof in any medium, with or without
|
|
||||||
modifications, and in Source or Object form, provided that You
|
|
||||||
meet the following conditions:
|
|
||||||
|
|
||||||
(a) You must give any other recipients of the Work or
|
|
||||||
Derivative Works a copy of this License; and
|
|
||||||
|
|
||||||
(b) You must cause any modified files to carry prominent notices
|
|
||||||
stating that You changed the files; and
|
|
||||||
|
|
||||||
(c) You must retain, in the Source form of any Derivative Works
|
|
||||||
that You distribute, all copyright, patent, trademark, and
|
|
||||||
attribution notices from the Source form of the Work,
|
|
||||||
excluding those notices that do not pertain to any part of
|
|
||||||
the Derivative Works; and
|
|
||||||
|
|
||||||
(d) If the Work includes a "NOTICE" text file as part of its
|
|
||||||
distribution, then any Derivative Works that You distribute must
|
|
||||||
include a readable copy of the attribution notices contained
|
|
||||||
within such NOTICE file, excluding those notices that do not
|
|
||||||
pertain to any part of the Derivative Works, in at least one
|
|
||||||
of the following places: within a NOTICE text file distributed
|
|
||||||
as part of the Derivative Works; within the Source form or
|
|
||||||
documentation, if provided along with the Derivative Works; or,
|
|
||||||
within a display generated by the Derivative Works, if and
|
|
||||||
wherever such third-party notices normally appear. The contents
|
|
||||||
of the NOTICE file are for informational purposes only and
|
|
||||||
do not modify the License. You may add Your own attribution
|
|
||||||
notices within Derivative Works that You distribute, alongside
|
|
||||||
or as an addendum to the NOTICE text from the Work, provided
|
|
||||||
that such additional attribution notices cannot be construed
|
|
||||||
as modifying the License.
|
|
||||||
|
|
||||||
You may add Your own copyright statement to Your modifications and
|
|
||||||
may provide additional or different license terms and conditions
|
|
||||||
for use, reproduction, or distribution of Your modifications, or
|
|
||||||
for any such Derivative Works as a whole, provided Your use,
|
|
||||||
reproduction, and distribution of the Work otherwise complies with
|
|
||||||
the conditions stated in this License.
|
|
||||||
|
|
||||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
||||||
any Contribution intentionally submitted for inclusion in the Work
|
|
||||||
by You to the Licensor shall be under the terms and conditions of
|
|
||||||
this License, without any additional terms or conditions.
|
|
||||||
Notwithstanding the above, nothing herein shall supersede or modify
|
|
||||||
the terms of any separate license agreement you may have executed
|
|
||||||
with Licensor regarding such Contributions.
|
|
||||||
|
|
||||||
6. Trademarks. This License does not grant permission to use the trade
|
|
||||||
names, trademarks, service marks, or product names of the Licensor,
|
|
||||||
except as required for reasonable and customary use in describing the
|
|
||||||
origin of the Work and reproducing the content of the NOTICE file.
|
|
||||||
|
|
||||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
||||||
agreed to in writing, Licensor provides the Work (and each
|
|
||||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
||||||
implied, including, without limitation, any warranties or conditions
|
|
||||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
||||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
||||||
appropriateness of using or redistributing the Work and assume any
|
|
||||||
risks associated with Your exercise of permissions under this License.
|
|
||||||
|
|
||||||
8. Limitation of Liability. In no event and under no legal theory,
|
|
||||||
whether in tort (including negligence), contract, or otherwise,
|
|
||||||
unless required by applicable law (such as deliberate and grossly
|
|
||||||
negligent acts) or agreed to in writing, shall any Contributor be
|
|
||||||
liable to You for damages, including any direct, indirect, special,
|
|
||||||
incidental, or consequential damages of any character arising as a
|
|
||||||
result of this License or out of the use or inability to use the
|
|
||||||
Work (including but not limited to damages for loss of goodwill,
|
|
||||||
work stoppage, computer failure or malfunction, or any and all
|
|
||||||
other commercial damages or losses), even if such Contributor
|
|
||||||
has been advised of the possibility of such damages.
|
|
||||||
|
|
||||||
9. Accepting Warranty or Additional Liability. While redistributing
|
|
||||||
the Work or Derivative Works thereof, You may choose to offer,
|
|
||||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
||||||
or other liability obligations and/or rights consistent with this
|
|
||||||
License. However, in accepting such obligations, You may act only
|
|
||||||
on Your own behalf and on Your sole responsibility, not on behalf
|
|
||||||
of any other Contributor, and only if You agree to indemnify,
|
|
||||||
defend, and hold each Contributor harmless for any liability
|
|
||||||
incurred by, or claims asserted against, such Contributor by reason
|
|
||||||
of your accepting any such warranty or additional liability.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
APPENDIX: How to apply the Apache License to your work.
|
|
||||||
|
|
||||||
To apply the Apache License to your work, attach the following
|
|
||||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
|
||||||
replaced with your own identifying information. (Don't include
|
|
||||||
the brackets!) The text should be enclosed in the appropriate
|
|
||||||
comment syntax for the file format. We also recommend that a
|
|
||||||
file or class name and description of purpose be included on the
|
|
||||||
same "printed page" as the copyright notice for easier
|
|
||||||
identification within third-party archives.
|
|
||||||
|
|
||||||
Copyright 2015 AJ ONeal
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
28
README.md
@ -32,7 +32,7 @@ Features
|
|||||||
- [x] Automatical renewal (10 to 14 days before expiration)
|
- [x] Automatical renewal (10 to 14 days before expiration)
|
||||||
- [x] Great ACME support via [acme.js](https://git.coolaj86.com/coolaj86/acme-v2.js)
|
- [x] Great ACME support via [acme.js](https://git.coolaj86.com/coolaj86/acme-v2.js)
|
||||||
- [x] "dry run" with self-diagnostics
|
- [x] "dry run" with self-diagnostics
|
||||||
- [x] ACME draft 11
|
- [x] ACME draft 12
|
||||||
- [x] Let's Encrypt v2
|
- [x] Let's Encrypt v2
|
||||||
- [x] Let's Encrypt v1
|
- [x] Let's Encrypt v1
|
||||||
- [x] [Commandline](https://git.coolaj86.com/coolaj86/greenlock-cli.js) (cli) Utilities
|
- [x] [Commandline](https://git.coolaj86.com/coolaj86/greenlock-cli.js) (cli) Utilities
|
||||||
@ -74,8 +74,18 @@ Install
|
|||||||
npm install --save greenlock@2.x
|
npm install --save greenlock@2.x
|
||||||
```
|
```
|
||||||
|
|
||||||
**Note**: Ignore errors related to `ursa`. It is an optional dependency used when available.
|
**Optional** dependency for *more efficient* RSA key generation:
|
||||||
For many people it will not install properly, but it's only necessary on ARM devices (i.e. Raspberry Pi).
|
<small>(important for those on ARM devices like Raspberry Pi)</small>
|
||||||
|
```bash
|
||||||
|
npm install --save ursa
|
||||||
|
```
|
||||||
|
|
||||||
|
**Optional** dependency for *Let's Encrypt v01* (pre-draft ACME spec) compatibility:
|
||||||
|
<small>(important for those on ARM devices like Raspberry Pi)</small>
|
||||||
|
```bash
|
||||||
|
npm install --save le-acme-core
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
### Production vs Staging
|
### Production vs Staging
|
||||||
|
|
||||||
@ -134,7 +144,7 @@ var greenlock = Greenlock.create({
|
|||||||
, approveDomains: [ 'example.com' ]
|
, approveDomains: [ 'example.com' ]
|
||||||
, communityMember: false // Optionally get important updates (security, api changes, etc)
|
, communityMember: false // Optionally get important updates (security, api changes, etc)
|
||||||
// and submit stats to help make Greenlock better
|
// and submit stats to help make Greenlock better
|
||||||
, version: 'draft-11'
|
, version: 'draft-12'
|
||||||
, server: 'https://acme-v02.api.letsencrypt.org/directory'
|
, server: 'https://acme-v02.api.letsencrypt.org/directory'
|
||||||
, configDir: path.join(os.homedir(), 'acme/etc')
|
, configDir: path.join(os.homedir(), 'acme/etc')
|
||||||
});
|
});
|
||||||
@ -173,7 +183,7 @@ var os = require('os')
|
|||||||
var Greenlock = require('greenlock');
|
var Greenlock = require('greenlock');
|
||||||
|
|
||||||
var greenlock = Greenlock.create({
|
var greenlock = Greenlock.create({
|
||||||
version: 'draft-11'
|
version: 'draft-12'
|
||||||
, server: 'https://acme-v02.api.letsencrypt.org/directory'
|
, server: 'https://acme-v02.api.letsencrypt.org/directory'
|
||||||
|
|
||||||
// approve a growing list of domains
|
// approve a growing list of domains
|
||||||
@ -260,7 +270,7 @@ var opts = {
|
|||||||
////////////////////
|
////////////////////
|
||||||
|
|
||||||
var greenlock = require('greenlock').create({
|
var greenlock = require('greenlock').create({
|
||||||
version: 'draft-11'
|
version: 'draft-12'
|
||||||
, server: 'https://acme-v02.api.letsencrypt.org/directory'
|
, server: 'https://acme-v02.api.letsencrypt.org/directory'
|
||||||
, configDir: '/tmp/acme/etc'
|
, configDir: '/tmp/acme/etc'
|
||||||
});
|
});
|
||||||
@ -323,9 +333,9 @@ function leAgree(opts, agreeCb) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
greenlock = Greenlock.create({
|
greenlock = Greenlock.create({
|
||||||
version: 'draft-11' // 'draft-11' or 'v01'
|
version: 'draft-12' // 'draft-12' or 'v01'
|
||||||
// 'draft-11' is for Let's Encrypt v2 otherwise known as ACME draft 11
|
// 'draft-12' is for Let's Encrypt v2 otherwise known as ACME draft 12
|
||||||
// 'v02' is an alias for 'draft-11'
|
// 'v02' is an alias for 'draft-12'
|
||||||
// 'v01' is for the pre-spec Let's Encrypt v1
|
// 'v01' is for the pre-spec Let's Encrypt v1
|
||||||
//
|
//
|
||||||
// staging API
|
// staging API
|
||||||
|
72
index.js
@ -3,6 +3,23 @@
|
|||||||
var DAY = 24 * 60 * 60 * 1000;
|
var DAY = 24 * 60 * 60 * 1000;
|
||||||
//var MIN = 60 * 1000;
|
//var MIN = 60 * 1000;
|
||||||
var ACME = require('acme-v2/compat').ACME;
|
var ACME = require('acme-v2/compat').ACME;
|
||||||
|
var PromiseA;
|
||||||
|
try {
|
||||||
|
PromiseA = require('bluebird');
|
||||||
|
} catch(e) {
|
||||||
|
PromiseA = global.Promise;
|
||||||
|
}
|
||||||
|
var util = require('util');
|
||||||
|
function promisifyAllSelf(obj) {
|
||||||
|
if (obj.__promisified) { return obj; }
|
||||||
|
Object.keys(obj).forEach(function (key) {
|
||||||
|
if ('function' === typeof obj[key]) {
|
||||||
|
obj[key + 'Async'] = util.promisify(obj[key]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
obj.__promisified = true;
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
var Greenlock = module.exports;
|
var Greenlock = module.exports;
|
||||||
Greenlock.Greenlock = Greenlock;
|
Greenlock.Greenlock = Greenlock;
|
||||||
@ -70,9 +87,12 @@ Greenlock._undefine = function (gl) {
|
|||||||
return gl;
|
return gl;
|
||||||
};
|
};
|
||||||
Greenlock.create = function (gl) {
|
Greenlock.create = function (gl) {
|
||||||
var PromiseA = require('bluebird');
|
gl.store = gl.store || require('le-store-certbot').create({
|
||||||
|
debug: gl.debug
|
||||||
gl.store = gl.store || require('le-store-certbot').create({ debug: gl.debug });
|
, configDir: gl.configDir
|
||||||
|
, logsDir: gl.logsDir
|
||||||
|
, webrootPath: gl.webrootPath
|
||||||
|
});
|
||||||
gl.core = require('./lib/core');
|
gl.core = require('./lib/core');
|
||||||
var log = gl.log || _log;
|
var log = gl.log || _log;
|
||||||
|
|
||||||
@ -80,7 +100,10 @@ Greenlock.create = function (gl) {
|
|||||||
gl.challenges = {};
|
gl.challenges = {};
|
||||||
}
|
}
|
||||||
if (!gl.challenges['http-01']) {
|
if (!gl.challenges['http-01']) {
|
||||||
gl.challenges['http-01'] = require('le-challenge-fs').create({ debug: gl.debug });
|
gl.challenges['http-01'] = require('le-challenge-fs').create({
|
||||||
|
debug: gl.debug
|
||||||
|
, webrootPath: gl.webrootPath
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (!gl.challenges['dns-01']) {
|
if (!gl.challenges['dns-01']) {
|
||||||
try {
|
try {
|
||||||
@ -114,7 +137,7 @@ Greenlock.create = function (gl) {
|
|||||||
///////////////////////////
|
///////////////////////////
|
||||||
|
|
||||||
if (!gl.version) {
|
if (!gl.version) {
|
||||||
//console.warn("Please specify version: 'v01' (Let's Encrypt v1) or 'draft-11' (Let's Encrypt v2 / ACME draft 11)");
|
//console.warn("Please specify version: 'v01' (Let's Encrypt v1) or 'draft-12' (Let's Encrypt v2 / ACME draft 12)");
|
||||||
console.warn("");
|
console.warn("");
|
||||||
console.warn("");
|
console.warn("");
|
||||||
console.warn("");
|
console.warn("");
|
||||||
@ -124,8 +147,8 @@ Greenlock.create = function (gl) {
|
|||||||
console.warn("");
|
console.warn("");
|
||||||
console.warn("Please specify 'version' option:");
|
console.warn("Please specify 'version' option:");
|
||||||
console.warn("");
|
console.warn("");
|
||||||
console.warn(" 'draft-11' for Let's Encrypt v2 and ACME draft 11");
|
console.warn(" 'draft-12' for Let's Encrypt v2 and ACME draft 12");
|
||||||
console.warn(" ('v02' is an alias of 'draft-11'");
|
console.warn(" ('v02' is an alias of 'draft-12'");
|
||||||
console.warn("");
|
console.warn("");
|
||||||
console.warn("or");
|
console.warn("or");
|
||||||
console.warn("");
|
console.warn("");
|
||||||
@ -137,7 +160,11 @@ Greenlock.create = function (gl) {
|
|||||||
console.warn("");
|
console.warn("");
|
||||||
} else if ('v02' === gl.version) {
|
} else if ('v02' === gl.version) {
|
||||||
gl.version = 'draft-11';
|
gl.version = 'draft-11';
|
||||||
} else if ('v01' !== gl.version && 'draft-11' !== gl.version) {
|
} else if ('draft-12' === gl.version) {
|
||||||
|
gl.version = 'draft-11';
|
||||||
|
} else if ('draft-11' === gl.version) {
|
||||||
|
// no-op
|
||||||
|
} else if ('v01' !== gl.version) {
|
||||||
throw new Error("Unrecognized version '" + gl.version + "'");
|
throw new Error("Unrecognized version '" + gl.version + "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,7 +205,7 @@ Greenlock.create = function (gl) {
|
|||||||
console.warn("=== WARNING ===");
|
console.warn("=== WARNING ===");
|
||||||
console.warn("");
|
console.warn("");
|
||||||
console.warn("Let's Encrypt v1 is deprecated.");
|
console.warn("Let's Encrypt v1 is deprecated.");
|
||||||
console.warn("Please update to Let's Encrypt v2 (ACME draft 11)");
|
console.warn("Please update to Let's Encrypt v2 (ACME draft 12)");
|
||||||
console.warn("");
|
console.warn("");
|
||||||
try {
|
try {
|
||||||
return require('le-acme-core').ACME;
|
return require('le-acme-core').ACME;
|
||||||
@ -202,7 +229,7 @@ Greenlock.create = function (gl) {
|
|||||||
, 'https://acme-staging-v02.api.letsencrypt.org/directory' ].indexOf(gl.server)
|
, 'https://acme-staging-v02.api.letsencrypt.org/directory' ].indexOf(gl.server)
|
||||||
) {
|
) {
|
||||||
if ('draft-11' !== gl.version) {
|
if ('draft-11' !== gl.version) {
|
||||||
console.warn("Detected Let's Encrypt v02 URL. Changing version to draft-11.");
|
console.warn("Detected Let's Encrypt v02 URL. Changing version to draft-12.");
|
||||||
gl.version = 'draft-11';
|
gl.version = 'draft-11';
|
||||||
}
|
}
|
||||||
} else if (-1 !== [
|
} else if (-1 !== [
|
||||||
@ -228,7 +255,7 @@ Greenlock.create = function (gl) {
|
|||||||
if (gl.acme.create) {
|
if (gl.acme.create) {
|
||||||
gl.acme = gl.acme.create(gl);
|
gl.acme = gl.acme.create(gl);
|
||||||
}
|
}
|
||||||
gl.acme = PromiseA.promisifyAll(gl.acme);
|
gl.acme = promisifyAllSelf(gl.acme);
|
||||||
gl._acmeOpts = gl.acme.getOptions();
|
gl._acmeOpts = gl.acme.getOptions();
|
||||||
Object.keys(gl._acmeOpts).forEach(function (key) {
|
Object.keys(gl._acmeOpts).forEach(function (key) {
|
||||||
if (!(key in gl)) {
|
if (!(key in gl)) {
|
||||||
@ -239,9 +266,9 @@ Greenlock.create = function (gl) {
|
|||||||
if (gl.store.create) {
|
if (gl.store.create) {
|
||||||
gl.store = gl.store.create(gl);
|
gl.store = gl.store.create(gl);
|
||||||
}
|
}
|
||||||
gl.store = PromiseA.promisifyAll(gl.store);
|
gl.store = promisifyAllSelf(gl.store);
|
||||||
gl.store.accounts = PromiseA.promisifyAll(gl.store.accounts);
|
gl.store.accounts = promisifyAllSelf(gl.store.accounts);
|
||||||
gl.store.certificates = PromiseA.promisifyAll(gl.store.certificates);
|
gl.store.certificates = promisifyAllSelf(gl.store.certificates);
|
||||||
gl._storeOpts = gl.store.getOptions();
|
gl._storeOpts = gl.store.getOptions();
|
||||||
Object.keys(gl._storeOpts).forEach(function (key) {
|
Object.keys(gl._storeOpts).forEach(function (key) {
|
||||||
if (!(key in gl)) {
|
if (!(key in gl)) {
|
||||||
@ -268,7 +295,9 @@ Greenlock.create = function (gl) {
|
|||||||
if (challenger.create) {
|
if (challenger.create) {
|
||||||
challenger = gl.challenges[challengeType] = challenger.create(gl);
|
challenger = gl.challenges[challengeType] = challenger.create(gl);
|
||||||
}
|
}
|
||||||
challenger = gl.challenges[challengeType] = PromiseA.promisifyAll(challenger);
|
if (!challenger.getOptionsAsync) {
|
||||||
|
challenger = gl.challenges[challengeType] = promisifyAllSelf(challenger);
|
||||||
|
}
|
||||||
gl['_challengeOpts_' + challengeType] = challenger.getOptions();
|
gl['_challengeOpts_' + challengeType] = challenger.getOptions();
|
||||||
Object.keys(gl['_challengeOpts_' + challengeType]).forEach(function (key) {
|
Object.keys(gl['_challengeOpts_' + challengeType]).forEach(function (key) {
|
||||||
if (!(key in gl)) {
|
if (!(key in gl)) {
|
||||||
@ -377,7 +406,7 @@ Greenlock.create = function (gl) {
|
|||||||
console.error("");
|
console.error("");
|
||||||
cb(e);
|
cb(e);
|
||||||
}
|
}
|
||||||
);;
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log(gl.debug, 'gl getting from disk or registering new');
|
log(gl.debug, 'gl getting from disk or registering new');
|
||||||
@ -404,6 +433,17 @@ Greenlock.create = function (gl) {
|
|||||||
gl.sni = gl.sni.create(gl);
|
gl.sni = gl.sni.create(gl);
|
||||||
}
|
}
|
||||||
gl.tlsOptions.SNICallback = function (domain, cb) {
|
gl.tlsOptions.SNICallback = function (domain, cb) {
|
||||||
|
// format and (lightly) sanitize sni so that users can be naive
|
||||||
|
// and not have to worry about SQL injection or fs discovery
|
||||||
|
domain = (domain||'').toLowerCase();
|
||||||
|
// hostname labels allow a-z, 0-9, -, and are separated by dots
|
||||||
|
// _ is sometimes allowed
|
||||||
|
if (!/^[a-z0-9_\.\-]+$/i.test(domain) || -1 !== domain.indexOf('..')) {
|
||||||
|
log(gl.debug, "invalid sni '" + domain + "'");
|
||||||
|
cb(new Error("invalid SNI"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
gl.sni.sniCallback(domain, cb);
|
gl.sni.sniCallback(domain, cb);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
|
22
lib/core.js
@ -1,5 +1,23 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
var PromiseA;
|
||||||
|
try {
|
||||||
|
PromiseA = require('bluebird');
|
||||||
|
} catch(e) {
|
||||||
|
PromiseA = global.Promise;
|
||||||
|
}
|
||||||
|
var util = require('util');
|
||||||
|
function promisifyAll(obj) {
|
||||||
|
var aobj = {};
|
||||||
|
Object.keys(obj).forEach(function (key) {
|
||||||
|
if ('function' === typeof obj[key]) {
|
||||||
|
aobj[key] = obj[key];
|
||||||
|
aobj[key + 'Async'] = util.promisify(obj[key]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return aobj;
|
||||||
|
}
|
||||||
|
|
||||||
function _log(debug) {
|
function _log(debug) {
|
||||||
if (debug) {
|
if (debug) {
|
||||||
var args = Array.prototype.slice.call(arguments);
|
var args = Array.prototype.slice.call(arguments);
|
||||||
@ -10,9 +28,8 @@ function _log(debug) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module.exports.create = function (gl) {
|
module.exports.create = function (gl) {
|
||||||
var PromiseA = require('bluebird');
|
|
||||||
var utils = require('./utils');
|
var utils = require('./utils');
|
||||||
var RSA = PromiseA.promisifyAll(require('rsa-compat').RSA);
|
var RSA = promisifyAll(require('rsa-compat').RSA);
|
||||||
var log = gl.log || _log; // allow custom log
|
var log = gl.log || _log; // allow custom log
|
||||||
var pendingRegistrations = {};
|
var pendingRegistrations = {};
|
||||||
|
|
||||||
@ -301,6 +318,7 @@ module.exports.create = function (gl) {
|
|||||||
}).then(function (results) {
|
}).then(function (results) {
|
||||||
// { cert, chain, privkey /*TODO, subject, altnames, issuedAt, expiresAt */ }
|
// { cert, chain, privkey /*TODO, subject, altnames, issuedAt, expiresAt */ }
|
||||||
|
|
||||||
|
// args.certs.privkey = RSA.exportPrivatePem(options.domainKeypair);
|
||||||
args.certs = results;
|
args.certs = results;
|
||||||
// args.pems is deprecated
|
// args.pems is deprecated
|
||||||
args.pems = results;
|
args.pems = results;
|
||||||
|
BIN
logo/beaker-browser-301x112.png
Executable file
After Width: | Height: | Size: 3.4 KiB |
BIN
logo/digital-bazaar-301x112.png
Executable file
After Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 34 KiB |
BIN
logo/ibm-301x112.png
Executable file
After Width: | Height: | Size: 1.7 KiB |
BIN
logo/mozilla-iot-301x112.png
Executable file
After Width: | Height: | Size: 2.2 KiB |
BIN
logo/ppl-301x112.png
Executable file
After Width: | Height: | Size: 1.9 KiB |
BIN
logo/telebit-301x112.png
Executable file
After Width: | Height: | Size: 2.0 KiB |
54
package.json
@ -1,47 +1,37 @@
|
|||||||
{
|
{
|
||||||
"name": "greenlock",
|
"name": "greenlock",
|
||||||
"version": "2.2.18",
|
"version": "2.3.7",
|
||||||
"description": "Let's Encrypt for node.js on npm",
|
"description": "Let's Encrypt for node.js on npm",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
|
"files": [
|
||||||
|
"lib"
|
||||||
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://git.coolaj86.com/coolaj86/greenlock.js.git"
|
"url": "https://git.coolaj86.com/coolaj86/greenlock.js.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"acmev2",
|
"Let's Encrypt",
|
||||||
"acmev02",
|
"letsencrypt",
|
||||||
"acme-v2",
|
"ACME",
|
||||||
"acme-v02",
|
"v2",
|
||||||
"acme",
|
"v02",
|
||||||
"acme2",
|
"draft-11",
|
||||||
"acme11",
|
"draft-12",
|
||||||
"acme-draft11",
|
|
||||||
"acme-draft-11",
|
|
||||||
"auto-sni",
|
"auto-sni",
|
||||||
"draft",
|
"draft",
|
||||||
"11",
|
"11",
|
||||||
"free ssl",
|
"12",
|
||||||
"free https",
|
"Free SSL",
|
||||||
"free",
|
"Automated HTTPS",
|
||||||
"ssl",
|
|
||||||
"tls",
|
"tls",
|
||||||
"https",
|
"https",
|
||||||
"Let's Encrypt",
|
|
||||||
"letsencrypt",
|
|
||||||
"letsencrypt-v2",
|
|
||||||
"letsencrypt-v02",
|
|
||||||
"letsencryptv2",
|
|
||||||
"letsencryptv02",
|
|
||||||
"letsencrypt2",
|
|
||||||
"v2",
|
|
||||||
"v02",
|
|
||||||
"Greenlock",
|
"Greenlock",
|
||||||
"letsencrypt.org",
|
"letsencrypt.org",
|
||||||
"le",
|
"le",
|
||||||
"lejs",
|
|
||||||
"le.js",
|
"le.js",
|
||||||
"node",
|
"node",
|
||||||
"nodejs",
|
"nodejs",
|
||||||
@ -57,26 +47,28 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"request": "^2.75.0"
|
"request": "^2.75.0"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"trulyOptionalDependencies": {
|
||||||
"bluebird": "^3.5.1",
|
"bluebird": "^3.5.1",
|
||||||
"le-acme-core": "^2.1.3"
|
"le-acme-core": "^2.1.3",
|
||||||
|
"ursa": "^0.9.4"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"acme-v2": "^1.0.6",
|
"acme": "^1.0.6",
|
||||||
|
"acme-v2": "^1.2.0",
|
||||||
"asn1js": "^1.2.12",
|
"asn1js": "^1.2.12",
|
||||||
"certpem": "^1.0.0",
|
"certpem": "^1.0.0",
|
||||||
"le-challenge-fs": "^2.0.2",
|
"le-challenge-fs": "^2.0.2",
|
||||||
"le-sni-auto": "^2.1.3",
|
"le-sni-auto": "^2.1.3",
|
||||||
"le-store-certbot": "^2.1.0",
|
"le-store-certbot": "^2.1.7",
|
||||||
"node.extend": "^1.1.5",
|
"node.extend": "^1.1.5",
|
||||||
"pkijs": "^1.3.27",
|
"pkijs": "^1.3.27",
|
||||||
"rsa-compat": "^1.3.2"
|
"rsa-compat": "^1.4.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=4.5"
|
"node": ">=4.5"
|
||||||
},
|
},
|
||||||
"gitDependencies": {
|
"gitDependencies": {
|
||||||
"acme-v2": "git+https://git.coolaj86.com/coolaj86/acme-v2.js.git#v1.0",
|
"acme": "git+https://git.coolaj86.com/coolaj86/acme-.js.git#v1.0",
|
||||||
"le-acme-core": "git+https://git.coolaj86.com/coolaj86/le-acme-core.js.git#v2.1"
|
"le-acme-core": "git+https://git.coolaj86.com/coolaj86/le-acme-core.js.git#v2.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|