Add CA bundle option in SSL

This commit is contained in:
Metsjeesus 2017-04-10 18:49:58 +00:00
parent 8627bbb713
commit fa51a2c281
2 changed files with 18 additions and 2 deletions

View file

@ -287,7 +287,16 @@ module.exports = {
// @example "sslcert/key-cert.pem"
// @default ""
//
certificate: ""
certificate: "",
//
// Path to the CA bundle.
//
// @type string
// @example "sslcert/bundle.pem"
// @default ""
//
ca: ""
},
//

View file

@ -44,6 +44,7 @@ module.exports = function() {
} else {
const keyPath = Helper.expandHome(config.https.key);
const certPath = Helper.expandHome(config.https.certificate);
const caPath = Helper.expandHome(config.https.ca);
if (!keyPath.length || !fs.existsSync(keyPath)) {
log.error("Path to SSL key is invalid. Stopping server...");
@ -55,10 +56,16 @@ module.exports = function() {
process.exit();
}
if (caPath.length && !fs.existsSync(caPath)) {
log.error("Path to SSL ca bundle is invalid. Stopping server...");
process.exit();
}
server = require("spdy");
server = server.createServer({
key: fs.readFileSync(keyPath),
cert: fs.readFileSync(certPath)
cert: fs.readFileSync(certPath),
ca: caPath ? fs.readFileSync(caPath) : undefined
}, app);
}