From ab85ec9a3d65d3372e115b36af7920be83c77779 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Wed, 14 Jul 2021 08:30:55 -0700 Subject: [PATCH] Made use of AMT user/pass provided by MeshCMD in amtconfig. --- amtmanager.js | 9 +++++++-- mpsserver.js | 8 ++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/amtmanager.js b/amtmanager.js index c534be5c..af76aa9e 100644 --- a/amtmanager.js +++ b/amtmanager.js @@ -458,8 +458,13 @@ module.exports.CreateAmtManager = function (parent) { if (dev.acctry == null) { dev.acctry = []; + // Add Intel AMT username and password provided by MeshCMD if available + if ((dev.mpsConnection != null) && (dev.mpsConnection.tag != null) && (dev.mpsConnection.tag.meiState != null) && (typeof dev.mpsConnection.tag.meiState.amtuser == 'string') && (typeof dev.mpsConnection.tag.meiState.amtpass == 'string') && (dev.mpsConnection.tag.meiState.amtuser != '') && (dev.mpsConnection.tag.meiState.amtpass != '')) { + dev.acctry.push([dev.mpsConnection.tag.meiState.amtuser, dev.mpsConnection.tag.meiState.amtpass]); + } + // Add the know Intel AMT password for this device if available - if ((typeof dev.intelamt.user == 'string') && (typeof dev.intelamt.pass == 'string')) { dev.acctry.push([dev.intelamt.user, dev.intelamt.pass]); } + if ((typeof dev.intelamt.user == 'string') && (typeof dev.intelamt.pass == 'string') && (dev.intelamt.user != '') && (dev.intelamt.pass != '')) { dev.acctry.push([dev.intelamt.user, dev.intelamt.pass]); } // Add the policy password as an alternative if ((typeof dev.policy.password == 'string') && (dev.policy.password != '')) { dev.acctry.push(['admin', dev.policy.password]); } @@ -669,7 +674,7 @@ module.exports.CreateAmtManager = function (parent) { } } - // If this devics is in CCM mode and we have a bad password reset policy, do it now. + // If this device is in CCM mode and we have a bad password reset policy, do it now. if ((dev.connType == 2) && (dev.policy.badPass == 1) && (dev.mpsConnection != null) && (dev.mpsConnection.tag != null) && (dev.mpsConnection.tag.meiState != null) && (dev.mpsConnection.tag.meiState.Flags != null) && ((dev.mpsConnection.tag.meiState.Flags & 2) != 0)) { deactivateIntelAmtCCM(dev); return; diff --git a/mpsserver.js b/mpsserver.js index b3ad22a2..cd968de4 100644 --- a/mpsserver.js +++ b/mpsserver.js @@ -600,8 +600,8 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) { } if (obj.parent.webserver.meshes[cookie.m] == null) { meshNotFoundCount++; - socket.ControlMsg({ action: 'console', msg: 'Device group not found' }); - parent.debug('mps', 'Device group not found', username, password); + socket.ControlMsg({ action: 'console', msg: 'Device group not found (1)' }); + parent.debug('mps', 'Device group not found (1)', username, password); SendUserAuthFail(socket); return -1; } @@ -645,8 +645,8 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) { } if (mesh == null) { meshNotFoundCount++; - socket.ControlMsg({ action: 'console', msg: 'Device group not found' }); - parent.debug('mps', 'Device group not found', username, password); + socket.ControlMsg({ action: 'console', msg: 'Device group not found (2)' }); + parent.debug('mps', 'Device group not found (2)', username, password); SendUserAuthFail(socket); return -1; }