Rolled back agent tunnel TLS check.

Ylian Saint-Hilaire committed Nov 10, 2020 at 13:24 UTC 6e67fc14c4345b416b66f574b9fc1648512ceded
3 files changed +9 -1
agents/meshcore.js
+5 -1
@@ -780,7 +780,11 @@ function createMeshCore(agent) {
780
781 // Perform manual server TLS certificate checking based on the certificate hash given by the server.
782 woptions.rejectUnauthorized = 0;
783 - woptions.checkServerIdentity = function checkServerIdentity(certs) { if ((checkServerIdentity.servertlshash != null) && (checkServerIdentity.servertlshash != certs[0].fingerprint.split(':').join('').toLowerCase())) { throw new Error('BadCert') } }
783 + woptions.checkServerIdentity = function checkServerIdentity(certs) {
784 + //sendConsoleText('ca: ' + certs[0].fingerprint.split(':').join('').toLowerCase());
785 + //sendConsoleText('cs: ' + checkServerIdentity.servertlshash);
786 + if ((checkServerIdentity.servertlshash != null) && (checkServerIdentity.servertlshash != certs[0].fingerprint.split(':').join('').toLowerCase())) { throw new Error('BadCert') }
787 + }
788 woptions.checkServerIdentity.servertlshash = data.servertlshash;
789
790 //sendConsoleText(JSON.stringify(woptions));
meshuser.js
+2
@@ -1330,10 +1330,12 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
1330
1331 // Add server TLS cert hash
1332 var tlsCertHash = null;
1333 + /*
1334 if (parent.parent.args.ignoreagenthashcheck !== true) {
1335 tlsCertHash = parent.webCertificateHashs[domain.id];
1336 if (tlsCertHash != null) { command.servertlshash = Buffer.from(tlsCertHash, 'binary').toString('hex'); }
1337 }
1338 + */
1339
1340 // Add user consent messages
1341 command.soptions = {};
webserver.js
+2
@@ -3218,10 +3218,12 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
3218
3219 // Instruct one of more agents to download a URL to a given local drive location.
3220 var tlsCertHash = null;
3221 + /*
3222 if (parent.args.ignoreagenthashcheck !== true) {
3223 tlsCertHash = obj.webCertificateHashs[cmd.domain.id];
3224 if (tlsCertHash != null) { tlsCertHash = Buffer.from(tlsCertHash, 'binary').toString('hex'); }
3225 }
3226 + */
3227 for (var i in cmd.nodeids) {
3228 obj.GetNodeWithRights(cmd.domain, cmd.user, cmd.nodeids[i], function (node, rights, visible) {
3229 if ((node == null) || ((rights & 8) == 0) || (visible == false)) return; // We don't have remote control rights to this device