Yubikey fix & Server peering fixes.

Ylian Saint-Hilaire committed Aug 15, 2019 at 11:47 UTC 7eb96283b7b8e7f6cffdadf246a375d8b0129edc
3 files changed +4 -4
multiserver.js
+1 -1
@@ -584,7 +584,7 @@ module.exports.CreateMultiServer = function (parent, args) {
584 if (path.substring(path.length - 11) == '/.websocket') { path = path.substring(0, path.length - 11); }
585 var queryStr = '';
586 for (var i in req.query) { if (i.toLowerCase() != 'auth') { queryStr += ((queryStr == '') ? '?' : '&') + i + '=' + req.query[i]; } }
587 - if (user != null) { queryStr += ((queryStr == '') ? '?' : '&') + 'auth=' + obj.parent.encodeCookie({ userid: user._id, domainid: user.domain }, cookieKey); }
587 + if (user != null) { queryStr += ((queryStr == '') ? '?' : '&') + 'auth=' + obj.parent.encodeCookie({ userid: user._id, domainid: user.domain, ps: 1 }, cookieKey); }
588 var url = obj.peerConfig.servers[serverid].url + path + queryStr;
589
590 // Setup an connect the web socket
package.json
+1 -1
@@ -1,6 +1,6 @@
1 {
2 "name": "meshcentral",
3 - "version": "0.3.9-y",
3 + "version": "0.3.9-z",
4 "keywords": [
5 "Remote Management",
6 "Intel AMT",
webserver.js
+2 -2
@@ -590,7 +590,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
590 var yubikeyotp = require('yubikeyotp');
591 var request = { otp: token, id: domain.yubikey.id, key: domain.yubikey.secret, timestamp: true }
592 if (domain.yubikey.proxy) { request.requestParams = { proxy: domain.yubikey.proxy }; }
593 - yubikeyotp.verifyOTP(request, function (err, results) { func(results.status == 'OK'); });
593 + yubikeyotp.verifyOTP(request, function (err, results) { func((results != null) && (results.status == 'OK')); });
594 return;
595 }
596 }
@@ -1940,7 +1940,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
1940 if (!state || state.connectivity == 0) { Debug(1, 'ERR: No routing possible (1)'); try { ws.close(); } catch (e) { } return; } else { conn = state.connectivity; }
1941
1942 // Check what server needs to handle this connection
1943 - if ((obj.parent.multiServer != null) && (cookie == null)) { // If a cookie is provided, don't allow the connection to jump again to a different server
1943 + if ((obj.parent.multiServer != null) && ((cookie == null) || (cookie.ps != 1))) { // If a cookie is provided and is from a peer server, don't allow the connection to jump again to a different server
1944 var server = obj.parent.GetRoutingServerId(req.query.host, 2); // Check for Intel CIRA connection
1945 if (server != null) {
1946 if (server.serverid != obj.parent.serverId) {