diff --git a/package.json b/package.json
index 752597e1..103717d5 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "meshcentral",
- "version": "0.3.6-t",
+ "version": "0.3.6-u",
"keywords": [
"Remote Management",
"Intel AMT",
diff --git a/views/default-min.handlebars b/views/default-min.handlebars
index 7c651233..cdfed544 100644
--- a/views/default-min.handlebars
+++ b/views/default-min.handlebars
@@ -8713,17 +8713,14 @@ var QRCode;!function(){function a(a){this.mode=c.MODE_8BIT_BYTE,this.data=a,this
// Setup CIRA using a MeshCommander script (Pretty Simple)
x += "
To add a new Intel® AMT device to device group \"" + EscapeHtml(mesh.name) + "\" with CIRA, download the following script files and use MeshCommander to run the script to configure computers.
";
// Setup CIRA with user/pass authentication (Somewhat difficult)
x += "
To add a new Intel® AMT device to device group \"" + EscapeHtml(mesh.name) + "\" with CIRA, load the following certificate as trusted root within Intel AMT";
if (serverinfo.mpspass) { x += " and authenticate to the server using this username and password.
"; } else { x += " and authenticate to the server using this username and any password.
"; }
- //x += addHtmlValue('Root Certificate', 'Root Certificate File');
- x += addHtmlValue('Root Certificate', 'Root Certificate File');
+ x += addHtmlValue('Root Certificate', 'Root Certificate File');
x += addHtmlValue('Username', '');
if (serverinfo.mpspass) { x += addHtmlValue('Password', ''); }
if (serverinfo != null) { x += addHtmlValue('MPS Server', ''); }
@@ -8732,8 +8729,7 @@ var QRCode;!function(){function a(a){this.mode=c.MODE_8BIT_BYTE,this.data=a,this
// Setup CIRA with certificate authentication (Really difficult, only if TLS offload is not used)
if ((features & 16) == 0) {
x += "
To add a new Intel® AMT device to device group \"" + EscapeHtml(mesh.name) + "\" with CIRA, load the following certificate as trusted root within Intel AMT, authenticate using a client certificate with the following common name and connect to the following server.
";
- //x += addHtmlValue('Root Certificate', 'Root Certificate File');
- x += addHtmlValue('Root Certificate', 'Root Certificate File');
+ x += addHtmlValue('Root Certificate', 'Root Certificate File');
x += addHtmlValue('Organization', '');
if (serverinfo != null) { x += addHtmlValue('MPS Server', ''); }
x += "
";
@@ -8825,10 +8821,8 @@ var QRCode;!function(){function a(a){this.mode=c.MODE_8BIT_BYTE,this.data=a,this
// Windows agent install
//x += "
To add a new computer to device group \"" + EscapeHtml(mesh.name) + "\", download the mesh agent and configuration file and install the agent on the computer to manage.
";
x += "
To add a new computer to device group \"" + EscapeHtml(mesh.name) + "\", download the mesh agent and install it the computer to manage. This agent has server and device group information embedded within it.
";
// Linux agent uninstall
@@ -8904,35 +8896,6 @@ var QRCode;!function(){function a(a){this.mode=c.MODE_8BIT_BYTE,this.data=a,this
copyTextToClip(c);
}
- function fileDownload(path, name, appendFlag) {
- var xdr = null, flag = '';
- if (appendFlag == 1) {
- // Download a agent
- flag = Q('aginsType').value;
- } else if (appendFlag == 2) {
- // Download meshcmd
- flag = Q('aginsSelect').value;
- if (parseInt(flag) >= 5) { name = name.toLowerCase(); } else { name += '.exe'; }
- }
-
- if (args.filedownloadtab == 1) {
- // Open a new tab with download
- window.open(window.location.origin + '/' + path + flag, '_blank');
- } else {
- // Background download & save
- try { xdr = new XDomainRequest(); } catch (e) { }
- if (!xdr) xdr = new XMLHttpRequest();
- xdr.open("GET", window.location.origin + '/' + path + flag);
- xdr.timeout = 15000;
- xdr.responseType = "blob";
- xdr.onprogress = function (x) { /*console.log(x);*/ };
- xdr.onload = function (e) { saveAs(new Blob([e.target.response], { type: "application/octet-stream" }), name); if (xxdialogTag == 'fileDownload') { setDialogMode(0); } };
- xdr.onerror = function () { if (xxdialogTag == 'fileDownload') { setDialogMode(0); } alert('Agent downloads timeout.'); };
- xdr.ontimeout = function () { if (xxdialogTag == 'fileDownload') { setDialogMode(0); } alert('Unable to download agent.'); };
- xdr.send();
- }
- }
-
function addAgentToMeshClick() {
var v = Q('aginsSelect').value;
QV('agins_windows', v == 0);
@@ -10198,13 +10161,7 @@ var QRCode;!function(){function a(a){this.mode=c.MODE_8BIT_BYTE,this.data=a,this
++count;
date = new Date(date.getTime() - (1000 * 60 * 60 * 24)); // Substract one day
}
- QH('p10html2', '
Day
7 Day Power State
' + x + '
');
- }
-
- // Download the power events for the current device
- function p10downloadPowerEvents() {
- console.log("devicepowerevents?id=" + currentNode._id);
- fileDownload("devicepowerevents.ashx?id=" + currentNode._id, "powerevents-" + currentNode.name + ".csv");
+ QH('p10html2', '
Day
7 Day Power State
' + x + '
');
}
// Return a color for the given power state
@@ -10359,7 +10316,7 @@ var QRCode;!function(){function a(a){this.mode=c.MODE_8BIT_BYTE,this.data=a,this
function p10showMeshRouterDialog() {
if (xxdialogMode) return;
var x = "
MeshCentral Router is a Windows tool for TCP port mapping. You can, for example, RDP into a remote device thru this server.
";
- x += addHtmlValue('Win32 Executable', 'MeshCentralRouter.exe');
+ x += addHtmlValue('Win32 Executable', 'MeshCentralRouter.exe');
setDialogMode(2, "MeshCentral Router", 1, null, x, "fileDownload");
}
@@ -10379,12 +10336,9 @@ var QRCode;!function(){function a(a){this.mode=c.MODE_8BIT_BYTE,this.data=a,this
if (mode == 0) { x += '
MeshCmd is a command line tool that performs lots of different operations. The action file can optionally be downloaded and edited to provide server information and credentials.
'; }
if (mode == 1) { x += '
Download "meshcmd" with an action file to route traffic thru this server to this device. Make sure to edit meshaction.txt and add your account password or make any changes needed.
'; }
x += addHtmlValue('Operating System', y);
- //x += addHtmlValue('MeshCmd', '');
- //if (mode == 0) { x += addHtmlValue('Action File', 'MeshAction (.txt)'); }
- //if (mode == 1) { x += addHtmlValue('Action File', 'MeshAction (.txt)'); }
- x += addHtmlValue('MeshCmd', '');
- if (mode == 0) { x += addHtmlValue('Action File', 'MeshAction (.txt)'); }
- if (mode == 1) { x += addHtmlValue('Action File', 'MeshAction (.txt)'); }
+ x += addHtmlValue('MeshCmd', '');
+ if (mode == 0) { x += addHtmlValue('Action File', 'MeshAction (.txt)'); }
+ if (mode == 1) { x += addHtmlValue('Action File', 'MeshAction (.txt)'); }
x += "
";
setDialogMode(2, ["Download MeshCmd","Network Router"][mode], 9, null, x, "fileDownload");
meshCmdOsClick();
diff --git a/views/default.handlebars b/views/default.handlebars
index 703e69bd..152ba3e5 100644
--- a/views/default.handlebars
+++ b/views/default.handlebars
@@ -2658,17 +2658,14 @@
// Setup CIRA using a MeshCommander script (Pretty Simple)
x += "
To add a new Intel® AMT device to device group \"" + EscapeHtml(mesh.name) + "\" with CIRA, download the following script files and use MeshCommander to run the script to configure computers.
";
// Setup CIRA with user/pass authentication (Somewhat difficult)
x += "
To add a new Intel® AMT device to device group \"" + EscapeHtml(mesh.name) + "\" with CIRA, load the following certificate as trusted root within Intel AMT";
if (serverinfo.mpspass) { x += " and authenticate to the server using this username and password.
"; } else { x += " and authenticate to the server using this username and any password.
"; }
- //x += addHtmlValue('Root Certificate', 'Root Certificate File');
- x += addHtmlValue('Root Certificate', 'Root Certificate File');
+ x += addHtmlValue('Root Certificate', 'Root Certificate File');
x += addHtmlValue('Username', '');
if (serverinfo.mpspass) { x += addHtmlValue('Password', ''); }
if (serverinfo != null) { x += addHtmlValue('MPS Server', ''); }
@@ -2677,8 +2674,7 @@
// Setup CIRA with certificate authentication (Really difficult, only if TLS offload is not used)
if ((features & 16) == 0) {
x += "
To add a new Intel® AMT device to device group \"" + EscapeHtml(mesh.name) + "\" with CIRA, load the following certificate as trusted root within Intel AMT, authenticate using a client certificate with the following common name and connect to the following server.
";
- //x += addHtmlValue('Root Certificate', 'Root Certificate File');
- x += addHtmlValue('Root Certificate', 'Root Certificate File');
+ x += addHtmlValue('Root Certificate', 'Root Certificate File');
x += addHtmlValue('Organization', '');
if (serverinfo != null) { x += addHtmlValue('MPS Server', ''); }
x += "
To add a new computer to device group \"" + EscapeHtml(mesh.name) + "\", download the mesh agent and configuration file and install the agent on the computer to manage.
";
x += "
To add a new computer to device group \"" + EscapeHtml(mesh.name) + "\", download the mesh agent and install it the computer to manage. This agent has server and device group information embedded within it.
";
// Linux agent uninstall
@@ -2849,35 +2841,6 @@
copyTextToClip(c);
}
- function fileDownload(path, name, appendFlag) {
- var xdr = null, flag = '';
- if (appendFlag == 1) {
- // Download a agent
- flag = Q('aginsType').value;
- } else if (appendFlag == 2) {
- // Download meshcmd
- flag = Q('aginsSelect').value;
- if (parseInt(flag) >= 5) { name = name.toLowerCase(); } else { name += '.exe'; }
- }
-
- if (args.filedownloadtab == 1) {
- // Open a new tab with download
- window.open(window.location.origin + '/' + path + flag, '_blank');
- } else {
- // Background download & save
- try { xdr = new XDomainRequest(); } catch (e) { }
- if (!xdr) xdr = new XMLHttpRequest();
- xdr.open("GET", window.location.origin + '/' + path + flag);
- xdr.timeout = 15000;
- xdr.responseType = "blob";
- xdr.onprogress = function (x) { /*console.log(x);*/ };
- xdr.onload = function (e) { saveAs(new Blob([e.target.response], { type: "application/octet-stream" }), name); if (xxdialogTag == 'fileDownload') { setDialogMode(0); } };
- xdr.onerror = function () { if (xxdialogTag == 'fileDownload') { setDialogMode(0); } alert('Agent downloads timeout.'); };
- xdr.ontimeout = function () { if (xxdialogTag == 'fileDownload') { setDialogMode(0); } alert('Unable to download agent.'); };
- xdr.send();
- }
- }
-
function addAgentToMeshClick() {
var v = Q('aginsSelect').value;
QV('agins_windows', v == 0);
@@ -4143,13 +4106,7 @@
++count;
date = new Date(date.getTime() - (1000 * 60 * 60 * 24)); // Substract one day
}
- QH('p10html2', '
Day
7 Day Power State
' + x + '
');
- }
-
- // Download the power events for the current device
- function p10downloadPowerEvents() {
- console.log("devicepowerevents?id=" + currentNode._id);
- fileDownload("devicepowerevents.ashx?id=" + currentNode._id, "powerevents-" + currentNode.name + ".csv");
+ QH('p10html2', '
Day
7 Day Power State
' + x + '
');
}
// Return a color for the given power state
@@ -4304,7 +4261,7 @@
function p10showMeshRouterDialog() {
if (xxdialogMode) return;
var x = "
MeshCentral Router is a Windows tool for TCP port mapping. You can, for example, RDP into a remote device thru this server.
";
- x += addHtmlValue('Win32 Executable', 'MeshCentralRouter.exe');
+ x += addHtmlValue('Win32 Executable', 'MeshCentralRouter.exe');
setDialogMode(2, "MeshCentral Router", 1, null, x, "fileDownload");
}
@@ -4324,12 +4281,9 @@
if (mode == 0) { x += '
MeshCmd is a command line tool that performs lots of different operations. The action file can optionally be downloaded and edited to provide server information and credentials.
'; }
if (mode == 1) { x += '
Download "meshcmd" with an action file to route traffic thru this server to this device. Make sure to edit meshaction.txt and add your account password or make any changes needed.
'; }
x += addHtmlValue('Operating System', y);
- //x += addHtmlValue('MeshCmd', '');
- //if (mode == 0) { x += addHtmlValue('Action File', 'MeshAction (.txt)'); }
- //if (mode == 1) { x += addHtmlValue('Action File', 'MeshAction (.txt)'); }
- x += addHtmlValue('MeshCmd', '');
- if (mode == 0) { x += addHtmlValue('Action File', 'MeshAction (.txt)'); }
- if (mode == 1) { x += addHtmlValue('Action File', 'MeshAction (.txt)'); }
+ x += addHtmlValue('MeshCmd', '');
+ if (mode == 0) { x += addHtmlValue('Action File', 'MeshAction (.txt)'); }
+ if (mode == 1) { x += addHtmlValue('Action File', 'MeshAction (.txt)'); }
x += "
";
setDialogMode(2, ["Download MeshCmd","Network Router"][mode], 9, null, x, "fileDownload");
meshCmdOsClick();
diff --git a/webserver.js b/webserver.js
index fe86e449..77e27fc0 100644
--- a/webserver.js
+++ b/webserver.js
@@ -2355,6 +2355,11 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
var serveridhex = Buffer.from(obj.agentCertificateHashBase64.replace(/\@/g, '+').replace(/\$/g, '/'), 'base64').toString('hex').toUpperCase();
var httpsPort = ((obj.args.aliasport == null) ? obj.args.port : obj.args.aliasport); // Use HTTPS alias port is specified
+ // Prepare a mesh agent file name using the device group name.
+ var meshfilename = mesh.name
+ meshfilename = meshfilename.split('\\').join('').split('/').join('').split(':').join('').split('*').join('').split('?').join('').split('"').join('').split('<').join('').split('>').join('').split('|').join('').split(' ').join('').split('\'').join('');
+ if (argentInfo.rname.endsWith('.exe')) { meshfilename = argentInfo.rname.substring(0, argentInfo.rname.length - 4) + '-' + meshfilename + '.exe'; } else { meshfilename = argentInfo.rname + '-' + meshfilename; }
+
// Build the agent connection URL. If we are using a sub-domain or one with a DNS, we need to craft the URL correctly.
var xdomain = (domain.dns == null) ? domain.id : '';
if (xdomain != '') xdomain += "/";
@@ -2366,7 +2371,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
if (obj.args.agentconfig) { for (var i in obj.args.agentconfig) { meshsettings += obj.args.agentconfig[i] + "\r\n"; } }
if (domain.agentconfig) { for (var i in domain.agentconfig) { meshsettings += domain.agentconfig[i] + "\r\n"; } }
- res.set({ 'Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0', 'Content-Type': 'application/octet-stream', 'Content-Disposition': 'attachment; filename="' + argentInfo.rname + '"' });
+ res.set({ 'Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0', 'Content-Type': 'application/octet-stream', 'Content-Disposition': 'attachment; filename="' + meshfilename + '"' });
obj.parent.exeHandler.streamExeWithMeshPolicy({ platform: 'win32', sourceFileName: obj.parent.meshAgentBinaries[req.query.id].path, destinationStream: res, msh: meshsettings, peinfo: obj.parent.meshAgentBinaries[req.query.id].pe });
}
} else if (req.query.script != null) {
@@ -2446,7 +2451,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
} else if (req.query.meshaction == 'winrouter') {
var p = obj.path.join(__dirname, 'agents', 'MeshCentralRouter.exe');
if (obj.fs.existsSync(p)) {
- res.set({ 'Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0', 'Content-Type': 'text/plain', 'Content-Disposition': 'attachment; filename="MeshCentralRouter.exe"' });
+ res.set({ 'Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0', 'Content-Type': 'application/octet-stream', 'Content-Disposition': 'attachment; filename="MeshCentralRouter.exe"' });
try { res.sendFile(p); } catch (e) { res.sendStatus(404); }
} else { res.sendStatus(404); }
} else {
@@ -2459,9 +2464,9 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
for (var agentid in obj.parent.meshAgentBinaries) {
var agentinfo = obj.parent.meshAgentBinaries[agentid];
response += '