Added signed MeshCmd.exe.

Ylian Saint-Hilaire committed Mar 9, 2018 at 16:39 UTC 386b535a7a7950609cee222d29effd215686b8b5
9 files changed +19 -6
agents/MeshCmd-signed.exe
Binary files /dev/null and b/agents/MeshCmd-signed.exe differ
agents/MeshCmd64-signed.exe
Binary files /dev/null and b/agents/MeshCmd64-signed.exe differ
agents/MeshService-signed.exe
Binary files a/agents/MeshService-signed.exe and b/agents/MeshService-signed.exe differ
agents/MeshService.exe
Binary files a/agents/MeshService.exe and b/agents/MeshService.exe differ
agents/MeshService64-signed.exe
Binary files a/agents/MeshService64-signed.exe and b/agents/MeshService64-signed.exe differ
agents/MeshService64.exe
Binary files a/agents/MeshService64.exe and b/agents/MeshService64.exe differ
meshcentral.js
+7 -5
@@ -872,8 +872,8 @@ function CreateMeshCentralServer(config) {
872 23: { id: 23, localname: 'MeshAgent-NodeJS', rname: 'meshagent', desc: 'NodeJS', update: false, amt: false, platform: 'node' }, // Get this one from NPM
873 24: { id: 24, localname: 'meshagent_arm-linaro', rname: 'meshagent', desc: 'Linux ARM Linaro', update: true, amt: false, platform: 'linux' },
874 25: { id: 25, localname: 'meshagent_pi', rname: 'meshagent', desc: 'Linux ARM - Raspberry Pi', update: true, amt: false, platform: 'linux' }, // "armv6l" and "armv7l"
875 - 10003: { id: 3, localname: 'MeshService.exe', rname: 'meshagent.exe', desc: 'Windows x86-32 service', update: true, amt: true, platform: 'win32' }, // Unsigned version of the MeshAgent
876 - 10004: { id: 4, localname: 'MeshService64.exe', rname: 'meshagent.exe', desc: 'Windows x86-64 service', update: true, amt: true, platform: 'win32' } // Unsigned version of the MeshAgent
875 + 10003: { id: 3, localname: 'MeshService.exe', rname: 'meshagent.exe', desc: 'Windows x86-32 service', update: true, amt: true, platform: 'win32' }, // Unsigned version of the Windows MeshAgent x86
876 + 10004: { id: 4, localname: 'MeshService64.exe', rname: 'meshagent.exe', desc: 'Windows x86-64 service', update: true, amt: true, platform: 'win32' } // Unsigned version of the Windows MeshAgent x64
877 };
878
879 // Update the list of available mesh agents
@@ -883,14 +883,14 @@ function CreateMeshCentralServer(config) {
883 var agentpath = obj.path.join(__dirname, 'agents', obj.meshAgentsArchitectureNumbers[archid].localname);
884
885 // Fetch all the agent binary information
886 - obj.meshAgentBinaries[archid] = obj.common.Clone(obj.meshAgentsArchitectureNumbers[archid]);
887 - obj.meshAgentBinaries[archid].path = agentpath;
888 - obj.meshAgentBinaries[archid].url = ((obj.args.notls == true) ? 'http://' : 'https://') + obj.certificates.CommonName + ':' + obj.args.port + '/meshagents?id=' + archid;
886 var stats = null;
887 try { stats = obj.fs.statSync(agentpath) } catch (e) { }
888 if ((stats != null)) {
889 // If file exists
890 archcount++;
891 + obj.meshAgentBinaries[archid] = obj.common.Clone(obj.meshAgentsArchitectureNumbers[archid]);
892 + obj.meshAgentBinaries[archid].path = agentpath;
893 + obj.meshAgentBinaries[archid].url = ((obj.args.notls == true) ? 'http://' : 'https://') + obj.certificates.CommonName + ':' + obj.args.port + '/meshagents?id=' + archid;
894 obj.meshAgentBinaries[archid].size = stats.size;
895 // If this is a windows binary, pull binary information
896 if (obj.meshAgentsArchitectureNumbers[archid].platform == 'win32') {
@@ -908,6 +908,8 @@ function CreateMeshCentralServer(config) {
908 obj.exeHandler.hashExecutableFile(options);
909 }
910 }
911 + if ((obj.meshAgentBinaries[3] == null) && (obj.meshAgentBinaries[10003] != null)) { obj.meshAgentBinaries[3] = obj.meshAgentBinaries[10003]; } // If only the unsigned windows binaries are present, use them.
912 + if ((obj.meshAgentBinaries[4] == null) && (obj.meshAgentBinaries[10004] != null)) { obj.meshAgentBinaries[4] = obj.meshAgentBinaries[10004]; } // If only the unsigned windows binaries are present, use them.
913 }
914
915 // Generate a time limited user login token
package.json
+1 -1
@@ -1,6 +1,6 @@
1 {
2 "name": "meshcentral",
3 - "version": "0.1.4-v",
3 + "version": "0.1.4-x",
4 "keywords": [
5 "Remote Management",
6 "Intel AMT",
webserver.js
+11
@@ -1459,6 +1459,17 @@ module.exports.CreateWebServer = function (parent, db, args, secret, certificate
1459 } else if (req.query.meshcmd != null) {
1460 // Send meshcmd for a specific platform back
1461 var agentid = parseInt(req.query.meshcmd);
1462 + // If the agentid is 3 or 4, check if we have a signed MeshCmd.exe
1463 + if ((agentid == 3)) { // Signed Windows MeshCmd.exe x86
1464 + var stats = null, meshCmdPath = obj.path.join(__dirname, 'agents', 'MeshCmd-signed.exe');
1465 + try { stats = obj.fs.statSync(meshCmdPath) } catch (e) { }
1466 + if ((stats != null)) { res.set({ 'Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0', 'Content-Type': 'application/octet-stream', 'Content-Disposition': 'attachment; filename=meshcmd' + ((req.query.meshcmd <= 3) ? '.exe' : '') }); res.sendFile(meshCmdPath); return; }
1467 + } else if ((agentid == 4)) { // Signed Windows MeshCmd64.exe x64
1468 + var stats = null, meshCmd64Path = obj.path.join(__dirname, 'agents', 'MeshCmd64-signed.exe');
1469 + try { stats = obj.fs.statSync(meshCmd64Path) } catch (e) { }
1470 + if ((stats != null)) { res.set({ 'Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0', 'Content-Type': 'application/octet-stream', 'Content-Disposition': 'attachment; filename=meshcmd' + ((req.query.meshcmd <= 4) ? '.exe' : '') }); res.sendFile(meshCmd64Path); return; }
1471 + }
1472 + // No signed agents, we are going to merge a new MeshCmd.
1473 if ((agentid < 10000) && (obj.parent.meshAgentBinaries[agentid + 10000] != null)) { agentid += 10000; } // Avoid merging javascript to a signed mesh agent.
1474 var argentInfo = obj.parent.meshAgentBinaries[agentid];
1475 if ((argentInfo == null) || (obj.parent.defaultMeshCmd == null)) { res.sendStatus(404); return; }