mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-23 14:01:43 +03:00
Fixed agent tunnel unable to connect.
This commit is contained in:
parent
8ab74cff36
commit
6668f88ed3
Binary file not shown.
Binary file not shown.
@ -688,6 +688,7 @@ function createMeshCore(agent) {
|
||||
// Create a new tunnel object
|
||||
var xurl = getServerTargetUrlEx(data.value);
|
||||
if (xurl != null) {
|
||||
xurl = xurl.split('$').join('%24').split('@').join('%40'); // Escape the $ and @ characters
|
||||
var woptions = http.parseUri(xurl);
|
||||
woptions.rejectUnauthorized = 0;
|
||||
//sendConsoleText(JSON.stringify(woptions));
|
||||
@ -2892,7 +2893,7 @@ function createMeshCore(agent) {
|
||||
} else {
|
||||
var httprequest = null;
|
||||
try {
|
||||
var options = http.parseUri(args['_'][0]);
|
||||
var options = http.parseUri(args['_'][0].split('$').join('%24').split('@').join('%40')); // Escape the $ and @ characters in the URL
|
||||
options.rejectUnauthorized = 0;
|
||||
httprequest = http.request(options);
|
||||
} catch (e) { response = 'Invalid HTTP websocket request'; }
|
||||
|
@ -93,7 +93,7 @@ function CreateDesktopMultiplexor(parent, domain, nodeid, func) {
|
||||
|
||||
// Add an agent or viewer
|
||||
obj.addPeer = function (peer) {
|
||||
if (obj.viewers == null) return;
|
||||
if (obj.viewers == null) { parent.parent.debug('relay', 'DesktopRelay: Error, addingPeer on disposed session'); return; }
|
||||
if (peer.req.query.browser) {
|
||||
//console.log('addPeer-viewer', obj.nodeid);
|
||||
|
||||
@ -138,7 +138,7 @@ function CreateDesktopMultiplexor(parent, domain, nodeid, func) {
|
||||
obj.sendSessionMetadata();
|
||||
} else {
|
||||
//console.log('addPeer-agent', obj.nodeid);
|
||||
if (obj.agent != null) return false;
|
||||
if (obj.agent != null) { parent.parent.debug('relay', 'DesktopRelay: Error, duplicate agent connection'); return false; }
|
||||
|
||||
// Setup the agent
|
||||
obj.agent = peer;
|
||||
|
@ -4270,6 +4270,9 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
|
||||
parent.debug('webrequest', '(' + req.clientIp + ') ' + req.url);
|
||||
res.removeHeader('X-Powered-By');
|
||||
|
||||
// Skip the rest is this is an agent connection
|
||||
if ((req.url.indexOf('/meshrelay.ashx/.websocket') >= 0) || (req.url.indexOf('/agent.ashx/.websocket') >= 0)) { next(); return; }
|
||||
|
||||
// If this domain has configured headers, use them.
|
||||
// Example headers: { 'Strict-Transport-Security': 'max-age=360000;includeSubDomains' };
|
||||
// { 'Referrer-Policy': 'no-referrer', 'x-frame-options': 'SAMEORIGIN', 'X-XSS-Protection': '1; mode=block', 'X-Content-Type-Options': 'nosniff', 'Content-Security-Policy': "default-src http: ws: data: 'self';script-src http: 'unsafe-inline';style-src http: 'unsafe-inline'" };
|
||||
@ -4293,7 +4296,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
|
||||
if ((req.session.ip != null) && (req.clientIp != null) && (req.session.ip != req.clientIp)) { req.session = {}; }
|
||||
|
||||
// Extend the session time by forcing a change to the session every minute.
|
||||
req.session.nowInMinutes = Math.floor(Date.now() / 60e3);
|
||||
if (req.session.userid != null) { req.session.nowInMinutes = Math.floor(Date.now() / 60e3); } else { delete req.session.nowInMinutes; }
|
||||
|
||||
// Detect if this is a file sharing domain, if so, just share files.
|
||||
if ((domain != null) && (domain.share != null)) {
|
||||
|
Loading…
Reference in New Issue
Block a user