mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-01-11 23:13:21 -05:00
Added server AgentPing/AgentPong settings.
This commit is contained in:
parent
827a3676f7
commit
395978ac36
@ -623,6 +623,8 @@ function createMeshCore(agent) {
|
|||||||
sendConsoleText('getScript: ' + JSON.stringify(data));
|
sendConsoleText('getScript: ' + JSON.stringify(data));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case 'ping': { mesh.SendCommand('{"action":"pong"}'); break; }
|
||||||
|
case 'pong': { break; }
|
||||||
default:
|
default:
|
||||||
// Unknown action, ignore it.
|
// Unknown action, ignore it.
|
||||||
break;
|
break;
|
||||||
|
2
agents/meshcore.min.js
vendored
2
agents/meshcore.min.js
vendored
File diff suppressed because one or more lines are too long
14
meshagent.js
14
meshagent.js
@ -89,6 +89,10 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
|||||||
delete obj.agentUpdate;
|
delete obj.agentUpdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Perform timer cleanup
|
||||||
|
if (obj.pingtimer) { clearInterval(obj.pingtimer); delete obj.pingtimer; }
|
||||||
|
if (obj.pongtimer) { clearInterval(obj.pongtimer); delete obj.pongtimer; }
|
||||||
|
|
||||||
// Perform aggressive cleanup
|
// Perform aggressive cleanup
|
||||||
if (obj.nonce) { delete obj.nonce; }
|
if (obj.nonce) { delete obj.nonce; }
|
||||||
if (obj.nodeid) { delete obj.nodeid; }
|
if (obj.nodeid) { delete obj.nodeid; }
|
||||||
@ -531,11 +535,19 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
|||||||
return mesh;
|
return mesh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Send a PING/PONG message
|
||||||
|
function sendPing() { obj.send('{"action":"ping"}'); }
|
||||||
|
function sendPong() { obj.send('{"action":"pong"}'); }
|
||||||
|
|
||||||
// Once we get all the information about an agent, run this to hook everything up to the server
|
// Once we get all the information about an agent, run this to hook everything up to the server
|
||||||
function completeAgentConnection() {
|
function completeAgentConnection() {
|
||||||
if ((obj.authenticated != 1) || (obj.meshid == null) || obj.pendingCompleteAgentConnection || (obj.agentInfo == null)) { return; }
|
if ((obj.authenticated != 1) || (obj.meshid == null) || obj.pendingCompleteAgentConnection || (obj.agentInfo == null)) { return; }
|
||||||
obj.pendingCompleteAgentConnection = true;
|
obj.pendingCompleteAgentConnection = true;
|
||||||
|
|
||||||
|
// Setup the agent PING/PONG timers
|
||||||
|
if ((typeof args.agentping == 'number') && (obj.pingtimer == null)) { obj.pingtimer = setInterval(sendPing, args.agentping * 1000); }
|
||||||
|
else if ((typeof args.agentpong == 'number') && (obj.pongtimer == null)) { obj.pongtimer = setInterval(sendPong, args.agentpong * 1000); }
|
||||||
|
|
||||||
// If this is a recovery agent
|
// If this is a recovery agent
|
||||||
if (obj.agentInfo.capabilities & 0x40) {
|
if (obj.agentInfo.capabilities & 0x40) {
|
||||||
// Inform mesh agent that it's authenticated.
|
// Inform mesh agent that it's authenticated.
|
||||||
@ -1144,6 +1156,8 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
|||||||
// Nothing is done right now.
|
// Nothing is done right now.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case 'ping': { sendPong(); break; }
|
||||||
|
case 'pong': { break; }
|
||||||
case 'getScript':
|
case 'getScript':
|
||||||
{
|
{
|
||||||
// Used by the agent to get configuration scripts.
|
// Used by the agent to get configuration scripts.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "meshcentral",
|
"name": "meshcentral",
|
||||||
"version": "0.3.5-h",
|
"version": "0.3.5-i",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"Remote Management",
|
"Remote Management",
|
||||||
"Intel AMT",
|
"Intel AMT",
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
"_WebRTC": false,
|
"_WebRTC": false,
|
||||||
"_ClickOnce": false,
|
"_ClickOnce": false,
|
||||||
"_SelfUpdate": true,
|
"_SelfUpdate": true,
|
||||||
|
"_AgentPing": 60,
|
||||||
|
"_AgentPong": 60,
|
||||||
"_AllowHighQualityDesktop": true,
|
"_AllowHighQualityDesktop": true,
|
||||||
"_UserAllowedIP": "127.0.0.1,192.168.1.0/24",
|
"_UserAllowedIP": "127.0.0.1,192.168.1.0/24",
|
||||||
"_UserBlockedIP": "127.0.0.1,::1,192.168.0.100",
|
"_UserBlockedIP": "127.0.0.1,::1,192.168.0.100",
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user