37 lines
1.3 KiB
JavaScript
37 lines
1.3 KiB
JavaScript
"use strict";
|
|
|
|
// this is the stuff that should run in the main foreground process,
|
|
// whether it's single or master
|
|
|
|
var major = process.versions.node.split(".")[0];
|
|
var minor = process.versions.node.split(".")[1];
|
|
var _hasSetSecureContext = false;
|
|
var shouldUpgrade = false;
|
|
|
|
// TODO can we trust earlier versions as well?
|
|
if (major >= 12) {
|
|
_hasSetSecureContext = !!require("http2").createSecureServer({}, function() {}).setSecureContext;
|
|
} else {
|
|
_hasSetSecureContext = !!require("https").createServer({}, function() {}).setSecureContext;
|
|
}
|
|
|
|
// TODO document in issues
|
|
if (!_hasSetSecureContext) {
|
|
// TODO this isn't necessary if greenlock options are set with options.cert
|
|
console.warn("Warning: node " + process.version + " is missing tlsSocket.setSecureContext().");
|
|
console.warn(" The default certificate may not be set.");
|
|
shouldUpgrade = true;
|
|
}
|
|
|
|
if (major < 11 || (11 === major && minor < 2)) {
|
|
// https://github.com/nodejs/node/issues/24095
|
|
console.warn("Warning: node " + process.version + " is missing tlsSocket.getCertificate().");
|
|
console.warn(" This is necessary to guard against domain fronting attacks.");
|
|
shouldUpgrade = true;
|
|
}
|
|
|
|
if (shouldUpgrade) {
|
|
console.warn("Warning: Please upgrade to node v11.2.0 or greater.");
|
|
console.warn();
|
|
}
|