Compare commits
3 Commits
ec5d2d326b
...
f89f301a7c
Author | SHA1 | Date |
---|---|---|
AJ ONeal | f89f301a7c | |
AJ ONeal | 672a659b70 | |
AJ ONeal | da270686c0 |
48
index.js
48
index.js
|
@ -312,6 +312,9 @@ Greenlock.create = function (gl) {
|
||||||
if (!gl.approveDomains) {
|
if (!gl.approveDomains) {
|
||||||
gl.approvedDomains = gl.approvedDomains || [];
|
gl.approvedDomains = gl.approvedDomains || [];
|
||||||
gl.approveDomains = function (lexOpts, certs, cb) {
|
gl.approveDomains = function (lexOpts, certs, cb) {
|
||||||
|
var err;
|
||||||
|
var emsg;
|
||||||
|
|
||||||
if (!gl.email) {
|
if (!gl.email) {
|
||||||
throw new Error("le-sni-auto is not properly configured. Missing email");
|
throw new Error("le-sni-auto is not properly configured. Missing email");
|
||||||
}
|
}
|
||||||
|
@ -330,8 +333,12 @@ Greenlock.create = function (gl) {
|
||||||
lexOpts.communityMember = lexOpts.communityMember;
|
lexOpts.communityMember = lexOpts.communityMember;
|
||||||
return cb(null, { options: lexOpts, certs: certs });
|
return cb(null, { options: lexOpts, certs: certs });
|
||||||
}
|
}
|
||||||
log(gl.debug, 'unapproved domain', lexOpts.domains, gl.approvedDomains);
|
|
||||||
cb(new Error("unapproved domain"));
|
emsg = "tls SNI for '" + lexOpts.domains.join(',') + "' rejected: not in list '" + gl.approvedDomains + "'";
|
||||||
|
log(gl.debug, emsg, lexOpts.domains, gl.approvedDomains);
|
||||||
|
err = new Error(emsg);
|
||||||
|
err.code = 'E_REJECT_SNI';
|
||||||
|
cb(err);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -343,7 +350,15 @@ Greenlock.create = function (gl) {
|
||||||
try {
|
try {
|
||||||
gl.approveDomains(opts, certs, function (_err, results) {
|
gl.approveDomains(opts, certs, function (_err, results) {
|
||||||
if (_err) {
|
if (_err) {
|
||||||
log(gl.debug, 'gl.approveDomains called with error', _err);
|
if (false !== gl.logRejectedDomains) {
|
||||||
|
console.error("[Error] approveDomains rejected tls sni '" + domain + "'");
|
||||||
|
console.error("[Error] (see https://git.coolaj86.com/coolaj86/greenlock.js/issues/11)");
|
||||||
|
if ('E_REJECT_SNI' !== _err.code) {
|
||||||
|
console.error("[Error] This is the rejection message:");
|
||||||
|
console.error(_err.message);
|
||||||
|
}
|
||||||
|
console.error("");
|
||||||
|
}
|
||||||
cb(_err);
|
cb(_err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -351,21 +366,30 @@ Greenlock.create = function (gl) {
|
||||||
log(gl.debug, 'gl.approveDomains called with certs for', results.certs && results.certs.altnames || 'NONE', 'and options:');
|
log(gl.debug, 'gl.approveDomains called with certs for', results.certs && results.certs.altnames || 'NONE', 'and options:');
|
||||||
log(gl.debug, results.options);
|
log(gl.debug, results.options);
|
||||||
|
|
||||||
var promise;
|
|
||||||
|
|
||||||
if (results.certs) {
|
if (results.certs) {
|
||||||
log(gl.debug, 'gl renewing');
|
log(gl.debug, 'gl renewing');
|
||||||
promise = gl.core.certificates.renewAsync(results.options, results.certs);
|
return gl.core.certificates.renewAsync(results.options, results.certs).then(
|
||||||
|
function (certs) { cb(null, certs); }
|
||||||
|
, function (e) {
|
||||||
|
console.debug("Error renewing certificate for '" + domain + "':");
|
||||||
|
console.debug(e);
|
||||||
|
console.error("");
|
||||||
|
cb(e);
|
||||||
|
}
|
||||||
|
);;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log(gl.debug, 'gl getting from disk or registering new');
|
log(gl.debug, 'gl getting from disk or registering new');
|
||||||
promise = gl.core.certificates.getAsync(results.options);
|
return gl.core.certificates.getAsync(results.options).then(
|
||||||
}
|
function (certs) { cb(null, certs); }
|
||||||
|
, function (e) {
|
||||||
return promise.then(function (certs) { cb(null, certs); }, function (e) {
|
console.debug("Error loading/registering certificate for '" + domain + "':");
|
||||||
if (gl.debug) { console.debug("Error"); console.debug(e); }
|
console.debug(e);
|
||||||
|
console.error("");
|
||||||
cb(e);
|
cb(e);
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
console.error("[ERROR] Something went wrong in approveDomains:");
|
console.error("[ERROR] Something went wrong in approveDomains:");
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "greenlock",
|
"name": "greenlock",
|
||||||
"version": "2.2.15",
|
"version": "2.2.16",
|
||||||
"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