mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-24 06:05:53 -05:00
Added selective session recording.
This commit is contained in:
parent
ead64152e5
commit
7b71c0488f
@ -309,6 +309,7 @@
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"onlySelectedDeviceGroups": { "type": "boolean", "default": false, "description": "When enabled, only device groups with the session recording feature turned on will be recorded. When false, all devices are recorded." },
|
||||
"filepath": { "type": "string" },
|
||||
"index": { "type": "boolean", "default": false },
|
||||
"maxRecordings": { "type": "integer" },
|
||||
|
@ -683,6 +683,13 @@ function CreateDesktopMultiplexor(parent, domain, nodeid, func) {
|
||||
function recordingSetup(domain, func) {
|
||||
// Setup session recording
|
||||
if ((domain.sessionrecording == true || ((typeof domain.sessionrecording == 'object') && ((domain.sessionrecording.protocols == null) || (domain.sessionrecording.protocols.indexOf(2) >= 0))))) {
|
||||
|
||||
// Check again to make sure we need to start recording
|
||||
if (domain.sessionrecording.onlyselecteddevicegroups === true) {
|
||||
var mesh = parent.meshes[obj.meshid];
|
||||
if ((mesh.flags == null) || ((mesh.flags & 4) == 0)) { func(false); return; } // Do not record the session
|
||||
}
|
||||
|
||||
var now = new Date(Date.now());
|
||||
var recFilename = 'desktopSession' + ((domain.id == '') ? '' : '-') + domain.id + '-' + now.getUTCFullYear() + '-' + parent.common.zeroPad(now.getUTCMonth(), 2) + '-' + parent.common.zeroPad(now.getUTCDate(), 2) + '-' + parent.common.zeroPad(now.getUTCHours(), 2) + '-' + parent.common.zeroPad(now.getUTCMinutes(), 2) + '-' + parent.common.zeroPad(now.getUTCSeconds(), 2) + '-' + obj.nodeid.split('/')[2] + '.mcrec'
|
||||
var recFullFilename = null;
|
||||
|
13
meshrelay.js
13
meshrelay.js
@ -232,7 +232,18 @@ module.exports.CreateMeshRelay = function (parent, ws, req, domain, user, cookie
|
||||
parent.db.Get(obj.req.query.nodeid, function (err, nodes) {
|
||||
var xusername = '', xdevicename = '', xdevicename2 = null, node = null;
|
||||
if ((nodes != null) && (nodes.length == 1)) { node = nodes[0]; xdevicename2 = node.name; xdevicename = '-' + parent.common.makeFilename(node.name); }
|
||||
|
||||
|
||||
// Check again if we need to do recording
|
||||
if (domain.sessionrecording.onlyselecteddevicegroups === true) {
|
||||
var mesh = parent.meshes[node.meshid];
|
||||
if ((mesh.flags == null) || ((mesh.flags & 4) == 0)) {
|
||||
// Do not record the session, just send session start
|
||||
try { ws.send('c'); } catch (ex) { } // Send connect to both peers
|
||||
try { relayinfo.peer1.ws.send('c'); } catch (ex) { }
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Get the username and make it acceptable as a filename
|
||||
if (sessionUser._id) { xusername = '-' + parent.common.makeFilename(sessionUser._id.split('/')[2]); }
|
||||
|
||||
|
@ -421,6 +421,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||
serverinfo.maxGuestSessionSharingTime = (typeof domain.maxguestsessionsharingtime == 'number') ? domain.maxguestsessionsharingtime : 60;
|
||||
serverinfo.languages = parent.renderLanguages;
|
||||
serverinfo.tlshash = Buffer.from(parent.webCertificateHashs[domain.id], 'binary').toString('hex').toUpperCase(); // SHA384 of server HTTPS certificate
|
||||
if ((domain.sessionrecording) && (domain.sessionrecording.onlyselecteddevicegroups === true)) { serverinfo.devGroupSessionRecording = 1; } // Allow enabling of session recording
|
||||
if ((parent.parent.config.domains[domain.id].amtacmactivation != null) && (parent.parent.config.domains[domain.id].amtacmactivation.acmmatch != null)) {
|
||||
var matchingDomains = [];
|
||||
for (var i in parent.parent.config.domains[domain.id].amtacmactivation.acmmatch) {
|
||||
|
@ -226,6 +226,7 @@
|
||||
},
|
||||
"_agentConfig": [ "webSocketMaskOverride=1", "coreDumpEnabled=1" ],
|
||||
"_sessionRecording": {
|
||||
"_onlySelectedDeviceGroups": true,
|
||||
"_filepath": "C:\\temp",
|
||||
"_index": true,
|
||||
"_maxRecordings": 10,
|
||||
|
@ -9321,6 +9321,7 @@
|
||||
if (currentMesh.flags) {
|
||||
if (currentMesh.flags & 1) { meshFeatures.push("Auto-Remove"); }
|
||||
if (currentMesh.flags & 2) { meshFeatures.push("Hostname Sync"); }
|
||||
if ((serverinfo.devGroupSessionRecording == 1) && (currentMesh.flags & 4)) { meshFeatures.push("Record Sessions"); }
|
||||
}
|
||||
meshFeatures = meshFeatures.join(', ');
|
||||
if (meshFeatures == '') { meshFeatures = '<i>' + "None" + '</i>'; }
|
||||
@ -9620,6 +9621,7 @@
|
||||
var flags = (currentMesh.flags)?currentMesh.flags:0;
|
||||
var x = '<div><label><input type=checkbox id=d20flag1 ' + ((flags & 1) ? 'checked' : '') + '>' + "Remove device on disconnect" + '</label><br></div>';
|
||||
x += '<div><label><input type=checkbox id=d20flag2 ' + ((flags & 2) ? 'checked' : '') + '>' + "Sync server device name to hostname" + '</label><br></div>';
|
||||
if (serverinfo.devGroupSessionRecording == 1) { x += '<div><label><input type=checkbox id=d20flag4 ' + ((flags & 4) ? 'checked' : '') + '>' + "Record sessions" + '</label><br></div>'; }
|
||||
setDialogMode(2, "Edit Device Group Features", 3, p20editmeshfeaturesEx, x);
|
||||
}
|
||||
|
||||
@ -9627,6 +9629,7 @@
|
||||
var flags = 0;
|
||||
if (Q('d20flag1').checked) { flags += 1; }
|
||||
if (Q('d20flag2').checked) { flags += 2; }
|
||||
if (serverinfo.devGroupSessionRecording == 1) { if (Q('d20flag4').checked) { flags += 4; } }
|
||||
meshserver.send({ action: 'editmesh', meshid: currentMesh._id, flags: flags });
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user