mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-23 22:13:14 +03:00
More server fixes.
This commit is contained in:
parent
e5b7abea40
commit
6edc50161e
@ -88,7 +88,7 @@ function AmtManager(agent, db, isdebug) {
|
|||||||
amtMei.getProvisioningMode(function (result) { if (result) { amtMeiTmpState.ProvisioningMode = result.mode; } });
|
amtMei.getProvisioningMode(function (result) { if (result) { amtMeiTmpState.ProvisioningMode = result.mode; } });
|
||||||
amtMei.getProvisioningState(function (result) { if (result) { amtMeiTmpState.ProvisioningState = result.state; } });
|
amtMei.getProvisioningState(function (result) { if (result) { amtMeiTmpState.ProvisioningState = result.state; } });
|
||||||
amtMei.getEHBCState(function (result) { if ((result != null) && (result.EHBC == true)) { amtMeiTmpState.Flags += 1; } });
|
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; } } });
|
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; } });
|
//amtMei.getMACAddresses(function (result) { if (result) { amtMeiTmpState.mac = result; } });
|
||||||
amtMei.getLanInterfaceSettings(0, function (result) { if (result) { amtMeiTmpState.net0 = result; } });
|
amtMei.getLanInterfaceSettings(0, function (result) { if (result) { amtMeiTmpState.net0 = result; } });
|
||||||
amtMei.getLanInterfaceSettings(1, function (result) { if (result) { amtMeiTmpState.net1 = result; } });
|
amtMei.getLanInterfaceSettings(1, function (result) { if (result) { amtMeiTmpState.net1 = result; } });
|
||||||
@ -496,7 +496,7 @@ function AmtManager(agent, db, isdebug) {
|
|||||||
if ((amtMeiState != 3) || (typeof amtpolicy != 'object') || (typeof amtpolicy.type != 'number') || (amtpolicy.type == 0)) return;
|
if ((amtMeiState != 3) || (typeof amtpolicy != 'object') || (typeof amtpolicy.type != 'number') || (amtpolicy.type == 0)) return;
|
||||||
if ((amtpolicy.password != null) && (amtpolicy.password != '')) { intelAmtAdminPass = amtpolicy.password; }
|
if ((amtpolicy.password != null) && (amtpolicy.password != '')) { intelAmtAdminPass = amtpolicy.password; }
|
||||||
obj.getAmtInfo(function (meinfo) {
|
obj.getAmtInfo(function (meinfo) {
|
||||||
if ((amtpolicy.type == 1) && (meinfo.ProvisioningState == 2)) {
|
if ((amtpolicy.type == 1) && (meinfo.ProvisioningState == 2) && ((meinfo.Flags & 2) != 0)) {
|
||||||
// CCM Deactivation Policy.
|
// CCM Deactivation Policy.
|
||||||
wsstack = null;
|
wsstack = null;
|
||||||
amtstack = null;
|
amtstack = null;
|
||||||
@ -507,14 +507,14 @@ function AmtManager(agent, db, isdebug) {
|
|||||||
amtstack = null;
|
amtstack = null;
|
||||||
if ((amtpolicy.password == null) || (amtpolicy.password == '')) { intelAmtAdminPass = null; }
|
if ((amtpolicy.password == null) || (amtpolicy.password == '')) { intelAmtAdminPass = null; }
|
||||||
obj.activeToCCM(intelAmtAdminPass);
|
obj.activeToCCM(intelAmtAdminPass);
|
||||||
} else if ((amtpolicy.type == 2) && (meinfo.ProvisioningState == 2) && (intelAmtAdminPass != null)) {
|
} else if ((amtpolicy.type == 2) && (meinfo.ProvisioningState == 2) && (intelAmtAdminPass != null) && ((meinfo.Flags & 2) != 0)) {
|
||||||
// Perform password test
|
// Perform password test
|
||||||
var transport = require('amt-wsman-duk');
|
var transport = require('amt-wsman-duk');
|
||||||
var wsman = require('amt-wsman');
|
var wsman = require('amt-wsman');
|
||||||
var amt = require('amt');
|
var amt = require('amt');
|
||||||
wsstack = new wsman(transport, '127.0.0.1', 16992, 'admin', intelAmtAdminPass, false);
|
wsstack = new wsman(transport, '127.0.0.1', 16992, 'admin', intelAmtAdminPass, false);
|
||||||
amtstack = new amt(wsstack);
|
amtstack = new amt(wsstack);
|
||||||
try { amtstack.BatchEnum(null, ['*AMT_GeneralSettings', '*IPS_HostBasedSetupService'], wsmanPassTestResponse); } catch (ex) { debug(ex); }
|
try { amtstack.BatchEnum(null, ['*AMT_GeneralSettings', '*IPS_HostBasedSetupService', '*AMT_RedirectionService', '*CIM_KVMRedirectionSAP'], wsmanPassTestResponse); } catch (ex) { debug(ex); }
|
||||||
} else {
|
} else {
|
||||||
// Other possible cases...
|
// Other possible cases...
|
||||||
}
|
}
|
||||||
@ -525,8 +525,18 @@ function AmtManager(agent, db, isdebug) {
|
|||||||
if (status != 200) {
|
if (status != 200) {
|
||||||
if (amtpolicy.badpass == 1) { obj.deactivateCCM(); } // Something went wrong, reactivate.
|
if (amtpolicy.badpass == 1) { obj.deactivateCCM(); } // Something went wrong, reactivate.
|
||||||
} else {
|
} else {
|
||||||
|
/*
|
||||||
|
var redir = (amtsysstate['AMT_RedirectionService'].response["ListenerEnabled"] == true);
|
||||||
|
var sol = ((amtsysstate['AMT_RedirectionService'].response["EnabledState"] & 2) != 0);
|
||||||
|
var ider = ((amtsysstate['AMT_RedirectionService'].response["EnabledState"] & 1) != 0);
|
||||||
|
var kvm = false;
|
||||||
|
if (amtsysstate['CIM_KVMRedirectionSAP'] != null) {
|
||||||
|
kvm = ((amtsysstate['CIM_KVMRedirectionSAP'].response["EnabledState"] == 6 && amtsysstate['CIM_KVMRedirectionSAP'].response["RequestedState"] == 2) || amtsysstate['CIM_KVMRedirectionSAP'].response["EnabledState"] == 2 || amtsysstate['CIM_KVMRedirectionSAP'].response["EnabledState"] == 6);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// Success, make sure
|
// Success, make sure
|
||||||
debug('SUCCESS!');
|
debug('SUCCESS!' + JSON.stringify(responses));
|
||||||
// TODO: Check Intel AMT Features need to be enabled & if Intel AMT CIRA needs to be setup
|
// TODO: Check Intel AMT Features need to be enabled & if Intel AMT CIRA needs to be setup
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
@ -519,7 +519,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
|||||||
|
|
||||||
// Once we get all the information about an agent, run this to hook everything up to the server
|
// Once we get all the information about an agent, run this to hook everything up to the server
|
||||||
function completeAgentConnection() {
|
function completeAgentConnection() {
|
||||||
if ((obj.authenticated != 1) || (obj.meshid == null) || obj.pendingCompleteAgentConnection || (obj.agentExeInfo == null)) return;
|
if ((obj.authenticated != 1) || (obj.meshid == null) || obj.pendingCompleteAgentConnection || (obj.agentInfo == null)) { return; }
|
||||||
obj.pendingCompleteAgentConnection = true;
|
obj.pendingCompleteAgentConnection = true;
|
||||||
|
|
||||||
// Check if we have too many agent sessions
|
// Check if we have too many agent sessions
|
||||||
@ -568,7 +568,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
|||||||
|
|
||||||
// Check that the node exists
|
// Check that the node exists
|
||||||
db.Get(obj.dbNodeKey, function (err, nodes) {
|
db.Get(obj.dbNodeKey, function (err, nodes) {
|
||||||
if (obj.agentExeInfo == null) { return; } // Agent has disconnected
|
if (obj.agentInfo == null) { return; }
|
||||||
var device;
|
var device;
|
||||||
|
|
||||||
// See if this node exists in the database
|
// See if this node exists in the database
|
||||||
|
@ -278,17 +278,17 @@ function CreateMeshCentralServer(config, args) {
|
|||||||
// Push all relevent files from meshcentral-data into the database
|
// Push all relevent files from meshcentral-data into the database
|
||||||
if (obj.args.dbpushconfigfiles) {
|
if (obj.args.dbpushconfigfiles) {
|
||||||
if (typeof obj.args.configkey != 'string') { console.log('Error, --configkey is required.'); process.exit(); return; }
|
if (typeof obj.args.configkey != 'string') { console.log('Error, --configkey is required.'); process.exit(); return; }
|
||||||
if (typeof obj.args.dbpushconfigfiles != 'string') {
|
if ((obj.args.dbpushconfigfiles !== true) && (typeof obj.args.dbpushconfigfiles != 'string')) {
|
||||||
console.log('Usage: --dbpulldatafiles (path) This will import files from folder into the database');
|
console.log('Usage: --dbpulldatafiles (path) This will import files from folder into the database');
|
||||||
console.log(' --dbpulldatafiles * This will import files from meshcentral-data into the db.');
|
console.log(' --dbpulldatafiles This will import files from meshcentral-data into the db.');
|
||||||
process.exit();
|
process.exit();
|
||||||
} else {
|
} else {
|
||||||
if (obj.args.dbpushconfigfiles == '*') { obj.args.dbpushconfigfiles = obj.datapath; }
|
if ((obj.args.dbpushconfigfiles == '*') || (obj.args.dbpushconfigfiles === true)) { obj.args.dbpushconfigfiles = obj.datapath; }
|
||||||
obj.fs.readdir(obj.args.dbpushconfigfiles, function (err, files) {
|
obj.fs.readdir(obj.args.dbpushconfigfiles, function (err, files) {
|
||||||
if (err != null) { console.log('Unable to read from folder ' + obj.args.dbpushconfigfiles); process.exit(); return; }
|
if (err != null) { console.log('ERROR: Unable to read from folder ' + obj.args.dbpushconfigfiles); process.exit(); return; }
|
||||||
var configFound = false;
|
var configFound = false;
|
||||||
for (var i in files) { if (files[i] == 'config.json') { configFound = true; } }
|
for (var i in files) { if (files[i] == 'config.json') { configFound = true; } }
|
||||||
if (configFound == false) { console.log('No config.json in folder ' + obj.args.dbpushconfigfiles); process.exit(); return; }
|
if (configFound == false) { console.log('ERROR: No config.json in folder ' + obj.args.dbpushconfigfiles); process.exit(); return; }
|
||||||
obj.db.RemoveAllOfType('cfile', function () {
|
obj.db.RemoveAllOfType('cfile', function () {
|
||||||
obj.fs.readdir(obj.args.dbpushconfigfiles, function (err, files) {
|
obj.fs.readdir(obj.args.dbpushconfigfiles, function (err, files) {
|
||||||
var lockCount = 1
|
var lockCount = 1
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "meshcentral",
|
"name": "meshcentral",
|
||||||
"version": "0.3.0-c",
|
"version": "0.3.0-d",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"Remote Management",
|
"Remote Management",
|
||||||
"Intel AMT",
|
"Intel AMT",
|
||||||
|
Loading…
Reference in New Issue
Block a user