Windows hashing fix for MeshAssistant.

This commit is contained in:
Ylian Saint-Hilaire 2021-05-18 15:44:53 -07:00
parent 3cb606fcad
commit db03a0959e
2 changed files with 42 additions and 24 deletions

Binary file not shown.

View File

@ -2401,13 +2401,30 @@ function CreateMeshCentralServer(config, args) {
// List of possible mesh agent install scripts
var meshToolsList = {
'MeshCentralRouter': { localname: 'MeshCentralRouter.exe', dlname: 'winrouter' },
'MeshCentralAssistant': { localname: 'MeshCentralAssistant.exe', dlname: 'winassistant' }
'MeshCentralAssistant': { localname: 'MeshCentralAssistant.exe', dlname: 'winassistant', winhash: true }
//'MeshCentralRouterMacOS': { localname: 'MeshCentralRouter.dmg', dlname: 'MeshCentralRouter.dmg' }
};
// Update the list of available mesh agents
obj.updateMeshTools = function () {
for (var toolname in meshToolsList) {
if (meshToolsList[toolname].winhash === true) {
var toolpath = obj.path.join(__dirname, 'agents', meshToolsList[toolname].localname);
var hashStream = obj.crypto.createHash('sha384');
hashStream.toolname = toolname;
hashStream.toolpath = toolpath;
hashStream.dlname = meshToolsList[toolname].dlname;
hashStream.hashx = 0;
hashStream.on('data', function (data) {
obj.meshToolsBinaries[this.toolname] = { hash: data.toString('hex'), hashx: this.hashx, path: this.toolpath, dlname: this.dlname, url: this.url };
obj.meshToolsBinaries[this.toolname].url = 'https://' + obj.certificates.CommonName + ':' + ((typeof obj.args.aliasport == 'number') ? obj.args.aliasport : obj.args.port) + '/meshagents?meshaction=' + this.dlname;
var stats = null;
try { stats = obj.fs.statSync(this.toolpath); } catch (e) { }
if (stats != null) { obj.meshToolsBinaries[this.toolname].size = stats.size; }
});
var options = { sourcePath: toolpath, targetStream: hashStream };
obj.exeHandler.hashExecutableFile(options);
} else {
var toolpath = obj.path.join(__dirname, 'agents', meshToolsList[toolname].localname);
var stream = null;
try {
@ -2436,6 +2453,7 @@ function CreateMeshCentralServer(config, args) {
stream.hashx = 0;
} catch (e) { }
}
}
};
// List of possible mesh agent install scripts