mirror of
				https://github.com/therootcompany/greenlock.js.git
				synced 2024-11-16 17:29:00 +00:00 
			
		
		
		
	Compare commits
	
		
			No commits in common. "master" and "v4.0.0" have entirely different histories.
		
	
	
		
	
		
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -1,5 +1,5 @@ | ||||
| greenlock.json* | ||||
| TODO* | ||||
| TODO.txt | ||||
| link.sh | ||||
| .env | ||||
| .greenlockrc | ||||
|  | ||||
| @ -1,36 +1,4 @@ | ||||
| # Migrating Guide | ||||
| 
 | ||||
| Greenlock v4 is the current version. | ||||
| 
 | ||||
| # v3 to v4 | ||||
| 
 | ||||
| v4 is a very minor, but breaking, change from v3 | ||||
| 
 | ||||
| ### `configFile` is replaced with `configDir` | ||||
| 
 | ||||
| The default config file `./greenlock.json` is now `./greenlock.d/config.json`. | ||||
| 
 | ||||
| This was change was mode to eliminate unnecessary configuration that was inadvertantly introduced in v3. | ||||
| 
 | ||||
| ### `.greenlockrc` is auto-generated | ||||
| 
 | ||||
| `.greenlockrc` exists for the sake of tooling - so that the CLI, Web API, and your code naturally stay in sync. | ||||
| 
 | ||||
| It looks like this: | ||||
| 
 | ||||
| ```json | ||||
| { | ||||
|     "manager": { | ||||
|         "module": "@greenlock/manager" | ||||
|     }, | ||||
|     "configDir": "./greenlock.d" | ||||
| } | ||||
| ``` | ||||
| 
 | ||||
| If you deploy to a read-only filesystem, it is best that you create the `.greenlockrc` file as part | ||||
| of your image and use that rather than including any configuration in your code. | ||||
| 
 | ||||
| # v2 to v4 | ||||
| # Migrating from Greenlock v2 to v3 | ||||
| 
 | ||||
| **Greenlock Express** uses Greenlock directly, the same as before. | ||||
| 
 | ||||
| @ -227,11 +195,11 @@ as well as a set of callbacks for easy configurability. | ||||
| 
 | ||||
| ### Default Manager | ||||
| 
 | ||||
| The default manager is `@greenlock/manager` and the default `configDir` is `./.greenlock.d`. | ||||
| The default manager is `greenlock-manager-fs` and the default `configFile` is `~/.config/greenlock/manager.json`. | ||||
| 
 | ||||
| The config file should look something like this: | ||||
| 
 | ||||
| `./greenlock.d/config.json`: | ||||
| `~/.config/greenlock/manager.json`: | ||||
| 
 | ||||
| ```json | ||||
| { | ||||
| @ -288,20 +256,29 @@ The same is true with `greenlock-store-*` plugins: | ||||
| 
 | ||||
| ### Customer Manager, the lazy way | ||||
| 
 | ||||
| At the very least you have to implement `get({ servername, wildname })`. | ||||
| At the very least you have to implement `find({ servername })`. | ||||
| 
 | ||||
| Since this is a very common use case, it's supported out of the box as part of the default manager plugin: | ||||
| 
 | ||||
| ```js | ||||
| var greenlock = Greenlock.create({ | ||||
|     packageAgent: pkg.name + '/' + pkg.version, | ||||
|     maintainerEmail: 'jon@example.com', | ||||
|     notify: notify, | ||||
| 
 | ||||
|     packageRoot: __dirname, | ||||
|     manager: { | ||||
|         module: './manager.js' | ||||
|     } | ||||
|     find: find | ||||
| }); | ||||
| 
 | ||||
| // In the simplest case you can ignore all incoming options | ||||
| // and return a single site config in the same format as the config file | ||||
| 
 | ||||
| function find(options) { | ||||
|     var servername = options.servername; // www.example.com | ||||
|     var wildname = options.wildname; // *.example.com | ||||
|     return Promise.resolve([ | ||||
|         { subject: 'example.com', altnames: ['example.com', 'www.example.com'] } | ||||
|     ]); | ||||
| } | ||||
| 
 | ||||
| function notify(ev, args) { | ||||
|     if ('error' === ev || 'warning' === ev) { | ||||
|         console.error(ev, args); | ||||
| @ -311,61 +288,102 @@ function notify(ev, args) { | ||||
| } | ||||
| ``` | ||||
| 
 | ||||
| In the simplest case you can ignore all incoming options | ||||
| and return a single site config in the same format as the config file | ||||
| 
 | ||||
| `./manager.js`: | ||||
| If you want to use wildcards or local domains, you must specify the `dns-01` challenge plugin to use: | ||||
| 
 | ||||
| ```js | ||||
| 'use strict'; | ||||
| 
 | ||||
| module.exports.create = function() { | ||||
|     return { | ||||
|         get: async function({ servername }) { | ||||
|             // do something to fetch the site | ||||
|             var site = { | ||||
|                 subject: 'example.com', | ||||
|                 altnames: ['example.com', 'www.example.com'] | ||||
|             }; | ||||
| 
 | ||||
|             return site; | ||||
|         } | ||||
|     }; | ||||
| }; | ||||
| ``` | ||||
| 
 | ||||
| If you want to use wildcards or local domains for a specific domain, you must specify the `dns-01` challenge plugin to use: | ||||
| 
 | ||||
| ```js | ||||
| 'use strict'; | ||||
| 
 | ||||
| module.exports.create = function() { | ||||
|     return { | ||||
|         get: async function({ servername }) { | ||||
|             // do something to fetch the site | ||||
|             var site = { | ||||
| function find(options) { | ||||
|     var subject = options.subject; | ||||
|     // may include wildcard | ||||
|     var altnames = options.altnames; | ||||
|     var wildname = options.wildname; // *.example.com | ||||
|     return Promise.resolve([ | ||||
|         { | ||||
|             subject: 'example.com', | ||||
|             altnames: ['example.com', 'www.example.com'], | ||||
| 
 | ||||
|                 // dns-01 challenge | ||||
|             challenges: { | ||||
|                     'dns-01': { | ||||
|                         module: 'acme-dns-01-namedotcom', | ||||
|                         apikey: 'xxxx' | ||||
|                 'dns-01': { module: 'acme-dns-01-namedotcom', apikey: 'xxxx' } | ||||
|             } | ||||
|         } | ||||
|     ]); | ||||
| } | ||||
| ``` | ||||
| 
 | ||||
| ### Customer Manager, complete | ||||
| 
 | ||||
| To use a fully custom manager, you give the npm package name, or absolute path to the file to load | ||||
| 
 | ||||
| ```js | ||||
| Greenlock.create({ | ||||
|     // Greenlock Options | ||||
|     maintainerEmail: 'jon@example.com', | ||||
|     packageAgent: 'my-package/v2.1.1', | ||||
|     notify: notify, | ||||
| 
 | ||||
|     // file path or npm package name | ||||
|     manager: '/path/to/manager.js', | ||||
|     // options that get passed to the manager | ||||
|     myFooOption: 'whatever' | ||||
| }); | ||||
| ``` | ||||
| 
 | ||||
| The manager itself is, again relatively simple: | ||||
| 
 | ||||
| -   find(options) | ||||
| -   set(siteConfig) | ||||
| -   remove(options) | ||||
| -   defaults(globalOptions) (as setter) | ||||
|     -   defaults() => globalOptions (as getter) | ||||
| 
 | ||||
| `/path/to/manager.js`: | ||||
| 
 | ||||
| ```js | ||||
| 'use strict'; | ||||
| 
 | ||||
| module.exports.create = function() { | ||||
|     var manager = {}; | ||||
| 
 | ||||
|     manager.find = async function({ subject, altnames, renewBefore }) { | ||||
|         if (subject) { | ||||
|             return getSiteConfigBySubject(subject); | ||||
|         } | ||||
| 
 | ||||
|         if (altnames) { | ||||
|             // may include wildcards | ||||
|             return getSiteConfigByAnyAltname(altnames); | ||||
|         } | ||||
| 
 | ||||
|         if (renewBefore) { | ||||
|             return getSiteConfigsWhereRenewAtIsLessThan(renewBefore); | ||||
|         } | ||||
| 
 | ||||
|         return []; | ||||
|     }; | ||||
| 
 | ||||
|             return site; | ||||
|     manage.set = function(opts) { | ||||
|         // this is called by greenlock.add({ subject, altnames }) | ||||
|         // it's also called by greenlock._update({ subject, renewAt }) | ||||
| 
 | ||||
|         return mergSiteConfig(subject, opts); | ||||
|     }; | ||||
| 
 | ||||
|     manage.remove = function({ subject, altname }) { | ||||
|         if (subject) { | ||||
|             return removeSiteConfig(subject); | ||||
|         } | ||||
| 
 | ||||
|         return removeFromSiteConfigAndResetRenewAtToZero(altname); | ||||
|     }; | ||||
| 
 | ||||
|     // set the global config | ||||
|     manage.defaults = function(options) { | ||||
|         if (!options) { | ||||
|             return getGlobalConfig(); | ||||
|         } | ||||
|         return mergeGlobalConfig(options); | ||||
|     }; | ||||
| }; | ||||
| ``` | ||||
| 
 | ||||
| ### Customer Manager, Complete | ||||
| 
 | ||||
| See <https://git.rootprojects.org/root/greenlock-manager-test.js#quick-start> | ||||
| 
 | ||||
| # ACME Challenge Plugins | ||||
| 
 | ||||
| The ACME challenge plugins are just a few simple callbacks: | ||||
| @ -401,3 +419,99 @@ They are described here: | ||||
| -   [greenlock store documentation](https://git.rootprojects.org/root/greenlock-store-test.js) | ||||
| 
 | ||||
| If you are just implenting in-house and are not going to publish a module, you can also do some hack things like this: | ||||
| 
 | ||||
| ### Custome Store, The hacky / lazy way | ||||
| 
 | ||||
| `/path/to/project/my-hacky-store.js`: | ||||
| 
 | ||||
| ```js | ||||
| 'use strict'; | ||||
| 
 | ||||
| module.exports.create = function(options) { | ||||
|     // ex: /path/to/account.ecdsa.jwk.json | ||||
|     var accountJwk = require(options.accountJwkPath); | ||||
|     // ex: /path/to/privkey.rsa.pem | ||||
|     var serverPem = fs.readFileSync(options.serverPemPath, 'ascii'); | ||||
|     var accounts = {}; | ||||
|     var certificates = {}; | ||||
|     var store = { accounts, certificates }; | ||||
| 
 | ||||
|     // bare essential account callbacks | ||||
|     accounts.checkKeypair = function() { | ||||
|         // ignore all options and just return a single, global keypair | ||||
| 
 | ||||
|         return Promise.resolve({ | ||||
|             privateKeyJwk: accountJwk | ||||
|         }); | ||||
|     }; | ||||
|     accounts.setKeypair = function() { | ||||
|         // this will never get called if checkKeypair always returns | ||||
| 
 | ||||
|         return Promise.resolve({}); | ||||
|     }; | ||||
| 
 | ||||
|     // bare essential cert and key callbacks | ||||
|     certificates.checkKeypair = function() { | ||||
|         // ignore all options and just return a global server keypair | ||||
| 
 | ||||
|         return { | ||||
|             privateKeyPem: serverPem | ||||
|         }; | ||||
|     }; | ||||
|     certificates.setKeypair = function() { | ||||
|         // never gets called if checkKeypair always returns an existing key | ||||
| 
 | ||||
|         return Promise.resolve(null); | ||||
|     }; | ||||
| 
 | ||||
|     certificates.check = function(args) { | ||||
|         var subject = args.subject; | ||||
|         // make a database call or whatever to get a certificate | ||||
|         return goGetCertBySubject(subject).then(function() { | ||||
|             return { | ||||
|                 pems: { | ||||
|                     chain: '<PEM>', | ||||
|                     cert: '<PEM>' | ||||
|                 } | ||||
|             }; | ||||
|         }); | ||||
|     }; | ||||
|     certificates.set = function(args) { | ||||
|         var subject = args.subject; | ||||
|         var cert = args.pems.cert; | ||||
|         var chain = args.pems.chain; | ||||
| 
 | ||||
|         // make a database call or whatever to get a certificate | ||||
|         return goSaveCert({ | ||||
|             subject, | ||||
|             cert, | ||||
|             chain | ||||
|         }); | ||||
|     }; | ||||
| }; | ||||
| ``` | ||||
| 
 | ||||
| ### Using the hacky / lazy store plugin | ||||
| 
 | ||||
| That sort of implementation won't pass the test suite, but it'll work just fine a use case where you only have one subscriber email (most of the time), | ||||
| you only have one server key (not recommended, but works), and you only really want to worry about storing cetificates. | ||||
| 
 | ||||
| Then you could assign it as the default for all of your sites: | ||||
| 
 | ||||
| ```json | ||||
| { | ||||
|     "subscriberEmail": "jon@example.com", | ||||
|     "agreeToTerms": true, | ||||
|     "sites": { | ||||
|         "example.com": { | ||||
|             "subject": "example.com", | ||||
|             "altnames": ["example.com", "www.example.com"] | ||||
|         } | ||||
|     }, | ||||
|     "store": { | ||||
|         "module": "/path/to/project/my-hacky-store.js", | ||||
|         "accountJwkPath": "/path/to/account.ecdsa.jwk.json", | ||||
|         "serverPemPath": "/path/to/privkey.rsa.pem" | ||||
|     } | ||||
| } | ||||
| ``` | ||||
							
								
								
									
										21
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								README.md
									
									
									
									
									
								
							| @ -1,10 +1,12 @@ | ||||
| # New Documentation & [v4 Migration Guide](https://git.rootprojects.org/root/greenlock.js/src/branch/master/MIGRATION_GUIDE.md) | ||||
| # New Documentation & [v2/v3 Migration Guide](https://git.rootprojects.org/root/greenlock.js/src/branch/v3/MIGRATION_GUIDE_V2_V3.md) | ||||
| 
 | ||||
| Greenlock v3 was just released from private beta **today** (Nov 1st, 2019). | ||||
| 
 | ||||
| We're still working on the full documentation for this new version, | ||||
| so please be patient. | ||||
| 
 | ||||
| To start, check out the | ||||
| [Migration Guide](https://git.rootprojects.org/root/greenlock.js/src/branch/master/MIGRATION_GUIDE.md). | ||||
| [Migration Guide](https://git.rootprojects.org/root/greenlock.js/src/branch/v3/MIGRATION_GUIDE_V2_V3.md). | ||||
| 
 | ||||
|  | ||||
| 
 | ||||
| @ -83,11 +85,12 @@ Certificates are renewed every 45 days by default, and renewal checks will happe | ||||
| var pkg = require('./package.json'); | ||||
| var Greenlock = require('greenlock'); | ||||
| var greenlock = Greenlock.create({ | ||||
|     packageRoot: __dirname, | ||||
|     configDir: "./greenlock.d/", | ||||
|     packageAgent: pkg.name + '/' + pkg.version, | ||||
|     maintainerEmail: pkg.author, | ||||
|     staging: true, | ||||
|     manager: require('greenlock-manager-fs').create({ | ||||
|         configFile: '~/.config/greenlock/manager.json' | ||||
|     }), | ||||
|     notify: function(event, details) { | ||||
|         if ('error' === event) { | ||||
|             // `details` is an error object in this case | ||||
| @ -168,7 +171,7 @@ greenlock | ||||
| --> | ||||
| 
 | ||||
| <details> | ||||
| <summary>Greenlock.create({ configDir, packageAgent, maintainerEmail, staging })</summary> | ||||
| <summary>Greenlock.create({ packageAgent, maintainerEmail, staging })</summary> | ||||
| 
 | ||||
| ## Greenlock.create() | ||||
| 
 | ||||
| @ -178,15 +181,12 @@ Creates an instance of greenlock with _environment_-level values. | ||||
| 
 | ||||
| var pkg = require('./package.json'); | ||||
| var gl = Greenlock.create({ | ||||
|     configDir: './greenlock.d/', | ||||
| 
 | ||||
|     // Staging for testing environments | ||||
|     staging: true, | ||||
| 
 | ||||
|     // This should be the contact who receives critical bug and security notifications | ||||
|     // Optionally, you may receive other (very few) updates, such as important new features | ||||
|     maintainerEmail: 'jon@example.com', | ||||
| 
 | ||||
|     // for an RFC 8555 / RFC 7231 ACME client user agent | ||||
|     packageAgent: pkg.name + '/' pkg.version | ||||
| }); | ||||
| @ -194,7 +194,6 @@ var gl = Greenlock.create({ | ||||
| 
 | ||||
| | Parameter       | Description                                                                          | | ||||
| | --------------- | ------------------------------------------------------------------------------------ | | ||||
| | configDir       | the directory to use for file-based plugins                                          | | ||||
| | maintainerEmail | the developer contact for critical bug and security notifications                    | | ||||
| | packageAgent    | if you publish your package for others to use, `require('./package.json').name` here | | ||||
| | staging         | use the Let's Encrypt staging URL instead of the production URL                      | | ||||
| @ -403,8 +402,8 @@ Greenlock comes with reasonable defaults but when you install it, | ||||
| you should also install any plugins that you need. | ||||
| 
 | ||||
| ```bash | ||||
| npm install --save @root/greenlock@v4 | ||||
| npm install --save @greenlock/manager | ||||
| npm install --save @root/greenlock | ||||
| npm install --save greenlock-manager-fs | ||||
| npm install --save greenlock-store-fs | ||||
| npm install --save acme-http-01-standalone | ||||
| ``` | ||||
|  | ||||
| @ -5,20 +5,14 @@ var args = process.argv.slice(2); | ||||
| var arg0 = args[0]; | ||||
| //console.log(args);
 | ||||
| 
 | ||||
| var found = [ | ||||
|     'certonly', | ||||
|     'add', | ||||
|     'update', | ||||
|     'config', | ||||
|     'defaults', | ||||
|     'remove', | ||||
|     'init' | ||||
| ].some(function(k) { | ||||
| var found = ['certonly', 'add', 'update', 'config', 'defaults', 'remove', 'init'].some( | ||||
|     function(k) { | ||||
|         if (k === arg0) { | ||||
|             require('./' + k); | ||||
|             return true; | ||||
|         } | ||||
| }); | ||||
|     } | ||||
| ); | ||||
| 
 | ||||
| if (!found) { | ||||
|     console.error(arg0 + ': command not yet implemented'); | ||||
|  | ||||
| @ -36,9 +36,6 @@ cli.main(async function(argList, flags) { | ||||
|     flags.manager.module = manager; | ||||
| 
 | ||||
|     try { | ||||
|         if ('.' === String(manager)[0]) { | ||||
|             manager = require('path').resolve(pkgRoot, manager); | ||||
|         } | ||||
|         P._loadSync(manager); | ||||
|     } catch (e) { | ||||
|         try { | ||||
|  | ||||
| @ -14,7 +14,7 @@ require('greenlock-express') | ||||
|             // contact for security and critical bug notices
 | ||||
|             //maintainerEmail: pkg.author,
 | ||||
| 
 | ||||
|             // where to look for configuration
 | ||||
|             // contact for security and critical bug notices
 | ||||
|             configDir: './greenlock.d', | ||||
| 
 | ||||
|             // whether or not to run at cloudscale
 | ||||
|  | ||||
| @ -9,7 +9,7 @@ require('greenlock-express') | ||||
|         // contact for security and critical bug notices
 | ||||
|         //maintainerEmail: pkg.author,
 | ||||
| 
 | ||||
|         // where to look for configuration
 | ||||
|         // contact for security and critical bug notices
 | ||||
|         configDir: './greenlock.d', | ||||
| 
 | ||||
|         // whether or not to run at cloudscale
 | ||||
|  | ||||
							
								
								
									
										30
									
								
								greenlock.js
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								greenlock.js
									
									
									
									
									
								
							| @ -55,6 +55,15 @@ G.create = function(gconf) { | ||||
|             gdefaults.notify = _notify; | ||||
|         } | ||||
| 
 | ||||
|         /* | ||||
|         if (!gconf.packageRoot) { | ||||
|             gconf.packageRoot = process.cwd(); | ||||
|             console.warn( | ||||
|                 '`packageRoot` not defined, trying ' + gconf.packageRoot | ||||
|             ); | ||||
|         } | ||||
|         */ | ||||
| 
 | ||||
|         gconf = Init._init(gconf); | ||||
| 
 | ||||
|         // OK: /path/to/blah
 | ||||
| @ -62,12 +71,6 @@ G.create = function(gconf) { | ||||
|         // NOT OK: ./rel/path/to/blah
 | ||||
|         // Error: .blah
 | ||||
|         if ('.' === (gconf.manager.module || '')[0]) { | ||||
|             if (!gconf.packageRoot) { | ||||
|                 gconf.packageRoot = process.cwd(); | ||||
|                 console.warn( | ||||
|                     '`packageRoot` not defined, trying ' + gconf.packageRoot | ||||
|                 ); | ||||
|             } | ||||
|             gconf.manager.module = | ||||
|                 gconf.packageRoot + '/' + gconf.manager.module.slice(2); | ||||
|         } | ||||
| @ -423,23 +426,14 @@ G.create = function(gconf) { | ||||
|         storeConf = JSON.parse(JSON.stringify(storeConf)); | ||||
|         storeConf.packageRoot = gconf.packageRoot; | ||||
| 
 | ||||
|         var path = require('path'); | ||||
|         if (!storeConf.basePath) { | ||||
|             storeConf.basePath = gconf.configDir; | ||||
|         } | ||||
| 
 | ||||
|         if ('.' === (storeConf.basePath || '')[0]) { | ||||
|             if (!gconf.packageRoot) { | ||||
|                 gconf.packageRoot = process.cwd(); | ||||
|                 console.warn( | ||||
|                     '`packageRoot` not defined, trying ' + gconf.packageRoot | ||||
|                 ); | ||||
|             } | ||||
|             storeConf.basePath = require('path').resolve( | ||||
|                 gconf.packageRoot || '', | ||||
|         storeConf.basePath = path.resolve( | ||||
|             gconf.packageRoot || process.cwd(), | ||||
|             storeConf.basePath | ||||
|         ); | ||||
|         } | ||||
| 
 | ||||
|         storeConf.directoryUrl = dirUrl; | ||||
|         var store = await P._loadStore(storeConf); | ||||
|         var account = await A._getOrCreate( | ||||
|  | ||||
| @ -124,10 +124,8 @@ Init._init = function(opts) { | ||||
|         ); | ||||
|     } | ||||
| 
 | ||||
|     opts.configFile = path.join( | ||||
|         path.resolve(opts.packageRoot, opts.configDir), | ||||
|         'config.json' | ||||
|     ); | ||||
|     //var mkdirp = promisify(require("@root/mkdirp"));
 | ||||
|     opts.configFile = path.join(opts.configDir, 'config.json'); | ||||
|     var config; | ||||
|     try { | ||||
|         config = JSON.parse(fs.readFileSync(opts.configFile)); | ||||
|  | ||||
| @ -12,25 +12,13 @@ module.exports.wrap = function(greenlock, gconf) { | ||||
|     var myFind = gconf.find; | ||||
|     delete gconf.find; | ||||
| 
 | ||||
|     var mega = mergeManager(greenlock, gconf); | ||||
|     var mega = mergeManager(gconf); | ||||
| 
 | ||||
|     greenlock.manager = {}; | ||||
|     greenlock.sites = {}; | ||||
|     //greenlock.accounts = {};
 | ||||
|     //greenlock.certs = {};
 | ||||
| 
 | ||||
|     greenlock.manager._modulename = gconf.manager.module; | ||||
|     if ('/' === String(gconf.manager.module)[0]) { | ||||
|         greenlock.manager._modulename = require('path').relative( | ||||
|             gconf.packageRoot, | ||||
|             greenlock.manager._modulename | ||||
|         ); | ||||
|         if ('.' !== String(greenlock.manager._modulename)[0]) { | ||||
|             greenlock.manager._modulename = | ||||
|                 './' + greenlock.manager._modulename; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     var allowed = [ | ||||
|         'accountKeyType', //: ["P-256", "RSA-2048"],
 | ||||
|         'serverKeyType', //: ["RSA-2048", "P-256"],
 | ||||
| @ -421,7 +409,6 @@ function loadManager(gconf) { | ||||
|         ); | ||||
|     } | ||||
|     */ | ||||
| 
 | ||||
|     try { | ||||
|         // wrap this to be safe for @greenlock/manager
 | ||||
|         m = require(gconf.manager.module).create(gconf.manager); | ||||
| @ -444,7 +431,7 @@ function loadManager(gconf) { | ||||
|     return m; | ||||
| } | ||||
| 
 | ||||
| function mergeManager(greenlock, gconf) { | ||||
| function mergeManager(gconf) { | ||||
|     var mng; | ||||
|     function m() { | ||||
|         if (mng) { | ||||
| @ -505,46 +492,8 @@ function mergeManager(greenlock, gconf) { | ||||
|     } | ||||
| 
 | ||||
|     if (mini.get) { | ||||
|         mega.get = async function(opts) { | ||||
|             if (mini.set) { | ||||
|         mega.get = function(opts) { | ||||
|             return mini.get(opts); | ||||
|             } | ||||
| 
 | ||||
|             if (!mega._get) { | ||||
|                 mega._get = m().get; | ||||
|             } | ||||
| 
 | ||||
|             var existing = await mega._get(opts); | ||||
|             var site = await mini.get(opts); | ||||
|             if (!existing) { | ||||
|                 // Add
 | ||||
|                 if (!site) { | ||||
|                     return; | ||||
|                 } | ||||
|                 site.renewAt = 1; | ||||
|                 site.deletedAt = 0; | ||||
|                 await mega.set(site); | ||||
|                 existing = await mega._get(opts); | ||||
|             } else if (!site) { | ||||
|                 // Delete
 | ||||
|                 existing.deletedAt = site.deletedAt || Date.now(); | ||||
|                 await mega.set(existing); | ||||
|                 existing = null; | ||||
|             } else if ( | ||||
|                 site.subject !== existing.subject || | ||||
|                 site.altnames.join(' ') !== existing.altnames.join(' ') | ||||
|             ) { | ||||
|                 // Update
 | ||||
|                 site.renewAt = 1; | ||||
|                 site.deletedAt = 0; | ||||
|                 await mega.set(site); | ||||
|                 existing = await mega._get(opts); | ||||
|                 if (!existing) { | ||||
|                     throw new Error('failed to `get` after `set`'); | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             return existing; | ||||
|         }; | ||||
|     } else if (mini.find) { | ||||
|         mega.get = function(opts) { | ||||
| @ -567,21 +516,6 @@ function mergeManager(greenlock, gconf) { | ||||
|         mega.get = m().get; | ||||
|     } | ||||
| 
 | ||||
|     if (!mega.find) { | ||||
|         mega._nofind = false; | ||||
|         mega.find = async function(opts) { | ||||
|             if (!mega._nofind) { | ||||
|                 console.warn( | ||||
|                     'Warning: manager `' + | ||||
|                         greenlock.manager._modulename + | ||||
|                         '` does not implement `find({})`\n' | ||||
|                 ); | ||||
|                 mega._nofind = true; | ||||
|             } | ||||
|             return []; | ||||
|         }; | ||||
|     } | ||||
| 
 | ||||
|     if (!mega.get) { | ||||
|         mega.get = function(opts) { | ||||
|             var servername = opts.servername; | ||||
|  | ||||
							
								
								
									
										32
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										32
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @ -1,6 +1,6 @@ | ||||
| { | ||||
|     "name": "@root/greenlock", | ||||
|     "version": "4.0.5", | ||||
|     "version": "4.0.0", | ||||
|     "lockfileVersion": 1, | ||||
|     "requires": true, | ||||
|     "dependencies": { | ||||
| @ -24,23 +24,15 @@ | ||||
|             } | ||||
|         }, | ||||
|         "@root/acme": { | ||||
|             "version": "3.1.0", | ||||
|             "resolved": "https://registry.npmjs.org/@root/acme/-/acme-3.1.0.tgz", | ||||
|             "integrity": "sha512-GAyaW63cpSYd2KvVp5lHLbCWeEhJPKZK9nsJvZJOKsD9Uv88KEttn4FpDZEJ+2q3Jsey0DWpuQ2I4ft0JV9p2w==", | ||||
|             "version": "3.0.8", | ||||
|             "resolved": "https://registry.npmjs.org/@root/acme/-/acme-3.0.8.tgz", | ||||
|             "integrity": "sha512-VmBvLvWdCDkolkanI9Dzm1ouSWPaAa2eCCwcDZcVQbWoNiUIOqbbd57fcMA/gZxLyuJPStD2WXFuEuSMPDxcww==", | ||||
|             "requires": { | ||||
|                 "@root/csr": "^0.8.1", | ||||
|                 "@root/encoding": "^1.0.1", | ||||
|                 "@root/keypairs": "^0.10.0", | ||||
|                 "@root/keypairs": "^0.9.0", | ||||
|                 "@root/pem": "^1.0.4", | ||||
|                 "@root/request": "^1.6.1", | ||||
|                 "@root/request": "^1.3.11", | ||||
|                 "@root/x509": "^0.7.2" | ||||
|             }, | ||||
|             "dependencies": { | ||||
|                 "@root/request": { | ||||
|                     "version": "1.6.1", | ||||
|                     "resolved": "https://registry.npmjs.org/@root/request/-/request-1.6.1.tgz", | ||||
|                     "integrity": "sha512-8wrWyeBLRp7T8J36GkT3RODJ6zYmL0/maWlAUD5LOXT28D3TDquUepyYDKYANNA3Gc8R5ZCgf+AXvSTYpJEWwQ==" | ||||
|                 } | ||||
|             } | ||||
|         }, | ||||
|         "@root/asn1": { | ||||
| @ -67,9 +59,9 @@ | ||||
|             "integrity": "sha512-OaEub02ufoU038gy6bsNHQOjIn8nUjGiLcaRmJ40IUykneJkIW5fxDqKxQx48cszuNflYldsJLPPXCrGfHs8yQ==" | ||||
|         }, | ||||
|         "@root/keypairs": { | ||||
|             "version": "0.10.0", | ||||
|             "resolved": "https://registry.npmjs.org/@root/keypairs/-/keypairs-0.10.0.tgz", | ||||
|             "integrity": "sha512-t8VocY46Mtb0NTsxzyLLf5tsgfw0BXLYVADAyiRdEdqHcvPFGJdjkXNtHVQuSV/FMaC65iTOHVP4E6X8iT3Ikg==", | ||||
|             "version": "0.9.0", | ||||
|             "resolved": "https://registry.npmjs.org/@root/keypairs/-/keypairs-0.9.0.tgz", | ||||
|             "integrity": "sha512-NXE2L9Gv7r3iC4kB/gTPZE1vO9Ox/p14zDzAJ5cGpTpytbWOlWF7QoHSJbtVX4H7mRG/Hp7HR3jWdWdb2xaaXg==", | ||||
|             "requires": { | ||||
|                 "@root/encoding": "^1.0.1", | ||||
|                 "@root/pem": "^1.0.4", | ||||
| @ -87,9 +79,9 @@ | ||||
|             "integrity": "sha512-rEUDiUsHtild8GfIjFE9wXtcVxeS+ehCJQBwbQQ3IVfORKHK93CFnRtkr69R75lZFjcmKYVc+AXDB+AeRFOULA==" | ||||
|         }, | ||||
|         "@root/request": { | ||||
|             "version": "1.6.1", | ||||
|             "resolved": "https://registry.npmjs.org/@root/request/-/request-1.6.1.tgz", | ||||
|             "integrity": "sha512-8wrWyeBLRp7T8J36GkT3RODJ6zYmL0/maWlAUD5LOXT28D3TDquUepyYDKYANNA3Gc8R5ZCgf+AXvSTYpJEWwQ==" | ||||
|             "version": "1.4.2", | ||||
|             "resolved": "https://registry.npmjs.org/@root/request/-/request-1.4.2.tgz", | ||||
|             "integrity": "sha512-J8FM4+SJuc7WRC+Jz17m+VT2lgI7HtatHhxN1F2ck5aIKUAxJEaR4u/gLBsgT60mVHevKCjKN0O8115UtJjwLw==" | ||||
|         }, | ||||
|         "@root/x509": { | ||||
|             "version": "0.7.2", | ||||
|  | ||||
| @ -1,6 +1,6 @@ | ||||
| { | ||||
|     "name": "@root/greenlock", | ||||
|     "version": "4.0.5", | ||||
|     "version": "4.0.0", | ||||
|     "description": "The easiest Let's Encrypt client for Node.js and Browsers", | ||||
|     "homepage": "https://rootprojects.org/greenlock/", | ||||
|     "main": "greenlock.js", | ||||
| @ -39,11 +39,11 @@ | ||||
|     "license": "MPL-2.0", | ||||
|     "dependencies": { | ||||
|         "@greenlock/manager": "^3.1.0", | ||||
|         "@root/acme": "^3.1.0", | ||||
|         "@root/acme": "^3.0.8", | ||||
|         "@root/csr": "^0.8.1", | ||||
|         "@root/keypairs": "^0.10.0", | ||||
|         "@root/keypairs": "^0.9.0", | ||||
|         "@root/mkdirp": "^1.0.0", | ||||
|         "@root/request": "^1.6.1", | ||||
|         "@root/request": "^1.4.2", | ||||
|         "acme-http-01-standalone": "^3.0.5", | ||||
|         "cert-info": "^1.5.1", | ||||
|         "greenlock-store-fs": "^3.2.2", | ||||
|  | ||||
| @ -146,7 +146,7 @@ P._normalizeChallenge = function(name, ch) { | ||||
|         }; | ||||
|     } | ||||
| 
 | ||||
|     // init, zones, set, get, remove, propagationDelay
 | ||||
|     // init, zones, set, get, remove
 | ||||
|     if (ch.init) { | ||||
|         if (2 === ch.init.length) { | ||||
|             warn(); | ||||
| @ -183,9 +183,6 @@ P._normalizeChallenge = function(name, ch) { | ||||
|         } | ||||
|         gch.get = wrappy(ch.get); | ||||
|     } | ||||
|     if("number" === typeof ch.propagationDelay) { | ||||
|         gch.propagationDelay = ch.propagationDelay; | ||||
|     } | ||||
| 
 | ||||
|     return gch; | ||||
| }; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user