diff --git a/agents/MeshCmd-signed.exe b/agents/MeshCmd-signed.exe index 579e630c..1c765ac5 100644 Binary files a/agents/MeshCmd-signed.exe and b/agents/MeshCmd-signed.exe differ diff --git a/agents/MeshCmd64-signed.exe b/agents/MeshCmd64-signed.exe index 3c055d76..f5619540 100644 Binary files a/agents/MeshCmd64-signed.exe and b/agents/MeshCmd64-signed.exe differ diff --git a/agents/MeshService-signed.exe b/agents/MeshService-signed.exe index 5282ddf9..30309dbd 100644 Binary files a/agents/MeshService-signed.exe and b/agents/MeshService-signed.exe differ diff --git a/agents/MeshService64-signed.exe b/agents/MeshService64-signed.exe index d4fec042..9d85239c 100644 Binary files a/agents/MeshService64-signed.exe and b/agents/MeshService64-signed.exe differ diff --git a/agents/meshcmd.js b/agents/meshcmd.js index ab3c3f5c..44d2291d 100644 --- a/agents/meshcmd.js +++ b/agents/meshcmd.js @@ -498,7 +498,10 @@ function run(argv) { exitOnCount = handles.length; for (var i = 0; i < handles.length; ++i) { this.getCertHashEntry(handles[i], function (result) { - console.log(result.name + ', (' + (result.isDefault ? 'Default' : '') + (result.isActive ? ', Active' : ', Disabled') + ')\r\n ' + result.hashAlgorithmStr + ': ' + result.certificateHash); + var certState = []; + if (result.isDefault) { certState.push('Default'); } + if (result.isActive) { certState.push('Active'); } else { certState.push('Disabled'); } + console.log(result.name + ', (' + certState.join(', ') + ')\r\n ' + result.hashAlgorithmStr + ': ' + result.certificateHash); if (--exitOnCount == 0) { exit(1); } }); } diff --git a/agents/modules_meshcmd/amt-mei.js b/agents/modules_meshcmd/amt-mei.js index 304ac35d..a2aac279 100644 --- a/agents/modules_meshcmd/amt-mei.js +++ b/agents/modules_meshcmd/amt-mei.js @@ -365,30 +365,30 @@ function amt_heci() { fn.apply(this, opt); }, callback, optional); } - this.startConfiguration = function startConfiguration() { + this.startConfiguration = function startConfiguration(callback) { var optional = []; - for (var i = 2; i < arguments.length; ++i) { optional.push(arguments[i]); } - this.sendCommand(0x29, data, function (header, fn, opt) { opt.unshift(header.Status); fn.apply(this, opt); }, callback, optional); + for (var i = 1; i < arguments.length; ++i) { optional.push(arguments[i]); } + this.sendCommand(0x29, null, function (header, fn, opt) { opt.unshift(header.Status); fn.apply(this, opt); }, callback, optional); } - this.stopConfiguration = function stopConfiguration() { + this.stopConfiguration = function stopConfiguration(callback) { var optional = []; - for (var i = 2; i < arguments.length; ++i) { optional.push(arguments[i]); } - this.sendCommand(0x5E, data, function (header, fn, opt) { opt.unshift(header.Status); fn.apply(this, opt); }, callback, optional); + for (var i = 1; i < arguments.length; ++i) { optional.push(arguments[i]); } + this.sendCommand(0x5E, null, function (header, fn, opt) { opt.unshift(header.Status); fn.apply(this, opt); }, callback, optional); } - this.openUserInitiatedConnection = function openUserInitiatedConnection() { + this.openUserInitiatedConnection = function openUserInitiatedConnection(callback) { var optional = []; - for (var i = 2; i < arguments.length; ++i) { optional.push(arguments[i]); } - this.sendCommand(0x44, data, function (header, fn, opt) { opt.unshift(header.Status); fn.apply(this, opt); }, callback, optional); + for (var i = 1; i < arguments.length; ++i) { optional.push(arguments[i]); } + this.sendCommand(0x44, null, function (header, fn, opt) { opt.unshift(header.Status); fn.apply(this, opt); }, callback, optional); } - this.closeUserInitiatedConnection = function closeUnserInitiatedConnected() { + this.closeUserInitiatedConnection = function closeUnserInitiatedConnected(callback) { var optional = []; - for (var i = 2; i < arguments.length; ++i) { optional.push(arguments[i]); } - this.sendCommand(0x45, data, function (header, fn, opt) { opt.unshift(header.Status); fn.apply(this, opt); }, callback, optional); + for (var i = 1; i < arguments.length; ++i) { optional.push(arguments[i]); } + this.sendCommand(0x45, null, function (header, fn, opt) { opt.unshift(header.Status); fn.apply(this, opt); }, callback, optional); } - this.getRemoteAccessConnectionStatus = function getRemoteAccessConnectionStatus() { + this.getRemoteAccessConnectionStatus = function getRemoteAccessConnectionStatus(callback) { var optional = []; - for (var i = 2; i < arguments.length; ++i) { optional.push(arguments[i]); } - this.sendCommand(0x46, data, function (header, fn, opt) { + for (var i = 1; i < arguments.length; ++i) { optional.push(arguments[i]); } + this.sendCommand(0x46, null, function (header, fn, opt) { if (header.Status == 0) { var hostname = v.slice(14, header.Data.readUInt16LE(12) + 14).toString() opt.unshift({ status: header.Status, networkStatus: header.Data.readUInt32LE(0), remoteAccessStatus: header.Data.readUInt32LE(4), remoteAccessTrigger: header.Data.readUInt32LE(8), mpsHostname: hostname, raw: header.Data }); diff --git a/agents/modules_meshcore/amt-manage.js b/agents/modules_meshcore/amt-manage.js index 2827fff3..d3281842 100644 --- a/agents/modules_meshcore/amt-manage.js +++ b/agents/modules_meshcore/amt-manage.js @@ -97,7 +97,7 @@ function AmtManager(agent, db, isdebug) { } } amtMei.getProvisioningMode(function (result) { if (result) { amtMeiTmpState.ProvisioningMode = result.mode; } }); - amtMei.getProvisioningState(function (result) { if (result) { amtMeiTmpState.ProvisioningState = result.state; } }); // 0: "Not Activated (Pre)", 1: "Not Activated (In)", 2: "Activated" + amtMei.getProvisioningState(function (result) { if (result) { amtMeiTmpState.ProvisioningState = result.state; if (result.state != 2) { amtMei.stopConfiguration(function () { }); } } }); // 0: "Not Activated (Pre)", 1: "Not Activated (In)", 2: "Activated". Make sure to stop remote configuration if needed. amtMei.getEHBCState(function (result) { if ((result != null) && (result.EHBC == true)) { amtMeiTmpState.Flags += 1; } }); amtMei.getControlMode(function (result) { if (result != null) { if (result.controlMode == 1) { amtMeiTmpState.Flags += 2; } if (result.controlMode == 2) { amtMeiTmpState.Flags += 4; } } }); // Flag 2 = CCM, 4 = ACM //amtMei.getMACAddresses(function (result) { if (result) { amtMeiTmpState.mac = result; } }); diff --git a/agents/modules_meshcore/amt-mei.js b/agents/modules_meshcore/amt-mei.js index 304ac35d..a2aac279 100644 --- a/agents/modules_meshcore/amt-mei.js +++ b/agents/modules_meshcore/amt-mei.js @@ -365,30 +365,30 @@ function amt_heci() { fn.apply(this, opt); }, callback, optional); } - this.startConfiguration = function startConfiguration() { + this.startConfiguration = function startConfiguration(callback) { var optional = []; - for (var i = 2; i < arguments.length; ++i) { optional.push(arguments[i]); } - this.sendCommand(0x29, data, function (header, fn, opt) { opt.unshift(header.Status); fn.apply(this, opt); }, callback, optional); + for (var i = 1; i < arguments.length; ++i) { optional.push(arguments[i]); } + this.sendCommand(0x29, null, function (header, fn, opt) { opt.unshift(header.Status); fn.apply(this, opt); }, callback, optional); } - this.stopConfiguration = function stopConfiguration() { + this.stopConfiguration = function stopConfiguration(callback) { var optional = []; - for (var i = 2; i < arguments.length; ++i) { optional.push(arguments[i]); } - this.sendCommand(0x5E, data, function (header, fn, opt) { opt.unshift(header.Status); fn.apply(this, opt); }, callback, optional); + for (var i = 1; i < arguments.length; ++i) { optional.push(arguments[i]); } + this.sendCommand(0x5E, null, function (header, fn, opt) { opt.unshift(header.Status); fn.apply(this, opt); }, callback, optional); } - this.openUserInitiatedConnection = function openUserInitiatedConnection() { + this.openUserInitiatedConnection = function openUserInitiatedConnection(callback) { var optional = []; - for (var i = 2; i < arguments.length; ++i) { optional.push(arguments[i]); } - this.sendCommand(0x44, data, function (header, fn, opt) { opt.unshift(header.Status); fn.apply(this, opt); }, callback, optional); + for (var i = 1; i < arguments.length; ++i) { optional.push(arguments[i]); } + this.sendCommand(0x44, null, function (header, fn, opt) { opt.unshift(header.Status); fn.apply(this, opt); }, callback, optional); } - this.closeUserInitiatedConnection = function closeUnserInitiatedConnected() { + this.closeUserInitiatedConnection = function closeUnserInitiatedConnected(callback) { var optional = []; - for (var i = 2; i < arguments.length; ++i) { optional.push(arguments[i]); } - this.sendCommand(0x45, data, function (header, fn, opt) { opt.unshift(header.Status); fn.apply(this, opt); }, callback, optional); + for (var i = 1; i < arguments.length; ++i) { optional.push(arguments[i]); } + this.sendCommand(0x45, null, function (header, fn, opt) { opt.unshift(header.Status); fn.apply(this, opt); }, callback, optional); } - this.getRemoteAccessConnectionStatus = function getRemoteAccessConnectionStatus() { + this.getRemoteAccessConnectionStatus = function getRemoteAccessConnectionStatus(callback) { var optional = []; - for (var i = 2; i < arguments.length; ++i) { optional.push(arguments[i]); } - this.sendCommand(0x46, data, function (header, fn, opt) { + for (var i = 1; i < arguments.length; ++i) { optional.push(arguments[i]); } + this.sendCommand(0x46, null, function (header, fn, opt) { if (header.Status == 0) { var hostname = v.slice(14, header.Data.readUInt16LE(12) + 14).toString() opt.unshift({ status: header.Status, networkStatus: header.Data.readUInt32LE(0), remoteAccessStatus: header.Data.readUInt32LE(4), remoteAccessTrigger: header.Data.readUInt32LE(8), mpsHostname: hostname, raw: header.Data }); diff --git a/certoperations.js b/certoperations.js index 811ce9ad..4dadcfed 100644 --- a/certoperations.js +++ b/certoperations.js @@ -251,6 +251,16 @@ module.exports.CertificateOperations = function (parent) { v.value = 'rootcert.meshcentral.com'; setupbin.records[0].variables.push(v); + /* + // Create "ME Provision Halt Active" variable + v = {}; + v.moduleid = 2; + v.varid = 28; + v.length = -1; + v.value = 1; + setupbin.records[0].variables.push(v); + */ + // Write to log file obj.logAmtActivation(domain, { time: new Date(), action: 'setupbin', domain: domain.id, userid: user._id, oldmebx: oldmebxpass, newmebx: newmebxpass, rootname: certRootName, hash: wildcardCertSha256, dns: 'rootcert.meshcentral.com' }); diff --git a/db.js b/db.js index 31a54f00..da477f1b 100644 --- a/db.js +++ b/db.js @@ -1604,8 +1604,9 @@ module.exports.CreateDB = function (parent, func) { mesh.nolog = 1; delete mesh.type; delete mesh._id; - if (mesh.amt != null) { - if (delete mesh.amt.password != null) { mesh.amt.password = 1; } // Remove the Intel AMT password if present + if ((mesh.amt != null) && (mesh.amt.password != null)) { + mesh.amt = Object.assign({}, mesh.amt); // Shallow clone + if (mesh.amt.password != null) { mesh.amt.password = 1; } // Remove the Intel AMT password if present } parent.DispatchEvent(['*', mesh.meshid], obj, mesh); }