Fixed MeshCMD proxy in action file.

This commit is contained in:
Ylian Saint-Hilaire 2019-03-27 12:55:31 -07:00
parent 6add7f8f11
commit a8d6d90913
6 changed files with 20 additions and 11 deletions

View File

@ -122,12 +122,7 @@ function run(argv) {
if ((typeof args.debug) == 'string') { settings.debuglevel = parseInt(args.debug); } if ((typeof args.debug) == 'string') { settings.debuglevel = parseInt(args.debug); }
if ((typeof args.script) == 'string') { settings.script = args.script; } if ((typeof args.script) == 'string') { settings.script = args.script; }
if ((typeof args.agent) == 'string') { settings.agent = args.agent; } if ((typeof args.agent) == 'string') { settings.agent = args.agent; }
if ((typeof args.proxy) == 'string') { if ((typeof args.proxy) == 'string') { settings.proxy = args.proxy; }
var proxy = args.proxy.split(':'), proxyport = (proxy.length == 2) ? parseInt(proxy[1]) : 0;
if ((proxy.length != 2) || (proxy[0].length < 1) || (proxyport < 1) || (proxyport > 65535)) { console.log('Invalid \"proxy\" specified, use --proxy [hostname]:[port].'); exit(1); return; }
try { require('global-tunnel').initialize({ host: proxy[0], port: proxyport }); } catch (ex) { console.log(ex); exit(1); return; }
console.log('Proxy set to ' + proxy[0] + ':' + proxyport);
}
if (args.debug) { try { waitForDebugger(); } catch (e) { } } if (args.debug) { try { waitForDebugger(); } catch (e) { } }
if (args.noconsole) { settings.noconsole = true; } if (args.noconsole) { settings.noconsole = true; }
if (args.nocommander) { settings.noconsole = true; } if (args.nocommander) { settings.noconsole = true; }
@ -270,6 +265,15 @@ function run(argv) {
} }
settings.action = settings.action.toLowerCase(); settings.action = settings.action.toLowerCase();
debug(1, "Settings: " + JSON.stringify(settings)); debug(1, "Settings: " + JSON.stringify(settings));
// Setup the proxy if needed
if ((typeof settings.proxy) == 'string') {
var proxy = settings.proxy.split(':'), proxyport = (proxy.length == 2) ? parseInt(proxy[1]) : 0;
if ((proxy.length != 2) || (proxy[0].length < 1) || (proxyport < 1) || (proxyport > 65535)) { console.log('Invalid \"proxy\" specified, use --proxy [hostname]:[port].'); exit(1); return; }
try { require('global-tunnel').initialize({ host: proxy[0], port: proxyport }); } catch (ex) { console.log(ex); exit(1); return; }
console.log('Proxy set to ' + proxy[0] + ':' + proxyport);
}
if (settings.action == 'smbios') { if (settings.action == 'smbios') {
// Display SM BIOS tables in raw form // Display SM BIOS tables in raw form
SMBiosTables = require('smbios'); SMBiosTables = require('smbios');

File diff suppressed because one or more lines are too long

View File

@ -492,7 +492,7 @@ function AmtManager(agent, db, isdebug) {
var intelAmtAdminPass, wsstack, amtstack, applyPolicyTimer, policyWsmanRetry = 0; var intelAmtAdminPass, wsstack, amtstack, applyPolicyTimer, policyWsmanRetry = 0;
obj.applyPolicy = function () { obj.applyPolicy = function () {
applyPolicyTimer = null; applyPolicyTimer = null;
if ((amtMeiState != 3) || (typeof amtpolicy != 'object') || (typeof amtpolicy.type != 'number') || (amtpolicy.type == 0)) return; if ((amtMeiState != 3) || (amtpolicy == null) || (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) && ((meinfo.Flags & 2) != 0)) { if ((amtpolicy.type == 1) && (meinfo.ProvisioningState == 2) && ((meinfo.Flags & 2) != 0)) {

File diff suppressed because one or more lines are too long

View File

@ -1648,7 +1648,12 @@ function InstallModule(modulename, func, tag1, tag2) {
// Looks like we need to keep a global reference to the child process object for this to work correctly. // Looks like we need to keep a global reference to the child process object for this to work correctly.
InstallModuleChildProcess = child_process.exec('npm install --no-optional --save ' + modulename, { maxBuffer: 512000, timeout: 10000 }, function (error, stdout, stderr) { InstallModuleChildProcess = child_process.exec('npm install --no-optional --save ' + modulename, { maxBuffer: 512000, timeout: 10000 }, function (error, stdout, stderr) {
InstallModuleChildProcess = null; InstallModuleChildProcess = null;
if (error != null) { console.log('ERROR: Unable to install missing package \'' + modulename + '\', make sure npm is installed: ' + error); process.exit(); return; } if (error != null) {
console.log('ERROR: Unable to install missing package \'' + modulename + '\', make sure npm is installed: ' + error);
console.log(stdout);
process.exit();
return;
}
func(tag1, tag2); func(tag1, tag2);
return; return;
}); });

View File

@ -1,6 +1,6 @@
{ {
"name": "meshcentral", "name": "meshcentral",
"version": "0.3.1-m", "version": "0.3.1-o",
"keywords": [ "keywords": [
"Remote Management", "Remote Management",
"Intel AMT", "Intel AMT",