diff --git a/config.template.yaml b/config.template.yaml index e9854ae7..e5784c12 100644 --- a/config.template.yaml +++ b/config.template.yaml @@ -35,6 +35,7 @@ https: keyfile: 'localhost.key' passphrase: '' certfile: 'localhost.cert' + cafile: '' # Page template values # title goes in the upper left corner, description goes in a tag diff --git a/lib/config.js b/lib/config.js index eb740525..11cba7e3 100644 --- a/lib/config.js +++ b/lib/config.js @@ -37,7 +37,8 @@ var defaults = { domain: "https://localhost", keyfile: "localhost.key", passphrase: "", - certfile: "localhost.cert" + certfile: "localhost.cert", + cafile: "" }, io: { domain: "http://localhost", diff --git a/lib/server.js b/lib/server.js index a2db6f97..14175812 100644 --- a/lib/server.js +++ b/lib/server.js @@ -78,10 +78,17 @@ var Server = function () { Config.get("https.keyfile"))); var cert = fs.readFileSync(path.resolve(__dirname, "..", Config.get("https.certfile"))); + var ca = undefined; + if (Config.get("https.cafile")) { + ca = fs.readFileSync(path.resolve(__dirname, "", + Config.get("https.cafile"))); + } + var opts = { key: key, cert: cert, - passphrase: Config.get("https.passphrase") + passphrase: Config.get("https.passphrase"), + ca: ca }; self.https = https.createServer(opts, self.express)