New agents, fixed cert loading with text prefix.

This commit is contained in:
Ylian Saint-Hilaire 2019-01-15 09:20:21 -08:00
parent b514efaaf1
commit e7c3c2cd70
23 changed files with 29 additions and 10 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1052,7 +1052,7 @@ function createMeshCore(agent) {
child = require('child_process').execFile(process.env['windir'] + '\\system32\\cmd.exe', ["/c", "start", url], { type: childProcess.SpawnTypes.USER }); child = require('child_process').execFile(process.env['windir'] + '\\system32\\cmd.exe', ["/c", "start", url], { type: childProcess.SpawnTypes.USER });
break; break;
case 'linux': case 'linux':
child = require('child_process').execFile('/usr/bin/xdg-open', ['xdg-open', url], { type: require('child_process').SpawnTypes.DETACHED, uid: require('user-sessions').consoleUid() }); child = require('child_process').execFile('/usr/bin/xdg-open', ['xdg-open', url], { uid: require('user-sessions').consoleUid() });
break; break;
case 'darwin': case 'darwin':
child = require('child_process').execFile('/usr/bin/open', ['open', url], { uid: require('user-sessions').consoleUid() }); child = require('child_process').execFile('/usr/bin/open', ['open', url], { uid: require('user-sessions').consoleUid() });

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2018-2019 Intel Corporation Copyright 2018 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -93,7 +93,7 @@ function UserSessions()
} }
this._user32 = this._marshal.CreateNativeProxy('user32.dll'); this._user32 = this._marshal.CreateNativeProxy('user32.dll');
this._user32.CreateMethod('RegisterPowerSettingNotification'); this._user32.CreateMethod({ method: 'RegisterPowerSettingNotification', threadDispatch: 1});
this._user32.CreateMethod('UnregisterPowerSettingNotification'); this._user32.CreateMethod('UnregisterPowerSettingNotification');
this._rpcrt = this._marshal.CreateNativeProxy('Rpcrt4.dll'); this._rpcrt = this._marshal.CreateNativeProxy('Rpcrt4.dll');
this._rpcrt.CreateMethod('UuidFromStringA'); this._rpcrt.CreateMethod('UuidFromStringA');
@ -653,7 +653,7 @@ function UserSessions()
} }
this.consoleUid = function consoleUid() this.consoleUid = function consoleUid()
{ {
var checkstr = process.platform == 'darwin' ? 'console' : ':0'; var checkstr = process.platform == 'darwin' ? 'console' : process.env['DISPLAY'];
var child = require('child_process').execFile('/bin/sh', ['sh']); var child = require('child_process').execFile('/bin/sh', ['sh']);
child.stdout.str = ''; child.stdout.str = '';
child.stdout.on('data', function (chunk) { this.str += chunk.toString(); }); child.stdout.on('data', function (chunk) { this.str += chunk.toString(); });
@ -667,12 +667,13 @@ function UserSessions()
tokens = lines[i].split(' '); tokens = lines[i].split(' ');
for (j = 1; j < tokens.length; ++j) for (j = 1; j < tokens.length; ++j)
{ {
if (tokens[j].length > 0 && tokens[j] == checkstr) if (tokens[j].length > 0 && (tokens[j] == checkstr || tokens[j] == ('(' + checkstr + ')')))
{ {
return (parseInt(this._users()[tokens[0]])); return (parseInt(this._users()[tokens[0]]));
} }
} }
} }
throw ('nobody logged into console'); throw ('nobody logged into console');
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2018-2019 Intel Corporation Copyright 2018 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -93,7 +93,7 @@ function UserSessions()
} }
this._user32 = this._marshal.CreateNativeProxy('user32.dll'); this._user32 = this._marshal.CreateNativeProxy('user32.dll');
this._user32.CreateMethod({ method: 'RegisterPowerSettingNotification', threadDispatch: 1 }); this._user32.CreateMethod({ method: 'RegisterPowerSettingNotification', threadDispatch: 1});
this._user32.CreateMethod('UnregisterPowerSettingNotification'); this._user32.CreateMethod('UnregisterPowerSettingNotification');
this._rpcrt = this._marshal.CreateNativeProxy('Rpcrt4.dll'); this._rpcrt = this._marshal.CreateNativeProxy('Rpcrt4.dll');
this._rpcrt.CreateMethod('UuidFromStringA'); this._rpcrt.CreateMethod('UuidFromStringA');
@ -653,7 +653,7 @@ function UserSessions()
} }
this.consoleUid = function consoleUid() this.consoleUid = function consoleUid()
{ {
var checkstr = process.platform == 'darwin' ? 'console' : ':0'; var checkstr = process.platform == 'darwin' ? 'console' : process.env['DISPLAY'];
var child = require('child_process').execFile('/bin/sh', ['sh']); var child = require('child_process').execFile('/bin/sh', ['sh']);
child.stdout.str = ''; child.stdout.str = '';
child.stdout.on('data', function (chunk) { this.str += chunk.toString(); }); child.stdout.on('data', function (chunk) { this.str += chunk.toString(); });
@ -667,12 +667,13 @@ function UserSessions()
tokens = lines[i].split(' '); tokens = lines[i].split(' ');
for (j = 1; j < tokens.length; ++j) for (j = 1; j < tokens.length; ++j)
{ {
if (tokens[j].length > 0 && tokens[j] == checkstr) if (tokens[j].length > 0 && (tokens[j] == checkstr || tokens[j] == ('(' + checkstr + ')')))
{ {
return (parseInt(this._users()[tokens[0]])); return (parseInt(this._users()[tokens[0]]));
} }
} }
} }
throw ('nobody logged into console'); throw ('nobody logged into console');
} }
} }

View File

@ -148,6 +148,9 @@ module.exports.CertificateOperations = function () {
// Make sure a string with Mac style CR endo of line is changed to Linux LF style. // Make sure a string with Mac style CR endo of line is changed to Linux LF style.
function fixEndOfLines(str) { function fixEndOfLines(str) {
if (typeof (str) != 'string') return str; // If this is not a string, do nothing.
var i = str.indexOf('-----'); // Remove everything before "-----".
if (i > 0) { str = str.substring(i); } // this solves problems with editors that save text file type indicators ahead of the text.
if ((typeof(str) != 'string') || (str.indexOf('\n') > 0)) return str; // If there is a \n in the file, keep the file as-is. if ((typeof(str) != 'string') || (str.indexOf('\n') > 0)) return str; // If there is a \n in the file, keep the file as-is.
return str.split('\r').join('\n'); // If there is no \n, replace all \r with \n. return str.split('\r').join('\n'); // If there is no \n, replace all \r with \n.
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "meshcentral", "name": "meshcentral",
"version": "0.2.6-e", "version": "0.2.6-h",
"keywords": [ "keywords": [
"Remote Management", "Remote Management",
"Intel AMT", "Intel AMT",

View File

@ -239,6 +239,7 @@
<p><strong><img alt="" width=150 height=103 src=images/mainaccount.jpg style=margin-bottom:10px;margin-right:20px;float:right />Account actions</strong></p> <p><strong><img alt="" width=150 height=103 src=images/mainaccount.jpg style=margin-bottom:10px;margin-right:20px;float:right />Account actions</strong></p>
<p style="margin-left:40px"> <p style="margin-left:40px">
<span id="verifyEmailId" style="display:none"><a onclick="account_showVerifyEmail()" style="cursor:pointer">Verify email</a><br /></span> <span id="verifyEmailId" style="display:none"><a onclick="account_showVerifyEmail()" style="cursor:pointer">Verify email</a><br /></span>
<span id="addTwoFactorAuth" style="display:none"><a onclick="account_addTwoFactor()" style="cursor:pointer">Add two-factor authentication</a><br /></span>
<a onclick="account_showChangeEmail()" style="cursor:pointer">Change email address</a><br /> <a onclick="account_showChangeEmail()" style="cursor:pointer">Change email address</a><br />
<a onclick="account_showChangePassword()" style="cursor:pointer">Change password</a><br /> <a onclick="account_showChangePassword()" style="cursor:pointer">Change password</a><br />
<a onclick="account_showDeleteAccount()" style="cursor:pointer">Delete account</a><br /> <a onclick="account_showDeleteAccount()" style="cursor:pointer">Delete account</a><br />
@ -1118,6 +1119,7 @@
updateSiteAdmin(); updateSiteAdmin();
QV('verifyEmailId', (userinfo.emailVerified !== true) && (userinfo.email != null) && (serverinfo.emailcheck == true)); QV('verifyEmailId', (userinfo.emailVerified !== true) && (userinfo.email != null) && (serverinfo.emailcheck == true));
QV('verifyEmailId2', (userinfo.emailVerified !== true) && (userinfo.email != null) && (serverinfo.emailcheck == true)); QV('verifyEmailId2', (userinfo.emailVerified !== true) && (userinfo.email != null) && (serverinfo.emailcheck == true));
//QV('addTwoFactorAuth', (userinfo.secauth != true) && ((features & 4096) != 0));
break; break;
} }
case 'users': { case 'users': {
@ -5027,6 +5029,17 @@
// MY ACCOUNT // MY ACCOUNT
// //
function account_addTwoFactor() {
if (xxdialogMode || (userinfo.secauth == true) || ((features & 4096) == 0)) return;
var x = "Loading...";
setDialogMode(2, "Add Two-Factor Authentication", 2, account_addTwoFactorEx, x);
meshserver.send({ action: 'secauth-request' });
}
function account_addTwoFactorEx() {
}
function account_showVerifyEmail() { function account_showVerifyEmail() {
if (xxdialogMode || (userinfo.emailVerified == true) || (serverinfo.emailcheck != true)) return; if (xxdialogMode || (userinfo.emailVerified == true) || (serverinfo.emailcheck != true)) return;
var x = "Click ok to send a verification mail to:<br /><div style=padding:8px><b>" + EscapeHtml(userinfo.email) + "</b></div>Please wait a few minute to receive the verification."; var x = "Click ok to send a verification mail to:<br /><div style=padding:8px><b>" + EscapeHtml(userinfo.email) + "</b></div>Please wait a few minute to receive the verification.";

View File

@ -780,6 +780,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
if (obj.args.allowhighqualitydesktop == true) { features += 512; } // Enable AllowHighQualityDesktop (Default false) if (obj.args.allowhighqualitydesktop == true) { features += 512; } // Enable AllowHighQualityDesktop (Default false)
if (obj.args.lanonly == true || obj.args.mpsport == 0) { features += 1024; } // No CIRA if (obj.args.lanonly == true || obj.args.mpsport == 0) { features += 1024; } // No CIRA
if ((obj.parent.serverSelfWriteAllowed == true) && (user != null) && (user.siteadmin == 0xFFFFFFFF)) { features += 2048; } // Server can self-write (Allows self-update) if ((obj.parent.serverSelfWriteAllowed == true) && (user != null) && (user.siteadmin == 0xFFFFFFFF)) { features += 2048; } // Server can self-write (Allows self-update)
if (domain.auth != 'sspi') { features += 4096; } // Two-factor auth supported
// Send the master web application // Send the master web application
if ((!obj.args.user) && (obj.args.nousers != true) && (nologout == false)) { logoutcontrol += ' <a href=' + domain.url + 'logout?' + Math.random() + ' style=color:white>Logout</a>'; } // If a default user is in use or no user mode, don't display the logout button if ((!obj.args.user) && (obj.args.nousers != true) && (nologout == false)) { logoutcontrol += ' <a href=' + domain.url + 'logout?' + Math.random() + ' style=color:white>Logout</a>'; } // If a default user is in use or no user mode, don't display the logout button