mirror of
				https://github.com/Ylianst/MeshCentral.git
				synced 2025-03-09 15:40:18 +00:00 
			
		
		
		
	More fixes, updated MeshCommander (Intel AMT tab)
This commit is contained in:
		
							parent
							
								
									cb54c941a9
								
							
						
					
					
						commit
						ce21dba54e
					
				
					 7 changed files with 842 additions and 823 deletions
				
			
		| 
						 | 
					@ -395,6 +395,11 @@ function run(argv) {
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					    } else if (settings.action == 'netinfo') {
 | 
				
			||||||
 | 
					        // Display network information
 | 
				
			||||||
 | 
					        var interfaces = require('os').networkInterfaces();
 | 
				
			||||||
 | 
					        console.log(JSON.stringify(interfaces, 2, ' '));
 | 
				
			||||||
 | 
					        exit(0); return;
 | 
				
			||||||
    } else if (settings.action == 'amtinfo') {
 | 
					    } else if (settings.action == 'amtinfo') {
 | 
				
			||||||
        // Display Intel AMT version and activation state
 | 
					        // Display Intel AMT version and activation state
 | 
				
			||||||
        mestate = {};
 | 
					        mestate = {};
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										5
									
								
								agents/meshcmd.min.js
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								agents/meshcmd.min.js
									
										
									
									
										vendored
									
									
								
							| 
						 | 
					@ -395,6 +395,11 @@ function run(argv) {
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					    } else if (settings.action == 'netinfo') {
 | 
				
			||||||
 | 
					        // Display network information
 | 
				
			||||||
 | 
					        var interfaces = require('os').networkInterfaces();
 | 
				
			||||||
 | 
					        console.log(JSON.stringify(interfaces, 2, ' '));
 | 
				
			||||||
 | 
					        exit(0); return;
 | 
				
			||||||
    } else if (settings.action == 'amtinfo') {
 | 
					    } else if (settings.action == 'amtinfo') {
 | 
				
			||||||
        // Display Intel AMT version and activation state
 | 
					        // Display Intel AMT version and activation state
 | 
				
			||||||
        mestate = {};
 | 
					        mestate = {};
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -575,7 +575,7 @@ function CreateMeshCentralServer(config, args) {
 | 
				
			||||||
                var newAccRights = 0;
 | 
					                var newAccRights = 0;
 | 
				
			||||||
                for (var j in obj.config.domains[i].newaccountsrights) {
 | 
					                for (var j in obj.config.domains[i].newaccountsrights) {
 | 
				
			||||||
                    var r = obj.config.domains[i].newaccountsrights[j].toLowerCase();
 | 
					                    var r = obj.config.domains[i].newaccountsrights[j].toLowerCase();
 | 
				
			||||||
                    if (r == 'fulladmin') { newAccRights = 0xFFFFFFFF; }
 | 
					                    if (r == 'fulladmin') { newAccRights = 4294967295; } // 0xFFFFFFFF
 | 
				
			||||||
                    if (r == 'serverbackup') { newAccRights |= 1; }
 | 
					                    if (r == 'serverbackup') { newAccRights |= 1; }
 | 
				
			||||||
                    if (r == 'manageusers') { newAccRights |= 2; }
 | 
					                    if (r == 'manageusers') { newAccRights |= 2; }
 | 
				
			||||||
                    if (r == 'serverrestore') { newAccRights |= 4; }
 | 
					                    if (r == 'serverrestore') { newAccRights |= 4; }
 | 
				
			||||||
| 
						 | 
					@ -614,7 +614,7 @@ function CreateMeshCentralServer(config, args) {
 | 
				
			||||||
            else { console.log('Invalid administrator name.'); process.exit(); return; }
 | 
					            else { console.log('Invalid administrator name.'); process.exit(); return; }
 | 
				
			||||||
            obj.db.Get(adminname, function (err, user) {
 | 
					            obj.db.Get(adminname, function (err, user) {
 | 
				
			||||||
                if (user.length != 1) { console.log('Invalid user name.'); process.exit(); return; }
 | 
					                if (user.length != 1) { console.log('Invalid user name.'); process.exit(); return; }
 | 
				
			||||||
                user[0].siteadmin = 4294967295;
 | 
					                user[0].siteadmin = 4294967295; // 0xFFFFFFFF
 | 
				
			||||||
                obj.db.Set(user[0], function () {
 | 
					                obj.db.Set(user[0], function () {
 | 
				
			||||||
                    if (user[0].domain == '') { console.log('User ' + user[0].name + ' set to site administrator.'); } else { console.log('User ' + user[0].name + ' of domain ' + user[0].domain + ' set to site administrator.'); }
 | 
					                    if (user[0].domain == '') { console.log('User ' + user[0].name + ' set to site administrator.'); } else { console.log('User ' + user[0].name + ' of domain ' + user[0].domain + ' set to site administrator.'); }
 | 
				
			||||||
                    process.exit();
 | 
					                    process.exit();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1404,7 +1404,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                            // Create the new device group
 | 
					                            // Create the new device group
 | 
				
			||||||
                            var links = {};
 | 
					                            var links = {};
 | 
				
			||||||
                            links[user._id] = { name: user.name, rights: 0xFFFFFFFF };
 | 
					                            links[user._id] = { name: user.name, rights: 4294967295 };
 | 
				
			||||||
                            mesh = { type: 'mesh', _id: meshid, name: command.meshname, mtype: command.meshtype, desc: command.desc, domain: domain.id, links: links };
 | 
					                            mesh = { type: 'mesh', _id: meshid, name: command.meshname, mtype: command.meshtype, desc: command.desc, domain: domain.id, links: links };
 | 
				
			||||||
                            db.Set(common.escapeLinksFieldName(mesh));
 | 
					                            db.Set(common.escapeLinksFieldName(mesh));
 | 
				
			||||||
                            parent.meshes[meshid] = mesh;
 | 
					                            parent.meshes[meshid] = mesh;
 | 
				
			||||||
| 
						 | 
					@ -1412,7 +1412,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                            // Change the user to make him administration of the new device group
 | 
					                            // Change the user to make him administration of the new device group
 | 
				
			||||||
                            if (user.links == null) user.links = {};
 | 
					                            if (user.links == null) user.links = {};
 | 
				
			||||||
                            user.links[meshid] = { rights: 0xFFFFFFFF };
 | 
					                            user.links[meshid] = { rights: 4294967295 };
 | 
				
			||||||
                            user.subscriptions = parent.subscribe(user._id, ws);
 | 
					                            user.subscriptions = parent.subscribe(user._id, ws);
 | 
				
			||||||
                            db.SetUser(user);
 | 
					                            db.SetUser(user);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  "name": "meshcentral",
 | 
					  "name": "meshcentral",
 | 
				
			||||||
  "version": "0.3.6-v",
 | 
					  "version": "0.3.6-x",
 | 
				
			||||||
  "keywords": [
 | 
					  "keywords": [
 | 
				
			||||||
    "Remote Management",
 | 
					    "Remote Management",
 | 
				
			||||||
    "Intel AMT",
 | 
					    "Intel AMT",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										1635
									
								
								public/commander.htm
									
										
									
									
									
								
							
							
						
						
									
										1635
									
								
								public/commander.htm
									
										
									
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										10
									
								
								webserver.js
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								webserver.js
									
										
									
									
									
								
							| 
						 | 
					@ -306,7 +306,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
 | 
				
			||||||
                        if (domain.newaccountsrights) { user.siteadmin = domain.newaccountsrights; }
 | 
					                        if (domain.newaccountsrights) { user.siteadmin = domain.newaccountsrights; }
 | 
				
			||||||
                        var usercount = 0;
 | 
					                        var usercount = 0;
 | 
				
			||||||
                        for (var i in obj.users) { if (obj.users[i].domain == domain.id) { usercount++; } }
 | 
					                        for (var i in obj.users) { if (obj.users[i].domain == domain.id) { usercount++; } }
 | 
				
			||||||
                        if (usercount == 0) { user.siteadmin = 0xFFFFFFFF; /*if (domain.newaccounts === 2) { delete domain.newaccounts; }*/ } // If this is the first user, give the account site admin.
 | 
					                        if (usercount == 0) { user.siteadmin = 4294967295; /*if (domain.newaccounts === 2) { delete domain.newaccounts; }*/ } // If this is the first user, give the account site admin.
 | 
				
			||||||
                        obj.users[user._id] = user;
 | 
					                        obj.users[user._id] = user;
 | 
				
			||||||
                        obj.db.SetUser(user);
 | 
					                        obj.db.SetUser(user);
 | 
				
			||||||
                        var event = { etype: 'user', userid: userid, username: username, account: obj.CloneSafeUser(user), action: 'accountcreate', msg: 'Account created, name is ' + name, domain: domain.id };
 | 
					                        var event = { etype: 'user', userid: userid, username: username, account: obj.CloneSafeUser(user), action: 'accountcreate', msg: 'Account created, name is ' + name, domain: domain.id };
 | 
				
			||||||
| 
						 | 
					@ -362,7 +362,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
 | 
				
			||||||
                        if (domain.newaccountsrights) { user.siteadmin = domain.newaccountsrights; }
 | 
					                        if (domain.newaccountsrights) { user.siteadmin = domain.newaccountsrights; }
 | 
				
			||||||
                        var usercount = 0;
 | 
					                        var usercount = 0;
 | 
				
			||||||
                        for (var i in obj.users) { if (obj.users[i].domain == domain.id) { usercount++; } }
 | 
					                        for (var i in obj.users) { if (obj.users[i].domain == domain.id) { usercount++; } }
 | 
				
			||||||
                        if (usercount == 0) { user.siteadmin = 0xFFFFFFFF; /*if (domain.newaccounts === 2) { delete domain.newaccounts; }*/ } // If this is the first user, give the account site admin.
 | 
					                        if (usercount == 0) { user.siteadmin = 4294967295; /*if (domain.newaccounts === 2) { delete domain.newaccounts; }*/ } // If this is the first user, give the account site admin.
 | 
				
			||||||
                        obj.users[user._id] = user;
 | 
					                        obj.users[user._id] = user;
 | 
				
			||||||
                        obj.db.SetUser(user);
 | 
					                        obj.db.SetUser(user);
 | 
				
			||||||
                        var event = { etype: 'user', username: user.name, account: obj.CloneSafeUser(user), action: 'accountcreate', msg: 'Account created, name is ' + name, domain: domain.id };
 | 
					                        var event = { etype: 'user', username: user.name, account: obj.CloneSafeUser(user), action: 'accountcreate', msg: 'Account created, name is ' + name, domain: domain.id };
 | 
				
			||||||
| 
						 | 
					@ -803,7 +803,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
 | 
				
			||||||
                                var user = { type: 'user', _id: 'user/' + domain.id + '/' + req.body.username.toLowerCase(), name: req.body.username, email: req.body.email, creation: Math.floor(Date.now() / 1000), login: Math.floor(Date.now() / 1000), domain: domain.id };
 | 
					                                var user = { type: 'user', _id: 'user/' + domain.id + '/' + req.body.username.toLowerCase(), name: req.body.username, email: req.body.email, creation: Math.floor(Date.now() / 1000), login: Math.floor(Date.now() / 1000), domain: domain.id };
 | 
				
			||||||
                                if (domain.newaccountsrights) { user.siteadmin = domain.newaccountsrights; }
 | 
					                                if (domain.newaccountsrights) { user.siteadmin = domain.newaccountsrights; }
 | 
				
			||||||
                                if ((domain.passwordrequirements != null) && (domain.passwordrequirements.hint === true) && (req.body.apasswordhint)) { var hint = req.body.apasswordhint; if (hint.length > 250) { hint = hint.substring(0, 250); } user.passhint = hint; }
 | 
					                                if ((domain.passwordrequirements != null) && (domain.passwordrequirements.hint === true) && (req.body.apasswordhint)) { var hint = req.body.apasswordhint; if (hint.length > 250) { hint = hint.substring(0, 250); } user.passhint = hint; }
 | 
				
			||||||
                                if (domainUserCount == 0) { user.siteadmin = 0xFFFFFFFF; /*if (domain.newaccounts === 2) { delete domain.newaccounts; }*/ } // If this is the first user, give the account site admin.
 | 
					                                if (domainUserCount == 0) { user.siteadmin = 4294967295; /*if (domain.newaccounts === 2) { delete domain.newaccounts; }*/ } // If this is the first user, give the account site admin.
 | 
				
			||||||
                                obj.users[user._id] = user;
 | 
					                                obj.users[user._id] = user;
 | 
				
			||||||
                                req.session.userid = user._id;
 | 
					                                req.session.userid = user._id;
 | 
				
			||||||
                                req.session.domainid = domain.id;
 | 
					                                req.session.domainid = domain.id;
 | 
				
			||||||
| 
						 | 
					@ -1242,7 +1242,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
 | 
				
			||||||
            req.session.currentNode = '';
 | 
					            req.session.currentNode = '';
 | 
				
			||||||
            if (obj.users[req.session.userid] == null) {
 | 
					            if (obj.users[req.session.userid] == null) {
 | 
				
			||||||
                // Create the dummy user ~ with impossible password
 | 
					                // Create the dummy user ~ with impossible password
 | 
				
			||||||
                obj.users[req.session.userid] = { type: 'user', _id: req.session.userid, name: '~', email: '~', domain: domain.id, siteadmin: 0xFFFFFFFF };
 | 
					                obj.users[req.session.userid] = { type: 'user', _id: req.session.userid, name: '~', email: '~', domain: domain.id, siteadmin: 4294967295 };
 | 
				
			||||||
                obj.db.SetUser(obj.users[req.session.userid]);
 | 
					                obj.db.SetUser(obj.users[req.session.userid]);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        } else if (obj.args.user && obj.users['user/' + domain.id + '/' + obj.args.user.toLowerCase()]) {
 | 
					        } else if (obj.args.user && obj.users['user/' + domain.id + '/' + obj.args.user.toLowerCase()]) {
 | 
				
			||||||
| 
						 | 
					@ -1280,7 +1280,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
 | 
				
			||||||
                    var usercount = 0, user2 = { type: 'user', _id: req.session.userid, name: req.connection.user, domain: domain.id, sid: req.session.usersid, creation: Math.floor(Date.now() / 1000), login: Math.floor(Date.now() / 1000) };
 | 
					                    var usercount = 0, user2 = { type: 'user', _id: req.session.userid, name: req.connection.user, domain: domain.id, sid: req.session.usersid, creation: Math.floor(Date.now() / 1000), login: Math.floor(Date.now() / 1000) };
 | 
				
			||||||
                    if (domain.newaccountsrights) { user2.siteadmin = domain.newaccountsrights; }
 | 
					                    if (domain.newaccountsrights) { user2.siteadmin = domain.newaccountsrights; }
 | 
				
			||||||
                    for (var i in obj.users) { if (obj.users[i].domain == domain.id) { usercount++; } }
 | 
					                    for (var i in obj.users) { if (obj.users[i].domain == domain.id) { usercount++; } }
 | 
				
			||||||
                    if (usercount == 0) { user2.siteadmin = 0xFFFFFFFF; } // If this is the first user, give the account site admin.
 | 
					                    if (usercount == 0) { user2.siteadmin = 4294967295; } // If this is the first user, give the account site admin.
 | 
				
			||||||
                    obj.users[req.session.userid] = user2;
 | 
					                    obj.users[req.session.userid] = user2;
 | 
				
			||||||
                    obj.db.SetUser(user2);
 | 
					                    obj.db.SetUser(user2);
 | 
				
			||||||
                    var event = { etype: 'user', username: req.connection.user, account: obj.CloneSafeUser(user2), action: 'accountcreate', msg: 'Domain account created, user ' + req.connection.user, domain: domain.id };
 | 
					                    var event = { etype: 'user', username: req.connection.user, account: obj.CloneSafeUser(user2), action: 'accountcreate', msg: 'Domain account created, user ' + req.connection.user, domain: domain.id };
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue