mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-07-13 21:03:04 +02:00
feat(ssl): supporting a certificate authority bundle file for the secured SSL configuration (#1342)
This commit is contained in:
3
config/env/production.js
vendored
3
config/env/production.js
vendored
@@ -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.
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user