1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

Added support for intermediate CA certs in web server TLS.

This commit is contained in:
Ylian Saint-Hilaire 2017-09-07 16:01:44 -07:00
parent 4dfc83f09e
commit 5e00e61d08
5 changed files with 17 additions and 5 deletions

View file

@ -154,6 +154,19 @@ module.exports.CertificateOperations = function () {
r.agent = { cert: agentCertificate, key: agentPrivateKey };
rcount++;
}
// If CA certificates are present, load them
var caok, caindex = 1, calist = [];
do {
caok = false;
if (obj.fileExists(directory + '/webserver-cert-chain' + caindex + '.crt')) {
var caCertificate = obj.fs.readFileSync(directory + '/webserver-cert-chain' + caindex + '.crt', 'utf8');
calist.push(caCertificate);
caok = true;
}
caindex++;
} while (caok == true);
r.calist = calist;
// Decode certificate arguments
var commonName = 'un-configured', country, organization;
@ -226,7 +239,7 @@ module.exports.CertificateOperations = function () {
agentPrivateKey = r.agent.key
}
var r = { root: { cert: rootCertificate, key: rootPrivateKey }, web: { cert: webCertificate, key: webPrivateKey }, mps: { cert: mpsCertificate, key: mpsPrivateKey }, agent: { cert: agentCertificate, key: agentPrivateKey }, CommonName: commonName, RootName: rootName };
var r = { root: { cert: rootCertificate, key: rootPrivateKey }, web: { cert: webCertificate, key: webPrivateKey }, mps: { cert: mpsCertificate, key: mpsPrivateKey }, agent: { cert: agentCertificate, key: agentPrivateKey }, calist: calist, CommonName: commonName, RootName: rootName };
if (func != undefined) { func(r); }
return r;
}