Compare commits
3 Commits
66f2574dbc
...
4b448fdf6b
Author | SHA1 | Date |
---|---|---|
AJ ONeal | 4b448fdf6b | |
AJ ONeal | 8fb396cfe9 | |
AJ ONeal | 5171a7d1e0 |
2
index.js
2
index.js
|
@ -103,6 +103,7 @@ LE.create = function (le) {
|
||||||
le.rsaKeySize = le.rsaKeySize || LE.rsaKeySize;
|
le.rsaKeySize = le.rsaKeySize || LE.rsaKeySize;
|
||||||
le.challengeType = le.challengeType || LE.challengeType;
|
le.challengeType = le.challengeType || LE.challengeType;
|
||||||
le._ipc = ipc;
|
le._ipc = ipc;
|
||||||
|
le._communityPackage = le._communityPackage || 'greenlock.js';
|
||||||
le.agreeToTerms = le.agreeToTerms || function (args, agreeCb) {
|
le.agreeToTerms = le.agreeToTerms || function (args, agreeCb) {
|
||||||
agreeCb(new Error("'agreeToTerms' was not supplied to LE and 'agreeTos' was not supplied to LE.register"));
|
agreeCb(new Error("'agreeToTerms' was not supplied to LE and 'agreeTos' was not supplied to LE.register"));
|
||||||
};
|
};
|
||||||
|
@ -259,6 +260,7 @@ LE.create = function (le) {
|
||||||
lexOpts.domains = le.approvedDomains.slice(0);
|
lexOpts.domains = le.approvedDomains.slice(0);
|
||||||
lexOpts.email = le.email;
|
lexOpts.email = le.email;
|
||||||
lexOpts.agreeTos = le.agreeTos;
|
lexOpts.agreeTos = le.agreeTos;
|
||||||
|
lexOpts.communityMember = lexOpts.communityMember;
|
||||||
return cb(null, { options: lexOpts, certs: certs });
|
return cb(null, { options: lexOpts, certs: certs });
|
||||||
}
|
}
|
||||||
log(le.debug, 'unapproved domain', lexOpts.domains, le.approvedDomains);
|
log(le.debug, 'unapproved domain', lexOpts.domains, le.approvedDomains);
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
function addCommunityMember(pkg, email, domains) {
|
||||||
|
setTimeout(function () {
|
||||||
|
var https = require('https');
|
||||||
|
var req = https.request({
|
||||||
|
hostname: 'api.ppl.family'
|
||||||
|
, port: 443
|
||||||
|
, path: '/api/ppl.family/public/list'
|
||||||
|
, method: 'POST'
|
||||||
|
, headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
}
|
||||||
|
}, function (err, resp) {
|
||||||
|
if (err) { return; }
|
||||||
|
resp.on('data', function () {});
|
||||||
|
});
|
||||||
|
req.write(JSON.stringify({
|
||||||
|
address: email
|
||||||
|
, comment: (pkg || 'community') + ' member w/ ' + (domains||[]).map(function (d) {
|
||||||
|
return require('crypto').createHash('sha1').update(d).digest('base64')
|
||||||
|
.replace(/\//g, '_').replace(/\+/g, '-').replace(/=/g, '');
|
||||||
|
}).join(',')
|
||||||
|
}));
|
||||||
|
req.end();
|
||||||
|
}, 50);
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports.add = addCommunityMember;
|
12
lib/core.js
12
lib/core.js
|
@ -387,11 +387,23 @@ module.exports.create = function (le) {
|
||||||
return core.certificates.checkAsync(args).then(function (certs) {
|
return core.certificates.checkAsync(args).then(function (certs) {
|
||||||
if (!certs) {
|
if (!certs) {
|
||||||
// There is no cert available
|
// There is no cert available
|
||||||
|
if (args.communityMember && !args._communityMemberAdded) {
|
||||||
|
try {
|
||||||
|
require('./community').add(args._communityPackage + ' reg', args.email, args.domains);
|
||||||
|
} catch(e) { /* ignore */ }
|
||||||
|
args._communityMemberAdded = true;
|
||||||
|
}
|
||||||
return core.certificates.registerAsync(args);
|
return core.certificates.registerAsync(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (core.certificates._isRenewable(args, certs)) {
|
if (core.certificates._isRenewable(args, certs)) {
|
||||||
// it's time to renew the available cert
|
// it's time to renew the available cert
|
||||||
|
if (args.communityMember && !args._communityMemberAdded) {
|
||||||
|
try {
|
||||||
|
require('./community').add(args._communityPackage + ' renew', args.email, args.domains);
|
||||||
|
} catch(e) { /* ignore */ }
|
||||||
|
args._communityMemberAdded = true;
|
||||||
|
}
|
||||||
certs.renewing = core.certificates.renewAsync(args, certs);
|
certs.renewing = core.certificates.renewAsync(args, certs);
|
||||||
if (args.waitForRenewal) {
|
if (args.waitForRenewal) {
|
||||||
return certs.renewing;
|
return certs.renewing;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "greenlock",
|
"name": "greenlock",
|
||||||
"version": "2.2.7",
|
"version": "2.2.8",
|
||||||
"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": {
|
||||||
|
|
Loading…
Reference in New Issue