From cd2091990fcf92a0f79db6c514ecdc5edad3aab9 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Wed, 21 Oct 2020 12:19:00 -0700 Subject: [PATCH] Completed Intel AMT CCM deactivation support. --- agents/MeshCmd-signed.exe | Bin 4377360 -> 4377952 bytes agents/MeshCmd64-signed.exe | Bin 3993360 -> 3993952 bytes agents/meshcmd.js | 6 ++ agents/meshcore.js | 6 ++ agents/modules_meshcmd/apfclient.js | 1 + agents/modules_meshcore/apfclient.js | 1 + amtmanager.js | 120 +++++++++++++++++++++++---- mpsserver.js | 7 +- 8 files changed, 124 insertions(+), 17 deletions(-) diff --git a/agents/MeshCmd-signed.exe b/agents/MeshCmd-signed.exe index 02f0b91b5961352950be66b0c2fc7c0777ed24cc..e45a92c6eacf614abc2bbdce7ff7266c8fea4b65 100644 GIT binary patch delta 1554 zcmajZX;70_6b9fVKw^Lpb`ezzi@4h`=^rJ758j0879M*a27rHUJs01?&I{K&@*) z(!9Dek-ap)z7E;zphMT=+X}d`Q9fMW7u@hjAulmp$m7StJt~e=Ow`{$nM!C!zzJ{$ z=)g|E1z-TKfE%z2a0i%mN@%EA$?~7+a3PoELa?(V1aRX;T!E0lX8RC6*FNp?KgQC5 zs}4XW@U}Q+Ae?}ObPWIHru{+?Wl4q2W*|LyO~_P(DH+h#|80LMgLL5yArk|;yF%u0 zJQmV*_|J3!*dY>FF$gIDxS2w5BkUJNMsfuL7^w;w!qq=R%9)K=sIC#qD!q<+T@Hu+ z$oht&m$;dEJM$LVk)`gQ@k%>CtdAexKFx3ODVJUNnkj|pkNwU+cu(|JbxV$@QG{02 zY29Thv?#XD2cITQj4!BC@gcKzm18yzw2TX39VER&Mprd%FF`gb&vGf_$=lp{WjVg3 zi`g*!5i3n>yXLAKSXON;={qCqFq-~7!K}e#$i5`mBrlYft_IRlL@)lD-N!l;3c)mf3oL$4@Om_x+A9@3o5 z4@E|K&cgQ}vzEkED&5}Effht@M`L$n?8#8zkXU6ZO_@Thur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r)%6z4&;e-wT;*_;z|~8#jeu<0*U9P*)}0 zlk2vBEZaWtfV@p?LAlqmlm4zFwD8H`<%6deCrSeX_wfc(W*br|7A{5xV|vQ#qoeK4 z0BiPU%Mv$S(Y|9>-s~?N%He-w|4*8Yk#Fle^fQClqnmixyC@RI>Vp$91?cqCcE|cO z-_Facc%%HV_Stzu!a((awlmIk(W{s#Q8vBP^?e|U{*YqgNroLA>|pM2YequpfKC;V zAxP5ilAMztZ7rSX%&~u1Tp<|?qK0ck<6H24oR~*Q*Ue$(l+1)et7tWUx$8LH5 zP`&(ebQYui<50a?aN!o#J!dW|eSWfbmHSLhH`RDGvHh{sl)7m-|ECwpamK;P6x5_- zAM%SoFR#Q(Ql5TWM|x#sQj*z<*^n!8_nu@N@~iF~o^)<-TX-tI*VS_FSVE|GOa&Py z!k=wP&N4e}Mj*z!X!-XwC4Ba}2T!FQy~U^xoui+6Y&c#sp6F;AzP31q@F3uE4SC0r lU7^ux(uU@kl8Es)WmSExWrb;Y-D}51K2`Q0ywK#o{R<$vN3{R| diff --git a/agents/MeshCmd64-signed.exe b/agents/MeshCmd64-signed.exe index 443447bfd0d35d38a34ba79b7f726a18fceae1eb..6921d0f5632f562e120f7f1acebacf0369536fe6 100644 GIT binary patch delta 1529 zcmajZXH=7C6bEo#2n3K}2th?g*fS(yhP)A#5nRCo)KP`Q2!T=~hzV#JjermoC`){? zmP1iSLBNPgXecsVO(cpX3X~}dS_%PK5y4}hj^n5H^f~AE<+=C%?=2i%gvKWpA;D=# znK@FD3)_ z1sCtcVZ}u;Sh2pW2qrf+DS{gtABRZoh-7rs-#>g6dm=yr$bd880=NQhfIHv;PykPW zDpawDJ5_A|nU3JHY^Zo55g)`#NMv!icpo1I{!{JGU4cb3EYfruHbE>eP(Mdb5@4+1 zzuXke1yQzS#7vupL)OZu8xT@Gy!C(EU;GT~BOlACXk>dhY>p%lV13vBOy__di5xo^ zp9X-NN%(E};6x^q#o-{36KseGmS7aWod65l3AD;O<=3@Hct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itT+ zJ6^SA^4idHTV2sC>8eeg$NGsPX7Go~eDSc%CpFi>lW=#3f*%@~(u+!;k{VC4W(72c z3zNxokEZ$RV=38z*$X%%7ENcMX@;R?B~PukEPpFZ@RS`VnM6<{?k1h!i7wV}&f;h* zhvM6tN39dz8#IQ52Ddok`83@B0VEQGK%YY)l+TYNX7f%Z3d=8B;eX~j-jNc8aZwi8 zktveOgM6NyC&^gQy|0e@-vu6VSoLfUY?52tB1O-Ymx!hDEPzA4VU`R03voHGQf$mv^Ai&yx0mdtl*|BlRF zOR8ADnA3&|)3wE*qR^R{)#07Y;bTo*FF3j6#QSga+Wt}9CWovx6siaq=XacisIl*ub;h5A%LE!oR6~$$Z0)S(f?N%Y|+@r}QpM zL-$XJIe|@^=3bMJNb`kh#xAjF#~PI-jUbjYh9|$2`mQLb_VqXS_WQna{`*k3M~IfJ zxSlGz-GcK_&!f$LpFwTQu7_}spH^)OMc{| zT(8sa6=7-K3tc@;4k5c62gZ-CVOO_$=(qjxy(GF}R8f(JXOQzPGto6co&D~VKRLC7 drLjyw+Pcwa;kr|WrM3t|c~|_>U_au&{R^3fN5TLA diff --git a/agents/meshcmd.js b/agents/meshcmd.js index fd39f8a5..29e01743 100644 --- a/agents/meshcmd.js +++ b/agents/meshcmd.js @@ -1183,6 +1183,12 @@ function configureJsonControl(data) { case 'mestate': // Request an updated MEI state getMeiState(15, function (state) { settings.apftunnel.updateMeiState(state); }); break; + case 'deactivate': // Request CCM deactivation + var amtMeiModule, amtMei; + try { amtMeiModule = require('amt-mei'); amtMei = new amtMeiModule(); } catch (ex) { settings.apftunnel.sendMeiDeactivationState(1); break; } + amtMei.on('error', function (e) { settings.apftunnel.sendMeiDeactivationState(1); }); + amtMei.unprovision(1, function (status) { settings.apftunnel.sendMeiDeactivationState(status); }); // 0 = Success + break; case 'close': // Close the CIRA-LMS connection exit(0); break; diff --git a/agents/meshcore.js b/agents/meshcore.js index d252b5e5..789f849e 100644 --- a/agents/meshcore.js +++ b/agents/meshcore.js @@ -3564,6 +3564,12 @@ function createMeshCore(agent) { apftunnel.onJsonControl = function (data) { if (data.action == 'console') { require('MeshAgent').SendCommand({ action: 'msg', type: 'console', value: data.msg }); } // Display a console message if (data.action == 'mestate') { getMeiState(15, function (state) { apftunnel.updateMeiState(state); }); } // Update the MEI state + if (data.action == 'deactivate') { // Request CCM deactivation + var amtMeiModule, amtMei; + try { amtMeiModule = require('amt-mei'); amtMei = new amtMeiModule(); } catch (ex) { apftunnel.sendMeiDeactivationState(1); break; } + amtMei.on('error', function (e) { apftunnel.sendMeiDeactivationState(1); }); + amtMei.unprovision(1, function (status) { apftunnel.sendMeiDeactivationState(status); }); // 0 = Success + } if (data.action == 'close') { try { apftunnel.disconnect(); } catch (e) { } apftunnel = null; } // Close the CIRA-LMS connection } apftunnel.onChannelClosed = function () { apftunnel = null; } diff --git a/agents/modules_meshcmd/apfclient.js b/agents/modules_meshcmd/apfclient.js index baeb540d..15b6bc14 100644 --- a/agents/modules_meshcmd/apfclient.js +++ b/agents/modules_meshcmd/apfclient.js @@ -182,6 +182,7 @@ function CreateAPFClient(parent, args) { } obj.updateMeiState = function (state) { SendJsonControl(obj.forwardClient.ws, { action: 'meiState', value: state }); } + obj.sendMeiDeactivationState = function (state) { SendJsonControl(obj.forwardClient.ws, { action: 'deactivate', value: state }); } function SendJsonControl(socket, o) { var data = JSON.stringify(o) diff --git a/agents/modules_meshcore/apfclient.js b/agents/modules_meshcore/apfclient.js index 5c02d39e..8996f0c5 100644 --- a/agents/modules_meshcore/apfclient.js +++ b/agents/modules_meshcore/apfclient.js @@ -182,6 +182,7 @@ function CreateAPFClient(parent, args) { } obj.updateMeiState = function (state) { SendJsonControl(obj.forwardClient.ws, { action: 'meiState', value: state }); } + obj.sendMeiDeactivationState = function (state) { SendJsonControl(obj.forwardClient.ws, { action: 'deactivate', value: state }); } function SendJsonControl(socket, o) { var data = JSON.stringify(o) diff --git a/amtmanager.js b/amtmanager.js index f2200c76..08ba947f 100644 --- a/amtmanager.js +++ b/amtmanager.js @@ -168,6 +168,30 @@ module.exports.CreateAmtManager = function(parent) { return r; } + // Receive a JSON control message from the MPS server + obj.mpsControlMessage = function (nodeid, conn, connType, jsondata) { + // Find the devices in the list + var dev = null; + var devices = obj.amtDevices[nodeid]; + if (devices == null) return; + for (var i in devices) { if (devices[i].mpsConnection === conn) { dev = devices[i]; } } + if (dev == null) return; + + // Process the message + switch (jsondata.action) { + case 'deactivate': + if ((dev.connType != 2) || (dev.deactivateCcmPending != 1)) break; // Only accept MEI state on CIRA-LMS connection + delete dev.deactivateCcmPending; + deactivateIntelAmtCCMEx(dev, jsondata.value); + break; + case 'meiState': + if (dev.pendingUpdatedMeiState != 1) break; + delete dev.pendingUpdatedMeiState; + attemptInitialContact(dev); + break; + } + } + // Subscribe to server events parent.AddEventDispatch(['*'], obj); @@ -221,25 +245,62 @@ module.exports.CreateAmtManager = function(parent) { const mesh = parent.webserver.meshes[node.meshid]; if (mesh == null) { removeAmtDevice(dev); return; } if (dev == null) { return; } + + // Fetch Intel AMT setup policy + // mesh.amt.type: 0 = No Policy, 1 = Deactivate CCM, 2 = Manage in CCM, 3 = Manage in ACM + // mesh.amt.cirasetup: 0 = No Change, 1 = Remove CIRA, 2 = Setup CIRA + var amtPolicy = 0, ciraPolicy = 0; + if (mesh.amt != null) { if (mesh.amt.type) { amtPolicy = mesh.amt.type; } if (mesh.amt.cirasetup) { ciraPolicy = mesh.amt.cirasetup; } } + if (amtPolicy < 2) { ciraPolicy = 0; } + dev.policy = { amtPolicy: amtPolicy, ciraPolicy: ciraPolicy } + + // If there is no Intel AMT policy for this device, stop here. + if (amtPolicy == 0) { dev.consoleMsg("Done."); removeAmtDevice(dev); return; } + + // Setup the monitored device dev.name = node.name; //if (node.host) { dev.host = node.host.toLowerCase(); } dev.meshid = node.meshid; dev.intelamt = node.intelamt; - dev.consoleMsg("Attempting Intel AMT connection..."); + dev.consoleMsg("Checking Intel AMT state..."); attemptInitialContact(dev); }); } // Attempt to perform initial contact with Intel AMT function attemptInitialContact(dev) { + delete dev.amtstack; // If there is a WSMAn stack setup, clean it up now. parent.debug('amt', "Attempt Initial Contact", dev.name, dev.connType); - if ((dev.connType == 2) && (dev.mpsConnection != null) && (dev.mpsConnection.tag != null) && (dev.mpsConnection.tag.meiState != null) && (dev.mpsConnection.tag.meiState.ProvisioningState !== 2)) { - // This Intel AMT device is not activated, we need to work on activating it. - activateIntelAmt(dev); - return; + // Check Intel AMT policy when CIRA-LMS connection is in use. + if ((dev.connType == 2) && (dev.mpsConnection != null) && (dev.mpsConnection.tag != null) && (dev.mpsConnection.tag.meiState != null)) { + // Intel AMT activation policy + if ((dev.policy.amtPolicy > 1) && (dev.mpsConnection.tag.meiState.ProvisioningState !== 2)) { + // This Intel AMT device is not activated, we need to work on activating it. + activateIntelAmt(dev); + return; + } + // Intel AMT CCM deactivation policy + if (dev.policy.amtPolicy == 1) { + if ((dev.mpsConnection.tag.meiState.ProvisioningState == 2) && ((dev.mpsConnection.tag.meiState.Flags & 2) != 0)) { + // Deactivate CCM. + deactivateIntelAmtCCM(dev); + } else { + // Already deactivated or in ACM, do nothing. + dev.consoleMsg("Done."); + removeAmtDevice(dev); + } + return; + } + // No Intel AMT policy, stop here + if (dev.policy.amtPolicy == 0) { + dev.consoleMsg("Done."); + removeAmtDevice(dev); + return; + } } + // If we ran out of credentials to try, give up here. if ((dev.acctry == null) && ((typeof dev.intelamt.user != 'string') || (typeof dev.intelamt.pass != 'string'))) { if ((obj.amtAdminAccounts[dev.domainid] != null) && (obj.amtAdminAccounts[dev.domainid].length > 0)) { dev.acctry = 0; } else { removeAmtDevice(dev); return; } } @@ -368,14 +429,12 @@ module.exports.CreateAmtManager = function(parent) { if (stack.wsman.comm.xtls == 1) { dev.aquired.hash = stack.wsman.comm.xtlsCertificate.fingerprint.split(':').join('').toLowerCase(); } else { delete dev.aquired.hash; } UpdateDevice(dev); - // TODO: Enable redirection port and KVM - // Perform Intel AMT clock sync attemptSyncClock(dev, function (dev) { // Check Intel AMT TLS state attemptTlsSync(dev, function (dev) { // If we need to switch to TLS, do it now. - if (dev.switchToTls == 1) { delete dev.amtstack; delete dev.switchToTls; attemptInitialContact(dev); return; } + if (dev.switchToTls == 1) { delete dev.switchToTls; attemptInitialContact(dev); return; } // Check Intel AMT root certificate state attemptRootCertSync(dev, function (dev) { // Check Intel AMT CIRA settings @@ -611,7 +670,6 @@ module.exports.CreateAmtManager = function(parent) { dev.amtstack.AMT_TimeSynchronizationService_SetHighAccuracyTimeSynch(response.Body['Ta0'], Tm1, Tm1, attemptSyncClockSet); } else { // Clock is fine, we are done. - dev.consoleMsg("Clock ok."); devTaskCompleted(dev) } } @@ -633,7 +691,7 @@ module.exports.CreateAmtManager = function(parent) { function attemptTlsSync(dev, func) { if (isAmtDeviceValid(dev) == false) return; // Device no longer exists, ignore this request. - // Fetch Intel AMT setup policy + // Refetch Intel AMT setup policy // mesh.amt.type: 0 = No Policy, 1 = Deactivate CCM, 2 = Manage in CCM, 3 = Manage in ACM // mesh.amt.cirasetup: 0 = No Change, 1 = Remove CIRA, 2 = Setup CIRA const mesh = parent.webserver.meshes[dev.meshid]; @@ -1027,8 +1085,6 @@ module.exports.CreateAmtManager = function(parent) { dev.taskCount = 1; dev.taskCompleted = func; - dev.consoleMsg("Checking settings..."); - // Query the things we are going to be checking var query = ['*AMT_GeneralSettings', '*AMT_RedirectionService']; if (dev.aquired.majorver > 5) query.push('*CIM_KVMRedirectionSAP'); @@ -1080,7 +1136,7 @@ module.exports.CreateAmtManager = function(parent) { function (stack, name, response, status) { const dev = stack.dev; if (isAmtDeviceValid(dev) == false) return; // Device no longer exists, ignore this request. - if (status == 200) { dev.consoleMsg("Enabled KVM"); } + if (status == 200) { dev.consoleMsg("Enabled KVM."); } devTaskCompleted(dev); } ); @@ -1350,12 +1406,46 @@ module.exports.CreateAmtManager = function(parent) { // Success, switch to managing this device obj.parent.mpsserver.SendJsonControl(dev.mpsConnection, { action: 'mestate' }); // Request an MEI state refresh - dev.consoleMsg("Succesfully activated Intel AMT in CCM mode."); + dev.consoleMsg("Succesfully activated Intel AMT in CCM mode, holding 10 seconds..."); // Wait 8 seconds before attempting to manage this device in CCM var f = function doManage() { if (isAmtDeviceValid(dev)) { attemptInitialContact(doManage.dev); } } f.dev = dev; - setTimeout(f, 8000); + setTimeout(f, 10000); + } + + + // + // Intel AMT CCM deactivation + // + + function deactivateIntelAmtCCM(dev) { + dev.consoleMsg("Deactivating CCM..."); + dev.deactivateCcmPending = 1; + dev.controlMsg({ action: 'deactivate' }); + } + + // This is called after the deactivation call + function deactivateIntelAmtCCMEx(dev, state) { + if (state != 0) { + dev.consoleMsg("Failed to deactivate Intel AMT CCM."); + removeAmtDevice(dev); + } else { + if (dev.policy.amtPolicy == 1) { // CCM deactivation policy, we are done. + dev.consoleMsg("Deactivation successful."); + dev.consoleMsg("Done."); + removeAmtDevice(dev); + } else { + // Wait 20 seconds before attempting any operation on this device + dev.consoleMsg("Deactivation successful, holding for 20 seconds..."); + var f = function askMeiState() { + askMeiState.dev.pendingUpdatedMeiState = 1; + askMeiState.dev.controlMsg({ action: 'mestate' }); + } + f.dev = dev; + setTimeout(f, 20000); + } + } } // diff --git a/mpsserver.js b/mpsserver.js index 45e6e327..de4ab105 100644 --- a/mpsserver.js +++ b/mpsserver.js @@ -899,8 +899,11 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) { case 'meiState': if (socket.tag.connType != 2) break; // Only accept MEI state on CIRA-LMS connection socket.tag.meiState = jsondata.value; - //if (socket.tag.meiState.UUID != null) { console.log('MEI State', socket.tag.meiState.UUID); } - //console.log('meiState', JSON.stringify(socket.tag.meiState, null, 2)); // DEBUG + if (obj.parent.amtManager != null) { obj.parent.amtManager.mpsControlMessage(socket.tag.nodeid, socket, socket.tag.connType, jsondata); } + break; + case 'deactivate': + if (socket.tag.connType != 2) break; // Only accept MEI state on CIRA-LMS connection + if (obj.parent.amtManager != null) { obj.parent.amtManager.mpsControlMessage(socket.tag.nodeid, socket, socket.tag.connType, jsondata); } break; } return 5 + jsondatalen;