mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-24 22:25:52 -05:00
Agent core download and reverse proxy improvements.
This commit is contained in:
parent
78ba693f43
commit
1e27592ce4
@ -2274,7 +2274,7 @@ function createMeshCore(agent) {
|
||||
if ((process.cwd() != '//') && fs.existsSync(process.cwd() + 'core')) { cmd.path = process.cwd() + 'core'; }
|
||||
}
|
||||
}
|
||||
MeshServerLogEx(49, [cmd.path], 'Download: \"' + cmd.path + '\"', this.httprequest);
|
||||
MeshServerLogEx((cmd.ask == 'coredump')?104:49, [cmd.path], 'Download: \"' + cmd.path + '\"', this.httprequest);
|
||||
if ((cmd.path == null) || (this.filedownload != null)) { this.write({ action: 'download', sub: 'cancel', id: this.filedownload.id }); delete this.filedownload; }
|
||||
this.filedownload = { id: cmd.id, path: cmd.path, ptr: 0 }
|
||||
try { this.filedownload.f = fs.openSync(this.filedownload.path, 'rbN'); } catch (e) { this.write({ action: 'download', sub: 'cancel', id: this.filedownload.id }); delete this.filedownload; }
|
||||
|
@ -31,6 +31,10 @@
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
<title>{{{title}}}</title>
|
||||
<style>
|
||||
:focus {
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #036;
|
||||
text-decoration: underline;
|
||||
|
@ -11086,6 +11086,7 @@
|
||||
101: "Added device share {0} from {1} to {2}",
|
||||
102: "Removed device share {0}",
|
||||
103: "Batch upload of {0} file(s) to folder {1}",
|
||||
104: "Automated download of agent core dump file: \"{0}\""
|
||||
};
|
||||
|
||||
// Highlights the device being hovered
|
||||
|
@ -14,6 +14,10 @@
|
||||
<script type="text/javascript" src="mstsc/client.js"></script>
|
||||
<script type="text/javascript" src="mstsc/canvas.js"></script>
|
||||
<style>
|
||||
:focus {
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family:sans-serif;
|
||||
margin: 0;
|
||||
|
@ -10,6 +10,10 @@
|
||||
<link rel="apple-touch-icon" href="/favicon-303x303.png" />
|
||||
<title>{{{title}}} - Terms of use</title>
|
||||
<style type="text/css">
|
||||
:focus {
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #036;
|
||||
text-decoration: underline;
|
||||
|
@ -3928,7 +3928,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
|
||||
if (obj.fs.existsSync(coreDumpPath) == false) { try { obj.fs.mkdirSync(coreDumpPath); } catch (ex) { } }
|
||||
ws.xfilepath = obj.path.join(parent.datapath, '..', 'meshcentral-coredumps', ws.xarg);
|
||||
ws.xid = 'coredump';
|
||||
ws.send(JSON.stringify({ action: 'download', sub: 'start', ask: 'coredump', id: 'coredump' })); // Ask for a directory (test)
|
||||
ws.send(JSON.stringify({ action: 'download', sub: 'start', ask: 'coredump', id: 'coredump' })); // Ask for a core dump file
|
||||
}
|
||||
|
||||
// When data is received from the web socket, echo it back
|
||||
@ -4853,7 +4853,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
|
||||
obj.app.use(function (req, res, next) {
|
||||
// Set the real IP address of the request
|
||||
// If a trusted reverse-proxy is sending us the remote IP address, use it.
|
||||
var ipex = '0.0.0.0', serverHost = req.headers.host;
|
||||
var ipex = '0.0.0.0', xforwardedhost = req.headers.host;
|
||||
if (typeof req.connection.remoteAddress == 'string') { ipex = (req.connection.remoteAddress.startsWith('::ffff:')) ? req.connection.remoteAddress.substring(7) : req.connection.remoteAddress; }
|
||||
if (
|
||||
(obj.args.trustedproxy === true) ||
|
||||
@ -4872,7 +4872,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
|
||||
}
|
||||
|
||||
// Get server host
|
||||
if (req.headers['x-forwarded-host']) { serverHost = req.headers['x-forwarded-host']; }
|
||||
if (req.headers['x-forwarded-host']) { xforwardedhost = req.headers['x-forwarded-host']; }
|
||||
} else {
|
||||
req.clientIp = ipex;
|
||||
}
|
||||
@ -4892,7 +4892,8 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
|
||||
} else {
|
||||
// Use default security headers
|
||||
const geourl = (domain.geolocation ? ' *.openstreetmap.org' : '');
|
||||
const selfurl = ' wss://' + serverHost;
|
||||
var selfurl = ' wss://' + req.headers.host;
|
||||
if ((xforwardedhost != null) && (xforwardedhost != req.headers.host)) { selfurl += ' wss://' + xforwardedhost; }
|
||||
const headers = {
|
||||
'Referrer-Policy': 'no-referrer',
|
||||
'X-XSS-Protection': '1; mode=block',
|
||||
|
Loading…
Reference in New Issue
Block a user