Support for intermediate certificates in SSL
This commit is contained in:
1 parent
d82c2bb350
commit
bf0cd2af72
1 file changed
+7
@@ -68,10 +68,17 @@ if useHttps
|
|||||||
fs = require 'fs'
|
fs = require 'fs'
|
||||||
httpsKey = path.resolve(config.get('CONFIG_DIR'), "#{service}.key")
|
httpsKey = path.resolve(config.get('CONFIG_DIR'), "#{service}.key")
|
||||||
httpsCert = path.resolve(config.get('CONFIG_DIR'), "#{service}.crt")
|
httpsCert = path.resolve(config.get('CONFIG_DIR'), "#{service}.crt")
|
||||||
|
httpsCa = path.resolve(config.get('CONFIG_DIR'), "#{service}.ca-bundle")
|
||||||
options = {
|
options = {
|
||||||
key: fs.readFileSync(httpsKey),
|
key: fs.readFileSync(httpsKey),
|
||||||
cert: fs.readFileSync(httpsCert)
|
cert: fs.readFileSync(httpsCert)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
# Use intermediate certificates if available
|
||||||
|
options.ca = fs.readFileSync(httpsCa).toString()
|
||||||
|
.match(/\-+BEGIN CERTIFICATE\-+[0-9a-zA-Z\+\-\/\=\s]+?\-+END CERTIFICATE\-+/g)
|
||||||
|
|
||||||
server = require('https').createServer(options, listener)
|
server = require('https').createServer(options, listener)
|
||||||
else
|
else
|
||||||
server = require('http').createServer(listener)
|
server = require('http').createServer(listener)
|
||||||
|
|||||||
Reference in new issue
Block a user