Fixed trusted FQDN used in setup.bin

Ylian Saint-Hilaire committed Mar 7, 2021 at 23:31 UTC fc1e084576a5b7fa0758e0a6b5df2ee77031e2e5
1 file changed +11 -1
certoperations.js
+11 -1
@@ -286,6 +286,16 @@ module.exports.CertificateOperations = function (parent) {
286 var setupbin = AmtSetupBinStack.AmtSetupBinCreate(3, 1); // Version 3, 1 = Records will not be consumed.
287 var certRootName = 'MeshCentral';
288
289 + // Figure out what trusted FQDN to use.
290 + var trustedFQDN = 'rootcert.meshcentral.com'; // Default DNS name. Any DNS name will do, we this is the fallback.
291 + if (typeof domain.dns == 'string') {
292 + // Use domain DNS name
293 + trustedFQDN = domain.dns;
294 + } else if (typeof parent.config.settings.cert == 'string') {
295 + // Use main DNS name
296 + trustedFQDN = parent.config.settings.cert;
297 + }
298 +
299 // Create a new record
300 var r = {};
301 r.typeIdentifier = 1;
@@ -325,7 +335,7 @@ module.exports.CertificateOperations = function (parent) {
335 v.moduleid = 2;
336 v.varid = 3;
337 v.length = -1;
328 - v.value = 'rootcert.meshcentral.com';
338 + v.value = trustedFQDN;
339 setupbin.records[0].variables.push(v);
340
341 /*