From e7ceecca239a796aceb962a7c741d7b5320a0439 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Mon, 19 Oct 2020 22:23:46 -0700 Subject: [PATCH] Added MEI state exchange over CIRA-LMS. --- MeshCentralServer.njsproj | 1 + agents/MeshCmd-signed.exe | Bin 4375984 -> 4375736 bytes agents/MeshCmd64-signed.exe | Bin 3991984 -> 3991736 bytes agents/MeshService-signed.exe | Bin 3335592 -> 3335592 bytes agents/MeshService64-signed.exe | Bin 2951592 -> 2951592 bytes agents/meshcmd.js | 140 +++++++++++++-------------- agents/meshcore.js | 82 ++++++++++++---- agents/modules_meshcmd/apfclient.js | 7 +- agents/modules_meshcore/apfclient.js | 7 +- meshagent.js | 9 +- mpsserver.js | 7 ++ 11 files changed, 158 insertions(+), 95 deletions(-) diff --git a/MeshCentralServer.njsproj b/MeshCentralServer.njsproj index 4df7bd76..2b467c82 100644 --- a/MeshCentralServer.njsproj +++ b/MeshCentralServer.njsproj @@ -35,6 +35,7 @@ + diff --git a/agents/MeshCmd-signed.exe b/agents/MeshCmd-signed.exe index 49297897342ca90e93b07960302e8fbd3f358add..5a7739c612f25d032e8f7e5e55f62ca5934f6f5e 100644 GIT binary patch delta 3341 zcmbuA2~<;88h{1D76=JD2-piKBp4tGAQ&XP8&E+u%c8c7O9~H&4M`*~7K=1(p)gjf z6|A>{ORd^Mtt?i>B3hTKj4NYHtEDR1#iEReyEC@-e*sEu&zaLRlbkQP_uc>g_uuaS zT9z-j+`DYKWlO1r<=jWLFIy-qy>?WzTU57Ouvh|C00*!JYyexp4zLHffCJzN@Bk-( z4+sEfzy)vx+yHmL1MmdA0B>L{-~;#qe!w{382|zPKmZU3j0YwFK|nAd1VlgxFcA;~ zp+FcA4oCoLTf2oUlVzpL`B4LuG zG8ECU5Ch|Mnt4fA@*?s7h!VC%|DD>kl;nD19@+1NJ;^**>`fj!VJFjHu<`#np2tPQ zAJCGZ(`xBF1~EF6HZu#UwE2i2K6WQkKK3Qad>lxM_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XB*i*7z)%p9_ z#v__U*8$@##%5pgQ1pL>?RY4veV zsongXp;ektzv%Bg6Yg!?-4VWcs*t9AUYVzM9n&9adzdRqZ$!6~qyL zx6O%T`X&H}BN`C$@CM4(fxIh$`QEgN#GC=au(Ws05xWYn?Q^wJ^>h55 zi0Tr@!unQ=j*I!L%iuso>61>%?Rrsnr@p6U_jR87MR|Le*%xQNVI=%0@i?Ey3b)`_ za+d|qnTlifL@ZO~G%w?Mbq2PKl7E((vF3g|th?5YcLK*6%rDo}WxdQw5iY%&H4WW& z*B;ZANou|h-X}i!EN;7?ar`slG1bCWaYX$?@226{OfTDgUthWsF?^k>Gq|;6`_q4G zb|^hP`WA-fuPoZ0@Aj-vd7b?qL0rdVipS@{gGKJWX9T*F=a#Z`jvl$+KknW7sPW#S z@%j@T%=GrhKPEZvqwm#te|*|?kf|D}w0%`~6L0K9QG_PkYFQWG<#epHSs##3P<6J% z`w-}4jP|*dHFP><>l%nbiedN|JrixREJ6Wjav7zVMS)(o_jWu zTdI^x_L~b9QJ32suBn~w?Bh?kJRE#-ZG&cYmt)w)r&iGq>arQpQA4GvRmVH%-Laq} z#-F%h#WzFQdjqWWo*QD5?=$rFXB@?eRp+a1POBmmN}HoG%Xjp+OePq#O%*nU86S`D z%Nf116&Lli@Q#Pd9vh6C91ZK64mi|U^o8i`0KMzRxQ@K;++DAG=R;yjE~Ij(UtW%; Z;J&I|>npD*R}uBYDU8Vn-3G6ZKLFOw%Od~) diff --git a/agents/MeshCmd64-signed.exe b/agents/MeshCmd64-signed.exe index bfbf706192f461c78674d7033aa37bc83080edf5..ef1860f317aa9850d07835e79531690709115b2c 100644 GIT binary patch delta 3318 zcmbuA3sh9q8h{-{gu#J9;7ke$Xe^J*1a?9o7wy9fB*Y` z?f-^NgMPvyKdjA`Nop)5v(CQd;@BWpT^DiFEit_;YtPeq9JM16sG4 zIug`H3vG(G=tGqx4`UuVCdWSHNd@*Jcjeg4`WI~ce~#yI(f9|nB$w#*jK+jaB`6~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#roY7PFuKk#9 zb*I&(6b($#Chv5V*@Up33W?8f~=WxRxZ*uAPt5xG~#(}#9$ Q+BzIzeId~3rPhbzf6M~S;Q#;t diff --git a/agents/MeshService-signed.exe b/agents/MeshService-signed.exe index 73f6c4c3f63544bcefb62a2806a9d9badc32b16f..29a02b75298e87a64bb6afcca647441e09ca5087 100644 GIT binary patch delta 753 zcmWl|X)K!o7yw|cdsIv7J~~BR?X=$_Lr5fM{4isgS-LC|J1Q)WI;W#(u@Yk??iqGC zny4`BBtXK2jTodX^Jp5Mv?U0)sI zf|DhJMc|}JFaJ@8^-aLj}w&(0|i_Ab9bL0Z|9>zTb-ga{LaIV zuA``C%318|?Z9*~SDF~d$=S7~zKVBNlq{UGmL#IWlo#P*n5J@%Ttt|8;EY*Yv{4!DmkPcHhkebWof8v|u%Y)$xJ9K@tn-WND_b z<)OHN!bk~JU;?f&v}3y57QFhUC40Fi z4E=1JwzwLpp$Lkzb_~tO<$UI?5pfgmY(Oov#}oy9N_i2GWF@O;-u?TfhRUJzc5JIk zk~daj@Oi{MVOdC*X;SN|xh?h$Vff4rbvou!DOes6Ce@{dZ^&xPs)><3r8(h}KlOqI%=abi1%*$6*bwwUEj4?382n^fY_? ZW{&z~K07pXz21Ocd}y>(gkRQG5UZ delta 753 zcmWl|3oz3G8~|W{6We0VW7zV3XI|UPW4O4;I;Z2NBb1%Gl!y*_OeTt)UbG=eyI1mdAFG=Zkj3=*I@w1Ae72ubiLw1U>q2HHY9Xb&BrBXok!&;`0e zH+T%XLo)P$p3n<=Lmx;P<{(sw0!^X%&?pqTUw!Nk>KQKA>2Z0BqIl!NPc!UCbI!So zl0-sr%JcO?1!7dO;dl-uozRTiKr6Z>H_J zk(sdRK5Nv(ikLRt-JknQk|zg#O&NCWOJTNN9oorRIdIJiko>BwAMMz?S7(_%n4Kfl z*{T*{xUHFU4CebnTu8lCW7jfgR5KPvt!g7{Na&F=`ugduYXKarNRg_o)f6?(hrPY@ z#=}zBKy+!ds64xxs7OieVuU7C*|XHXdxh-%lY{yMMvqE>8F90YjC@|<)!>iCt??bK z<$YqomFbOwSmTiekAaZ;$oYO@vkbM_%$24YP#NLU2#ZNUO@&`tx~hA*VQs*QJVD^M zx+SUAqjV#a@l&@OSwlSHOBFfGiYd&vD?LzFKMUJwh$gm6QKK=7jE;j9B+2Z!&2CU$ zG*hx2B{vM6ob@is`|gnCFJbfP&HkhL!3@vhsHK77cfnbzFO!LT+Up&i%Ut%Ys6XOB zVYd$_=>(?R(61|!m*30rO)k|q`fi%AWrM_$fadUiR!oUdPuX;nuN+aiWY`(wI^#a^ zwjLmty{Ag!a(N0=tM2;P_8n{Whr1g5E-qUdpRge#mIxjWe`AkFFVropv0fp93brdg Z?{nSEe2^^#yJ&@(q3NUW!Am+i{{XijMz;U} diff --git a/agents/MeshService64-signed.exe b/agents/MeshService64-signed.exe index c38c60150571ace097919d5bf9d6aaa365e07e98..27ba0cbc89dfa488403add885c89c174eafc43ca 100644 GIT binary patch delta 733 zcmWl|3ow%b902gmjCnO;!nX`V`^-L8m_h-nT~WGM2!QZuyavZ&a3iBg>;4GMtPjN{{8NLEs}0*3smM{adBH-A_4ZU0Qd*}cWNQTFuBcwnl=nP#T6}mz< z=nhXn8bqN7q(jeM0oLm+p1|<+WilAd0BMA=7f+ah+v0r69A7R`@J;L(b(A- z&XrWmM-q#y+~~Lb7H|6~uNIMgvtEq`L_2!eAwOz|369T_=Oq;f{fa7TA=ROVqNV*+ zp3xnO8W+%Cx&onWq<+|X`hB1MLr-Lg_AWMX0p)8R++!!#_10L0bTnW36Cb<5p0m&i zr)A|H1}A-%&~tkJ*9%bx=ln}HeV5A$ zV}h8$LEgH)_J-ZevGhHKxE}3y#c(CNVQ!NtqbsqbSSqbzJ7&0N&OOBJj?Da~oXt2a zE(=8&{3n5Qg_KvTtO`$BHj~MI3h@OOQ-fzG#XR|BQwPfFuMe{2h9y|ZMO=c4)!Cw2 z+BlpNx~{Gwh6JZHDZO=H^}^HDlrywf*M?MP_2RXyp>Zi}&1QP7MWz2vbplCi6T;G$ z?iCxh4O*&A^0X)|A8{wCvKqV2=ZcJpGv%yu7YBO!JlFd3^~)6DN!h6zYxbMWb-@>@ z>WaOb>XN69Kijo#SYu$+n-;B}s#5XD+{M&4C1if&w34LIBbw8iD19lbeP?iFiBmFw z2B=kHeohABT-V)Do%k_7J2#wne^rYyzwbcwE6hN|+ql<>*{HsKW`b#x-TZ;EMrp$L RL~QD+*AXM1+DCc}<{t*lJ2n6S delta 733 zcmWl|3osJ^7y#gnZPrGNd2LOei#0n#4^F8Zr^lf}&Uu{fIHDPyg^3v=PP0voE33TX zTAnK>-MPzS=h1L8oFk7Mp$Cg4q5i(RuR$zFHo%s2q%ID{$m1dlxyb)@pe{r~G{itX zh=qqB4&tFcG=PVpAvA&nXbept5t>3XXbvr)B_u&IJOU}u3Lb^l&<5H;mngj`8e+{iuo!A&XL`2_nrc)3E&pe=SbY)>^Bj`LQM|B|Y_Z?nW4isC?^YPK=Nv zBRCRAO60}Sz892M+2on)T0u95pJbCeAl-KX834&D3QGI}m4I=|J9>cO{$h*_El&D0Y~} zS2)k?MZDx8wO+;aNl*W$Jzp7k10F}TjX&u%(s|JvGkXsa!k#HN$CM<*D8v)JBT-7P z^VHjFQeU6k(BSiX`$%n}_lx1iY}-o}ZM?I4@ph@B-3tGLJ2~`kd>#RXzDr%D^Q()( ziC;2oGR-?TT$?F_3w?{SIsW5}U)@_)0@Ugcw9|Ns4}WnlX8H|rt0*jApC}q7tnJMB z)yS>~TMsW=eK?KA#as*dzATlTQ)TUJj*3;Kx*~=k*fUL3@{Bj++`ioKq%V SJrl81y&H=$(eBkD5dQ$-3q-I0 diff --git a/agents/meshcmd.js b/agents/meshcmd.js index fee1f627..389d56f5 100644 --- a/agents/meshcmd.js +++ b/agents/meshcmd.js @@ -597,20 +597,7 @@ function run(argv) { }); } else if (settings.action == 'amtinfodebug') { // Display Intel AMT version and activation state - mestate = {}; - var amtMeiModule, amtMei; - try { amtMeiModule = require('amt-mei'); amtMei = new amtMeiModule(); } catch (ex) { console.log(ex); exit(1); return; } - amtMei.on('error', function (e) { console.log('ERROR: ' + e); exit(1); return; }); - amtMei.getVersion(function (result) { console.log('getVersion: ' + JSON.stringify(result)); }); - amtMei.getProvisioningState(function (result) { console.log('getProvisioningState: ' + JSON.stringify(result)); }); - amtMei.getProvisioningMode(function (result) { console.log('getProvisioningMode: ' + JSON.stringify(result)); }); - amtMei.getEHBCState(function (result) { if (result) { console.log('getEHBCState: ' + JSON.stringify(result)); } }); - amtMei.getControlMode(function (result) { if (result) { console.log('getControlMode: ' + JSON.stringify(result)); } }); - amtMei.getMACAddresses(function (result) { if (result) { console.log('getMACAddresses: ' + JSON.stringify(result)); } }); - amtMei.getLanInterfaceSettings(0, function (result) { console.log('getLanInterfaceSettings0: ' + JSON.stringify(result)); }); - amtMei.getLanInterfaceSettings(1, function (result) { console.log('getLanInterfaceSettings1: ' + JSON.stringify(result)); }); - amtMei.getUuid(function (result) { console.log('getUuid: ' + JSON.stringify(result)); }); - amtMei.getDnsSuffix(function (result) { console.log('getDnsSuffix: ' + JSON.stringify(result)); exit(1); }); + getMeiState(15, function (state) { console.log(JSON.stringify(state, null, 2)); exit(1); }); // Flags: 1 = Versions, 2 = OsAdmin, 4 = Hashes, 8 = Network } else if (settings.action == 'amtsavestate') { // Save the entire state of Intel AMT info a JSON file if ((settings.password == null) || (typeof settings.password != 'string') || (settings.password == '')) { console.log('No or invalid \"password\" specified, use --password [password].'); exit(1); return; } @@ -1148,75 +1135,50 @@ function startMeshCommander() { function configureAmt() { console.log('Starting Intel AMT configuration...'); settings.noconsole = true; - - // Display Intel AMT version and activation state - mestate = {}; - var amtMeiModule, amtMei; - try { amtMeiModule = require('amt-mei'); amtMei = new amtMeiModule(); } catch (ex) { console.log(ex); exit(1); return; } - amtMei.on('error', function (e) { console.log('ERROR: ' + e); exit(1); return; }); - amtMei.getProvisioningState(function (result) { if (result) { mestate.ProvisioningState = result; } }); - amtMei.getVersion(function (val) { mestate.vers = {}; if (val != null) { for (var version in val.Versions) { mestate.vers[val.Versions[version].Description] = val.Versions[version].Version; } } }); - amtMei.getLanInterfaceSettings(0, function (result) { if (result) { mestate.net0 = result; } }); - amtMei.getUuid(function (result) { if ((result != null) && (result.uuid != null)) { mestate.uuid = result.uuid; } }); - amtMei.getControlMode(function (result) { if (result != null) { mestate.controlMode = result.controlMode; } }); // controlMode: 0 = NoActivated, 1 = CCM, 2 = ACM - amtMei.getDnsSuffix(function (result) { - if ((mestate.vers == null) || (mestate.vers['AMT'] == null)) { console.log("Unable to get Intel AMT version."); exit(100); return; } - if (mestate.ProvisioningState == null) { console.log("Unable to read Intel AMT activation state."); exit(100); return; } - //if ((settings.action != 'amtdiscover') && (mestate.controlMode == 2)) { console.log("Intel AMT already activation in admin control mode."); exit(100); return; } - if (mestate.uuid == null) { console.log("Unable to get Intel AMT UUID."); exit(100); return; } - var fqdn = null; - //if ((mestate.net0 == null) && (meinfo.net0.enabled != 0)) { console.log("No Intel AMT wired interface, can't perform ACM activation."); exit(100); return; } - if (result) { fqdn = result; } // If Intel AMT has a trusted DNS suffix set, use that one. - else { - // Look for the DNS suffix for the Intel AMT Ethernet interface - var interfaces = require('os').networkInterfaces(); - for (var i in interfaces) { - for (var j in interfaces[i]) { - if ((interfaces[i][j].mac == mestate.net0.mac) && (interfaces[i][j].fqdn != null) && (interfaces[i][j].fqdn != '')) { fqdn = interfaces[i][j].fqdn; } - } - } - } - if (fqdn != null) { settings.fqdn = fqdn; settings.uuid = mestate.uuid; } - getTrustedHashes(amtMei, function () { startLms(configureAmt2, amtMei); }); - }); - + startLms(configureAmt2, amtMei); } function configureAmt2() { - // Connect to MPS and start APF relay - var apfarg = { - mpsurl: settings.url, - mpsuser: settings.id.substring(0, 16), - mpspass: settings.id.substring(0, 16), - mpskeepalive: 60000, - clientname: require('os').hostname(), - clientaddress: '127.0.0.1', - clientuuid: mestate.uuid, - conntype: 2 // 0 = CIRA, 1 = Relay, 2 = LMS. The correct value is 2 since we are performing an LMS relay. - }; - if ((apfarg.clientuuid == null) || (apfarg.clientuuid.length != 36)) { - console.log("Unable to get Intel AMT UUID: " + apfarg.clientuuid); - exit(1); return; - } else { - settings.apftunnel = require('apfclient')({ debug: (settings.debuglevel > 0) }, apfarg); - settings.apftunnel.onJsonControl = configureJsonControl; - settings.apftunnel.onChannelClosed = function () { exit(0); } - try { - settings.apftunnel.connect(); - console.log("Started APF tunnel..."); - } catch (e) { - console.log(JSON.stringify(e)); + getMeiState(15, function (state) { // Flags: 1 = Versions, 2 = OsAdmin, 4 = Hashes, 8 = Network + // Connect to MPS and start APF relay + var apfarg = { + mpsurl: settings.url, + mpsuser: settings.id.substring(0, 16), + mpspass: settings.id.substring(0, 16), + mpskeepalive: 60000, + clientname: require('os').hostname(), + clientaddress: '127.0.0.1', + clientuuid: state.UUID, + conntype: 2, // 0 = CIRA, 1 = Relay, 2 = LMS. The correct value is 2 since we are performing an LMS relay. + meiState: state + }; + if ((apfarg.clientuuid == null) || (apfarg.clientuuid.length != 36)) { + console.log("Unable to get Intel AMT UUID: " + apfarg.clientuuid); exit(1); return; + } else { + settings.apftunnel = require('apfclient')({ debug: (settings.debuglevel > 0) }, apfarg); + settings.apftunnel.onJsonControl = configureJsonControl; + settings.apftunnel.onChannelClosed = function () { exit(0); } + try { + settings.apftunnel.connect(); + console.log("Started APF tunnel..."); + } catch (e) { + console.log(JSON.stringify(e)); + exit(1); return; + } } - } + }); } function configureJsonControl(data) { switch (data.action) { - case 'console': + case 'console': // Display a console message console.log(data.msg); break; - case 'close': + case 'mestate': // Request an updated MEI state + getMeiState(15, function (state) { settings.apftunnel.updateMeiState(state); }); + break; + case 'close': // Close the CIRA-LMS connection exit(0); break; } @@ -2983,6 +2945,40 @@ function performAmtPowerActionEx2(stack, name, response, status) { } } +// +// Get MEI state +// + +// Get Intel MEI State in a flexible way +// Flags: 1 = Versions, 2 = OsAdmin, 4 = Hashes, 8 = Network +function getMeiState(flags, func) { + var amtMeiModule, amtMei; + try { amtMeiModule = require('amt-mei'); amtMei = new amtMeiModule(); } catch (ex) { func(null); return; } + amtMei.on('error', function (e) { func(null); return; }); + try { + var amtMeiTmpState = { Flags: 0 }; // Flags: 1=EHBC, 2=CCM, 4=ACM + amtMei.getProtocolVersion(function (result) { if (result != null) { amtMeiTmpState.MeiVersion = result; } }); + if ((flags & 1) != 0) { amtMei.getVersion(function (result) { if (result) { amtMeiTmpState.Versions = {}; for (var version in result.Versions) { amtMeiTmpState.Versions[result.Versions[version].Description] = result.Versions[version].Version; } } }); } + 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.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; } }); + if ((flags & 8) != 0) { amtMei.getLanInterfaceSettings(0, function (result) { if (result) { amtMeiTmpState.net0 = result; } }); } + if ((flags & 8) != 0) { amtMei.getLanInterfaceSettings(1, function (result) { if (result) { amtMeiTmpState.net1 = result; } }); } + amtMei.getUuid(function (result) { if ((result != null) && (result.uuid != null)) { amtMeiTmpState.UUID = result.uuid; } }); + if ((flags & 2) != 0) { amtMei.getLocalSystemAccount(function (x) { if ((x != null) && x.user && x.pass) { amtMeiTmpState.OsAdmin = { user: x.user, pass: x.pass }; } }); } + amtMei.getDnsSuffix(function (result) { if (result != null) { amtMeiTmpState.DNS = result; } if ((flags & 4) == 0) { if (func != null) { func(amtMeiTmpState); } } }); + if ((flags & 4) != 0) { + amtMei.getHashHandles(function (handles) { + if (handles != null) { amtMeiTmpState.Hashes = []; } else { func(amtMeiTmpState); } + var exitOnCount = handles.length; + for (var i = 0; i < handles.length; ++i) { this.getCertHashEntry(handles[i], function (hashresult) { amtMeiTmpState.Hashes.push(hashresult); if (--exitOnCount == 0) { if (func != null) { func(amtMeiTmpState); } } }); } + }); + } + } catch (e) { if (func != null) { func(null); } return; } +} + // // Startup diff --git a/agents/meshcore.js b/agents/meshcore.js index 174ac102..221294a2 100644 --- a/agents/meshcore.js +++ b/agents/meshcore.js @@ -3541,26 +3541,40 @@ function createMeshCore(agent) { break; } case 'amtconfig': { - if (meshCoreObj.intelamt == null) { response = "No Intel AMT support delected"; break; } if (apftunnel != null) { response = "Intel AMT server tunnel already active"; break; } - var apfarg = { - mpsurl: mesh.ServerUrl.replace('agent.ashx', 'apf.ashx'), - mpsuser: Buffer.from(mesh.ServerInfo.MeshID, 'hex').toString('base64').substring(0, 16), - mpspass: Buffer.from(mesh.ServerInfo.MeshID, 'hex').toString('base64').substring(0, 16), - mpskeepalive: 60000, - clientname: require('os').hostname(), - clientaddress: '127.0.0.1', - clientuuid: meshCoreObj.intelamt.uuid, - conntype: 2 // 0 = CIRA, 1 = Relay, 2 = LMS. The correct value is 2 since we are performing an LMS relay, other values for testing. - }; - if ((apfarg.clientuuid == null) || (apfarg.clientuuid.length != 36)) { response = "Unable to get Intel AMT UUID"; break; } - apftunnel = require('apfclient')({ debug: false }, apfarg); - apftunnel.onJsonControl = function (data) { - if (data.action == 'console') { require('MeshAgent').SendCommand({ action: 'msg', type: 'console', value: data.msg }); } - if (data.action == 'close') { try { apftunnel.disconnect(); } catch (e) { } apftunnel = null; } - } - apftunnel.onChannelClosed = function () { apftunnel = null; } - try { apftunnel.connect(); response = "Started Intel AMT configuration"; } catch (ex) { response = JSON.stringify(ex); } + if (amt == null) { response = "No Intel AMT support delected"; break; } + getMeiState(15, function (state) { + var rx = ''; + var apfarg = { + mpsurl: mesh.ServerUrl.replace('agent.ashx', 'apf.ashx'), + mpsuser: Buffer.from(mesh.ServerInfo.MeshID, 'hex').toString('base64').substring(0, 16), + mpspass: Buffer.from(mesh.ServerInfo.MeshID, 'hex').toString('base64').substring(0, 16), + mpskeepalive: 60000, + clientname: require('os').hostname(), + clientaddress: '127.0.0.1', + clientuuid: state.UUID, + conntype: 2, // 0 = CIRA, 1 = Relay, 2 = LMS. The correct value is 2 since we are performing an LMS relay, other values for testing. + meiState: state // MEI state will be passed to MPS server + }; + if ((state.UUID == null) || (state.UUID.length != 36)) { + rx = "Unable to get Intel AMT UUID"; + } else { + apftunnel = require('apfclient')({ debug: false }, apfarg); + 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 == 'close') { try { apftunnel.disconnect(); } catch (e) { } apftunnel = null; } // Close the CIRA-LMS connection + } + apftunnel.onChannelClosed = function () { apftunnel = null; } + try { + apftunnel.connect(); + rx = "Started Intel AMT configuration"; + } catch (ex) { + rx = JSON.stringify(ex); + } + } + if (rx != '') { require('MeshAgent').SendCommand({ action: 'msg', type: 'console', value: rx }); } + }); break; } case 'apf': { @@ -3819,6 +3833,36 @@ function createMeshCore(agent) { s.data = onWebSocketData; } + // Get Intel MEI State in a flexible way + // Flags: 1 = Versions, 2 = OsAdmin, 4 = Hashes, 8 = Network + function getMeiState(flags, func) { + var amtMeiModule, amtMei; + try { amtMeiModule = require('amt-mei'); amtMei = new amtMeiModule(); } catch (ex) { func(null); return; } + amtMei.on('error', function (e) { func(null); return; }); + try { + var amtMeiTmpState = { Flags: 0 }; // Flags: 1=EHBC, 2=CCM, 4=ACM + amtMei.getProtocolVersion(function (result) { if (result != null) { amtMeiTmpState.MeiVersion = result; } }); + if ((flags & 1) != 0) { amtMei.getVersion(function (result) { if (result) { amtMeiTmpState.Versions = {}; for (var version in result.Versions) { amtMeiTmpState.Versions[result.Versions[version].Description] = result.Versions[version].Version; } } }); } + 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.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; } }); + if ((flags & 8) != 0) { amtMei.getLanInterfaceSettings(0, function (result) { if (result) { amtMeiTmpState.net0 = result; } }); } + if ((flags & 8) != 0) { amtMei.getLanInterfaceSettings(1, function (result) { if (result) { amtMeiTmpState.net1 = result; } }); } + amtMei.getUuid(function (result) { if ((result != null) && (result.uuid != null)) { amtMeiTmpState.UUID = result.uuid; } }); + if ((flags & 2) != 0) { amtMei.getLocalSystemAccount(function (x) { if ((x != null) && x.user && x.pass) { amtMeiTmpState.OsAdmin = { user: x.user, pass: x.pass }; } }); } + amtMei.getDnsSuffix(function (result) { if (result != null) { amtMeiTmpState.DNS = result; } if ((flags & 4) == 0) { if (func != null) { func(amtMeiTmpState); } } }); + if ((flags & 4) != 0) { + amtMei.getHashHandles(function (handles) { + if (handles != null) { amtMeiTmpState.Hashes = []; } else { func(amtMeiTmpState); } + var exitOnCount = handles.length; + for (var i = 0; i < handles.length; ++i) { this.getCertHashEntry(handles[i], function (hashresult) { amtMeiTmpState.Hashes.push(hashresult); if (--exitOnCount == 0) { if (func != null) { func(amtMeiTmpState); } } }); } + }); + } + } catch (e) { if (func != null) { func(null); } return; } + } + return obj; } diff --git a/agents/modules_meshcmd/apfclient.js b/agents/modules_meshcmd/apfclient.js index 155a3b56..baeb540d 100644 --- a/agents/modules_meshcmd/apfclient.js +++ b/agents/modules_meshcmd/apfclient.js @@ -173,11 +173,16 @@ function CreateAPFClient(parent, args) { }); obj.state = CIRASTATE.INITIAL; - if ((typeof obj.args.conntype == 'number') && (obj.args.conntype != 0)) { SendJsonControl(obj.forwardClient.ws, { action: 'connType', value: obj.args.conntype } ); } + if ((typeof obj.args.conntype == 'number') && (obj.args.conntype != 0)) { + SendJsonControl(obj.forwardClient.ws, { action: 'connType', value: obj.args.conntype }); + if (obj.args.meiState != null) { SendJsonControl(obj.forwardClient.ws, { action: 'meiState', value: obj.args.meiState }); } + } SendProtocolVersion(obj.forwardClient.ws, obj.args.clientuuid); SendServiceRequest(obj.forwardClient.ws, 'auth@amt.intel.com'); } + obj.updateMeiState = function (state) { SendJsonControl(obj.forwardClient.ws, { action: 'meiState', value: state }); } + function SendJsonControl(socket, o) { var data = JSON.stringify(o) socket.write(String.fromCharCode(APFProtocol.JSON_CONTROL) + IntToStr(data.length) + data); diff --git a/agents/modules_meshcore/apfclient.js b/agents/modules_meshcore/apfclient.js index 393169f1..5c02d39e 100644 --- a/agents/modules_meshcore/apfclient.js +++ b/agents/modules_meshcore/apfclient.js @@ -173,11 +173,16 @@ function CreateAPFClient(parent, args) { }); obj.state = CIRASTATE.INITIAL; - if ((typeof obj.args.conntype == 'number') && (obj.args.conntype != 0)) { SendJsonControl(obj.forwardClient.ws, { action: 'connType', value: obj.args.conntype } ); } + if ((typeof obj.args.conntype == 'number') && (obj.args.conntype != 0)) { + SendJsonControl(obj.forwardClient.ws, { action: 'connType', value: obj.args.conntype }); + if (obj.args.meiState != null) { SendJsonControl(obj.forwardClient.ws, { action: 'meiState', value: obj.args.meiState }); } + } SendProtocolVersion(obj.forwardClient.ws, obj.args.clientuuid); SendServiceRequest(obj.forwardClient.ws, 'auth@amt.intel.com'); } + obj.updateMeiState = function (state) { SendJsonControl(obj.forwardClient.ws, { action: 'meiState', value: state }); } + function SendJsonControl(socket, o) { var data = JSON.stringify(o) socket.write(String.fromCharCode(APFProtocol.JSON_CONTROL) + IntToStr(data.length) + data); diff --git a/meshagent.js b/meshagent.js index 4172f66e..805458a3 100644 --- a/meshagent.js +++ b/meshagent.js @@ -899,6 +899,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) { } // Take a basic Intel AMT policy and add all server information to it, making it ready to send to this agent. + /* function completeIntelAmtPolicy(amtPolicy) { var r = amtPolicy; if (amtPolicy == null) return null; @@ -923,12 +924,14 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) { } return r; } + */ // Send Intel AMT policy obj.sendUpdatedIntelAmtPolicy = function (policy) { if (obj.agentExeInfo && (obj.agentExeInfo.amt == true)) { // Only send Intel AMT policy to agents what could have AMT. - if (policy == null) { var mesh = parent.meshes[obj.dbMeshKey]; if (mesh == null) return; policy = mesh.amt; } - if (policy != null) { try { obj.send(JSON.stringify({ action: 'amtPolicy', amtPolicy: completeIntelAmtPolicy(common.Clone(policy)) })); } catch (ex) { } } + // TODO + //if (policy == null) { var mesh = parent.meshes[obj.dbMeshKey]; if (mesh == null) return; policy = mesh.amt; } + //if (policy != null) { try { obj.send(JSON.stringify({ action: 'amtPolicy', amtPolicy: completeIntelAmtPolicy(common.Clone(policy)) })); } catch (ex) { } } } } @@ -981,9 +984,11 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) { }); // Send Intel AMT policy + /* if (obj.agentExeInfo && (obj.agentExeInfo.amt == true) && (mesh.amt != null)) { // Only send Intel AMT policy to agents what could have AMT. try { obj.send(JSON.stringify({ action: 'amtPolicy', amtPolicy: completeIntelAmtPolicy(common.Clone(mesh.amt)) })); } catch (ex) { } } + */ // Fetch system information db.GetHash('si' + obj.dbNodeKey, function (err, results) { diff --git a/mpsserver.js b/mpsserver.js index 7fd97e82..45e6e327 100644 --- a/mpsserver.js +++ b/mpsserver.js @@ -894,6 +894,13 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) { if ((socket.tag.connType != 0) || (socket.tag.SystemId != null)) return; // Once set, the connection type can't be changed. if (typeof jsondata.value != 'number') return; socket.tag.connType = jsondata.value; // 0 = CIRA, 1 = Relay, 2 = LMS + //obj.SendJsonControl(socket, { action: 'mestate' }); // Request an MEI state refresh + break; + 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 break; } return 5 + jsondatalen;