Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Supporting a certificate authority bundle file for the secured SSL configuration. #1342

Merged
merged 1 commit into from
Jun 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion config/env/production.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ module.exports = {
secure: {
ssl: true,
privateKey: './config/sslcerts/key.pem',
certificate: './config/sslcerts/cert.pem'
certificate: './config/sslcerts/cert.pem',
caBundle: './config/sslcerts/cabundle.crt'
},
port: process.env.PORT || 8443,
// Binding to 127.0.0.1 is safer in production.
Expand Down
9 changes: 9 additions & 0 deletions config/lib/socket.io.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,18 @@ module.exports = function (app, db) {
// Load SSL key and certificate
var privateKey = fs.readFileSync(path.resolve(config.secure.privateKey), 'utf8');
var certificate = fs.readFileSync(path.resolve(config.secure.certificate), 'utf8');
var caBundle;

try {
caBundle = fs.readFileSync(path.resolve(config.secure.caBundle), 'utf8');
} catch (err) {
console.log('Warning: couldn\'t find or read caBundle file');
}

var options = {
key: privateKey,
cert: certificate,
ca: caBundle,
// requestCert : true,
// rejectUnauthorized : true,
secureProtocol: 'TLSv1_method',
Expand Down