diff --git a/agents/meshcmd.js b/agents/meshcmd.js
index 4ba074ac..4694855c 100644
--- a/agents/meshcmd.js
+++ b/agents/meshcmd.js
@@ -316,6 +316,7 @@ function run(argv) {
// Display Intel AMT versions
var amtMeiModule = require('amt-mei');
var amtMei = new amtMeiModule();
+ if (amtMei == null) { console.log("Intel(R) AMT not supported or insufficient access rights."); exit(1); return; }
amtMei.on('error', function (e) { console.log('ERROR: ' + e); exit(1); return; });
amtMei.getVersion(function (val) {
console.log("MEI Version = " + val.BiosVersion.toString());
@@ -326,6 +327,7 @@ function run(argv) {
// Display Intel AMT list of trusted hashes
var amtMeiModule = require('amt-mei');
var amtMei = new amtMeiModule();
+ if (amtMei == null) { console.log("Intel(R) AMT not supported or insufficient access rights."); exit(1); return; }
amtMei.on('error', function (e) { console.log('ERROR: ' + e); exit(1); return; });
amtMei.getHashHandles(function (handles) {
exitOnCount = handles.length;
@@ -341,6 +343,7 @@ function run(argv) {
mestate = {};
var amtMeiModule = require('amt-mei');
var amtMei = new amtMeiModule();
+ if (amtMei == null) { console.log("Intel(R) AMT not supported or insufficient access rights."); exit(1); return; }
amtMei.on('error', function (e) { console.log('ERROR: ' + e); exit(1); return; });
amtMei.getVersion(function (result) { if (result) { for (var version in result.Versions) { if (result.Versions[version].Description == 'AMT') { mestate.ver = result.Versions[version].Version; } } } });
amtMei.getProvisioningState(function (result) { if (result) { mestate.ProvisioningState = result; } });
@@ -381,6 +384,7 @@ function run(argv) {
mestate = {};
var amtMeiModule = require('amt-mei');
var amtMei = new amtMeiModule();
+ if (amtMei == null) { console.log("Intel(R) AMT not supported or insufficient access rights."); 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)); });
@@ -666,6 +670,7 @@ function startMeshCommander() {
function deactivateCCM() {
var amtMeiModule = require('amt-mei');
var amtMei = new amtMeiModule();
+ if (amtMei == null) { console.log("Intel(R) AMT not supported or insufficient access rights."); exit(1); return; }
amtMei.on('error', function (e) { console.log('ERROR: ' + e); exit(1); return; });
amtMei.unprovision(1, function (status) { if (status == 0) { console.log('Success'); } else { console.log('Error ' + status); } exit(1); });
}
@@ -708,6 +713,7 @@ function getAmtUuid() {
if (settings.hostname == null) {
var amtMeiModule = require('amt-mei');
var amtMei = new amtMeiModule();
+ if (amtMei == null) { console.log("Intel(R) AMT not supported or insufficient access rights."); exit(1); return; }
amtMei.on('error', function (e) { console.log('ERROR: ' + e); exit(1); return; });
amtMei.getUuid(function (result) { if ((result == null) || (result.uuid == null)) { console.log('Failed.'); } else { console.log(result.uuid); } exit(1); });
} else {
@@ -829,6 +835,7 @@ function getAmtInfo(func, tag) {
getAmtInfoFetchingTimer = null;
var amtMeiModule = require('amt-mei');
amtMei = new amtMeiModule();
+ if (amtMei == null) { console.log("Intel(R) AMT not supported or insufficient access rights."); exit(1); return; }
amtMei.on('error', function (e) { console.log('ERROR: ' + e); exit(1); return; });
}, 3000);
amtMei.getProtocolVersion(function (result) { if (result != null) { amtMeiTmpState.MeiVersion = result; } });
@@ -890,6 +897,7 @@ function startLms(func) {
var amtMeiModule = require('amt-mei');
amtMei = new amtMeiModule();
+ if (amtMei == null) { console.log("Intel(R) AMT not supported or insufficient access rights."); exit(1); return; }
amtMei.on('error', function (e) { console.log('ERROR: ' + e); exit(1); return; });
//console.log("PTHI Connected.");
diff --git a/agents/meshinstall-linux.sh b/agents/meshinstall-linux.sh
index 2a89bcf2..86cfbb18 100644
--- a/agents/meshinstall-linux.sh
+++ b/agents/meshinstall-linux.sh
@@ -58,7 +58,7 @@ CheckInstallAgent() {
# Linux x86, 64 bit
machineid=6
fi
- if [ $machinetype == 'x86' ] || [ $machinetype == 'i686' ]
+ if [ $machinetype == 'x86' ] || [ $machinetype == 'i686' ] || [ $machinetype == 'i586' ]
then
# Linux x86, 32 bit
machineid=5
diff --git a/meshuser.js b/meshuser.js
index a5b7197f..2a07260f 100644
--- a/meshuser.js
+++ b/meshuser.js
@@ -470,7 +470,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
switch (cmd) {
case 'help': {
- r = 'Available commands: help, args, resetserver, showconfig, usersessions, tasklimiter, setmaxtasks, cores.';
+ r = 'Available commands: help, args, resetserver, showconfig, usersessions, tasklimiter, setmaxtasks, cores, migrationagents, swarmstats.';
break;
}
case 'args': {
@@ -536,6 +536,31 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
r = JSON.stringify(removeAllUnderScore(config), null, 4);
break;
}
+ case 'migrationagents': {
+ if (obj.parent.parent.swarmserver == null) {
+ r = 'Swarm server not running.';
+ } else {
+ for (var i in obj.parent.parent.swarmserver.migrationAgents) {
+ var arch = obj.parent.parent.swarmserver.migrationAgents[i];
+ for (var j in arch) { var agent = arch[j]; r += 'Arch ' + agent.arch + ', Ver ' + agent.ver + ', Size ' + agent.binary.length + '
'; }
+ }
+ }
+ break;
+ }
+ case 'swarmstats': {
+ if (obj.parent.parent.swarmserver == null) {
+ r = 'Swarm server not running.';
+ } else {
+ for (var i in obj.parent.parent.swarmserver.stats) {
+ if (typeof obj.parent.parent.swarmserver.stats[i] == 'object') {
+ r += i + ' ' + JSON.stringify(obj.parent.parent.swarmserver.stats[i]) + '
';
+ } else {
+ r += i + ' ' + obj.parent.parent.swarmserver.stats[i] + '
';
+ }
+ }
+ }
+ break;
+ }
default: { // This is an unknown command, return an error message
r = 'Unknown command \"' + cmd + '\", type \"help\" for list of avaialble commands.';
break;
@@ -822,11 +847,11 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
if (hint.length > 250) hint = hint.substring(0, 250);
user.salt = salt;
user.hash = hash;
- user.passhint = req.body.apasswordhint;
+ user.passhint = hint;
user.passchange = Math.floor(Date.now() / 1000);
delete user.passtype;
obj.db.SetUser(user);
- obj.parent.parent.DispatchEvent(['*', 'server-users'], obj, { etype: 'user', username: user.name, action: 'passchange', msg: 'Account password changed: ' + user.name, domain: domain.id });
+ obj.parent.parent.DispatchEvent(['*', 'server-users'], obj, { etype: 'user', username: user.name, account: obj.parent.CloneSafeUser(user), action: 'accountchange', msg: 'Account password changed: ' + user.name, domain: domain.id });
// Send user notification of password change
displayNotificationMessage('Password changed.');
@@ -854,19 +879,18 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
// Compute the password hash & save it
require('./pass').hash(command.pass, function (err, salt, hash) {
if (!err) {
- var annonceChange = false;
chguser.salt = salt;
chguser.hash = hash;
chguser.passhint = command.hint;
- chguser.passchange = Math.floor(Date.now() / 1000);
+ if (command.resetNextLogin == true) { chguser.passchange = -1; } else { chguser.passchange = Math.floor(Date.now() / 1000); }
delete chguser.passtype; // Remove the password type if one was present.
if (command.removeMultiFactor == true) {
- if (chguser.otpsecret) { delete chguser.otpsecret; annonceChange = true; }
- if (chguser.otphkeys) { delete chguser.otphkeys; annonceChange = true; }
- if (chguser.otpkeys) { delete chguser.otpkeys; annonceChange = true; }
+ if (chguser.otpsecret) { delete chguser.otpsecret; }
+ if (chguser.otphkeys) { delete chguser.otphkeys; }
+ if (chguser.otpkeys) { delete chguser.otpkeys; }
}
obj.db.SetUser(chguser);
- if (annonceChange == true) { obj.parent.parent.DispatchEvent(['*', 'server-users', user._id, chguser._id], obj, { etype: 'user', username: user.name, account: obj.parent.CloneSafeUser(chguser), action: 'accountchange', msg: 'Removed 2nd factor auth.', domain: domain.id }); }
+ obj.parent.parent.DispatchEvent(['*', 'server-users', user._id, chguser._id], obj, { etype: 'user', username: user.name, account: obj.parent.CloneSafeUser(chguser), action: 'accountchange', msg: 'Changed account credentials.', domain: domain.id });
} else {
// Report that the password change failed
// TODO
diff --git a/sample-config.json b/sample-config.json
index 55b21d57..8c8eb1ca 100644
--- a/sample-config.json
+++ b/sample-config.json
@@ -48,7 +48,7 @@
"_NewAccountEmailDomains": [ "sample.com" ],
"Footer": "Twitter",
"_CertUrl": "https://192.168.2.106:443/",
- "_PasswordRequirements": { "min": 8, "max": 128, "upper": 1, "lower": 1, "numeric": 1, "nonalpha": 1 },
+ "_PasswordRequirements": { "min": 8, "max": 128, "upper": 1, "lower": 1, "numeric": 1, "nonalpha": 1, "reset": 90 },
"_AgentNoProxy": true,
"_GeoLocation": true,
"_UserAllowedIP": "127.0.0.1,192.168.1.0/24",
diff --git a/swarmserver.js b/swarmserver.js
index e1071a5a..beb268ae 100644
--- a/swarmserver.js
+++ b/swarmserver.js
@@ -23,10 +23,10 @@ module.exports.CreateSwarmServer = function (parent, db, args, certificates) {
obj.legacyAgentConnections = {};
obj.migrationAgents = {};
obj.agentActionCount = {};
- const common = require('./common.js');
- //const net = require('net');
+ obj.stats = { blockedConnect: 0, connectCount: 0, clientCertConnectCount: 0, noCertConnectCount: 0, bytesIn: 0, bytesOut: 0, httpGetRequest: 0, pushedAgents: {}, close: 0, onclose: 0 }
const tls = require('tls');
const forge = require('node-forge');
+ const common = require('./common.js');
const LegacyMeshProtocol = {
NODEPUSH: 1, // Used to send a node block to another peer.
@@ -149,26 +149,41 @@ module.exports.CreateSwarmServer = function (parent, db, args, certificates) {
// Called when a legacy agent connects to this server
function onConnection(socket) {
// Check for blocked IP address
- if (checkSwarmIpAddress(socket, obj.args.swarmallowedip) == false) { Debug(1, "SWARM:New blocked agent connection"); return; }
+ if (checkSwarmIpAddress(socket, obj.args.swarmallowedip) == false) { obj.stats.blockedConnect++; Debug(1, "SWARM:New blocked agent connection"); return; }
+ obj.stats.connectCount++;
socket.tag = { first: true, clientCert: socket.getPeerCertificate(true), accumulator: "", socket: socket };
socket.setEncoding('binary');
socket.pingTimer = setInterval(function () { obj.SendCommand(socket, LegacyMeshProtocol.PING); }, 20000);
Debug(1, 'SWARM:New legacy agent connection');
+ if ((socket.tag.clientCert == null) || (socket.tag.clientCert.subject == null)) { obj.stats.noCertConnectCount++; } else { obj.stats.clientCertConnectCount++; }
+
socket.addListener("data", function (data) {
if (args.swarmdebug) { var buf = Buffer.from(data, "binary"); console.log('SWARM <-- (' + buf.length + '):' + buf.toString('hex')); } // Print out received bytes
+ obj.stats.bytesIn += data.length;
socket.tag.accumulator += data;
// Detect if this is an HTTPS request, if it is, return a simple answer and disconnect. This is useful for debugging access to the MPS port.
if (socket.tag.first == true) {
if (socket.tag.accumulator.length < 3) return;
- if (socket.tag.accumulator.substring(0, 3) == 'GET') { /*console.log("Swarm Connection, HTTP GET detected: " + socket.remoteAddress);*/ socket.write('HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nConnection: close\r\n\r\n
{{{logoutControl}}}
My Devices | My Account | My Events | My Files |
{{{logoutControl}}}
My Devices | My Account | My Events | My Files |
Change email address
- Change password
+ Change password
Delete account
![]() |
![]() |
' + err + '
'; if (msg != null) message = '' + msg + '
'; if (passhint != null) passhint = EscapeHtml(passhint); - var emailcheck = ((obj.parent.mailserver != null) && (domain.auth != 'sspi')); if (obj.args.minify && !req.query.nominify) { @@ -2271,6 +2356,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) { obj.app.post(url + 'changepassword', handlePasswordChangeRequest); obj.app.post(url + 'deleteaccount', handleDeleteAccountRequest); obj.app.post(url + 'createaccount', handleCreateAccountRequest); + obj.app.post(url + 'resetpassword', handleResetPasswordRequest); obj.app.post(url + 'resetaccount', handleResetAccountRequest); obj.app.get(url + 'checkmail', handleCheckMailRequest); obj.app.post(url + 'amtevents.ashx', obj.handleAmtEventRequest);