Fixed support for ignoreagenthashcheck

Ylian Saint-Hilaire committed Nov 10, 2020 at 12:51 UTC 47e1f70622e7124b37ced129e3cb6b24943942c2
3 files changed +11 -4
meshcentral-config-schema.json
+1
@@ -41,6 +41,7 @@
41 "agentPortTls": { "type": "boolean", "default": true, "description": "Indicates if the agent-only port must perform TLS, this should be set to false if TLS is performed in front of this server." },
42 "agentCoreDump": { "type": "boolean", "default": false, "description": "Automatically activates and transfers any agent crash dump files to the server in meshcentral-data/coredumps." },
43 "agentCoreDumpUsers": { "type": "array", "description": "List of non-administrator users that have access to mesh agent crash dumps." },
44 + "ignoreAgentHashCheck": { "type": "boolean", "default": false, "description": "When true, the agent no longer checked the TLS certificate of the server. This should be used for debugging only." },
45 "exactPorts": { "type": "boolean", "default": false },
46 "allowLoginToken": { "type": "boolean", "default": false },
47 "allowFraming": { "type": "boolean", "default": false, "description": "When enabled, the MeshCentral web site can be embedded within another website's iframe." },
meshuser.js
+5 -2
@@ -1329,8 +1329,11 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
1329 else if ((url.query.p == '4') || (url.query.p == '5')) { requiredNonRights = MESHRIGHT_NOFILES; }
1330
1331 // Add server TLS cert hash
1332 - const tlsCertHash = parent.webCertificateHashs[domain.id];
1333 - if (tlsCertHash != null) { command.servertlshash = Buffer.from(tlsCertHash, 'binary').toString('hex'); }
1332 + var tlsCertHash = null;
1333 + if (parent.parent.args.ignoreagenthashcheck !== true) {
1334 + tlsCertHash = parent.webCertificateHashs[domain.id];
1335 + if (tlsCertHash != null) { command.servertlshash = Buffer.from(tlsCertHash, 'binary').toString('hex'); }
1336 + }
1337
1338 // Add user consent messages
1339 command.soptions = {};
webserver.js
+5 -2
@@ -3217,8 +3217,11 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
3217 }
3218
3219 // Instruct one of more agents to download a URL to a given local drive location.
3220 - var tlsCertHash = obj.webCertificateHashs[cmd.domain.id];
3221 - if (tlsCertHash != null) { tlsCertHash = Buffer.from(tlsCertHash, 'binary').toString('hex'); }
3220 + var tlsCertHash = null;
3221 + if (parent.args.ignoreagenthashcheck !== true) {
3222 + tlsCertHash = obj.webCertificateHashs[cmd.domain.id];
3223 + if (tlsCertHash != null) { tlsCertHash = Buffer.from(tlsCertHash, 'binary').toString('hex'); }
3224 + }
3225 for (var i in cmd.nodeids) {
3226 obj.GetNodeWithRights(cmd.domain, cmd.user, cmd.nodeids[i], function (node, rights, visible) {
3227 if ((node == null) || ((rights & 8) == 0) || (visible == false)) return; // We don't have remote control rights to this device