Fixed server exception when settings .msh random without custom agent signing cert.
Ylian Saint-Hilaire committed
Jun 18, 2022 at 10:54 UTC
537409e964f3400b0f4af3dd398853fbd088bc1a
1 file changed
+10
-1
meshcentral.js
+10
-1
@@ -2851,7 +2851,6 @@ function CreateMeshCentralServer(config, args) {
2851
2852
// Check if a custom agent signing certificate is available
2853
var agentSignCertInfo = require('./authenticode.js').loadCertificates([obj.path.join(obj.datapath, 'agentsigningcert.pem')]);
2854
- if (agentSignCertInfo == null) { func(); return; } // No code signing certificate, nothing to do.
2854
2855
// If not using a custom signing cert, get agent code signature certificate ready with the full cert chain
2856
if ((agentSignCertInfo == null) && (obj.certificates.codesign != null)) {
@@ -2861,6 +2860,7 @@ function CreateMeshCentralServer(config, args) {
2860
extraCerts: [obj.certificateOperations.forge.pki.certificateFromPem(obj.certificates.root.cert)]
2861
}
2862
}
2863
+ if (agentSignCertInfo == null) { func(); return; } // No code signing certificate, nothing to do.
2864
2865
// Setup the domain is specified
2866
var objx = domain, suffix = '';
@@ -2955,6 +2955,15 @@ function CreateMeshCentralServer(config, args) {
2955
// Check if a custom agent signing certificate is available
2956
var agentSignCertInfo = require('./authenticode.js').loadCertificates([obj.path.join(obj.datapath, 'agentsigningcert.pem')]);
2957
2958
+ // If not using a custom signing cert, get agent code signature certificate ready with the full cert chain
2959
+ if ((agentSignCertInfo == null) && (obj.certificates.codesign != null)) {
2960
+ agentSignCertInfo = {
2961
+ cert: obj.certificateOperations.forge.pki.certificateFromPem(obj.certificates.codesign.cert),
2962
+ key: obj.certificateOperations.forge.pki.privateKeyFromPem(obj.certificates.codesign.key),
2963
+ extraCerts: [obj.certificateOperations.forge.pki.certificateFromPem(obj.certificates.root.cert)]
2964
+ }
2965
+ }
2966
+
2967
// Setup the domain is specified
2968
var objx = domain, suffix = '';
2969
if (domain.id == '') { objx = obj; } else { suffix = '-' + domain.id; objx.meshAgentBinaries = {}; }