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

Commit

Permalink
feat(ssl): supporting a certificate authority bundle file for the sec…
Browse files Browse the repository at this point in the history
…ured SSL configuration (#1342)
  • Loading branch information
lirantal committed Jun 7, 2016
1 parent fde27f0 commit c364922
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
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

0 comments on commit c364922

Please sign in to comment.