mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
Improved 3FA LoginKey feature
This commit is contained in:
parent
d483872aa6
commit
c40ba5d1f5
6 changed files with 1344 additions and 1299 deletions
12
webserver.js
12
webserver.js
|
@ -3116,6 +3116,8 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
|
|||
obj.parent.exeHandler.streamExeWithMeshPolicy({ platform: 'win32', sourceFileName: obj.parent.meshAgentBinaries[req.query.id].path, destinationStream: res, msh: meshsettings, peinfo: obj.parent.meshAgentBinaries[req.query.id].pe });
|
||||
}
|
||||
} else if (req.query.script != null) {
|
||||
if ((domain.loginkey != null) && (domain.loginkey.indexOf(req.query.key) == -1)) { res.sendStatus(404); return; } // Check 3FA URL key
|
||||
|
||||
// Send a specific mesh install script back
|
||||
var scriptInfo = obj.parent.meshAgentInstallScripts[req.query.script];
|
||||
if (scriptInfo == null) { res.sendStatus(404); return; }
|
||||
|
@ -3135,6 +3137,8 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
|
|||
for (var i in cmdoptions) { data = data.split('{{{' + i + '}}}').join(cmdoptions[i]); }
|
||||
res.send(data);
|
||||
} else if (req.query.meshcmd != null) {
|
||||
if ((domain.loginkey != null) && (domain.loginkey.indexOf(req.query.key) == -1)) { res.sendStatus(404); return; } // Check 3FA URL key
|
||||
|
||||
// Send meshcmd for a specific platform back
|
||||
var agentid = parseInt(req.query.meshcmd);
|
||||
// If the agentid is 3 or 4, check if we have a signed MeshCmd.exe
|
||||
|
@ -3161,6 +3165,8 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
|
|||
obj.parent.exeHandler.streamExeWithJavaScript({ platform: argentInfo.platform, sourceFileName: argentInfo.path, destinationStream: res, js: Buffer.from(obj.parent.defaultMeshCmd, 'utf8'), peinfo: argentInfo.pe });
|
||||
}
|
||||
} else if (req.query.meshaction != null) {
|
||||
if ((domain.loginkey != null) && (domain.loginkey.indexOf(req.query.key) == -1)) { res.sendStatus(404); return; } // Check 3FA URL key
|
||||
|
||||
const domain = checkUserIpAddress(req, res);
|
||||
if (domain == null) { res.sendStatus(404); return; }
|
||||
var user = obj.users[req.session.userid];
|
||||
|
@ -3213,15 +3219,17 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
|
|||
res.sendStatus(401);
|
||||
}
|
||||
} else {
|
||||
if ((domain.loginkey != null) && (domain.loginkey.indexOf(req.query.key) == -1)) { res.sendStatus(404); return; } // Check 3FA URL key
|
||||
// Send a list of available mesh agents
|
||||
var response = '<html><head><title>Mesh Agents</title><style>table,th,td { border:1px solid black;border-collapse:collapse;padding:3px; }</style></head><body><table>';
|
||||
response += '<tr style="background-color:lightgray"><th>ID</th><th>Description</th><th>Link</th><th>Size</th><th>SHA384</th><th>MeshCmd</th></tr>';
|
||||
for (var agentid in obj.parent.meshAgentBinaries) {
|
||||
var agentinfo = obj.parent.meshAgentBinaries[agentid];
|
||||
var originalUrl = req.originalUrl.split('?')[0];
|
||||
response += '<tr><td>' + agentinfo.id + '</td><td>' + agentinfo.desc + '</td>';
|
||||
response += '<td><a download href="' + req.originalUrl + '?id=' + agentinfo.id + '">' + agentinfo.rname + '</a></td>';
|
||||
response += '<td><a download href="' + originalUrl + '?id=' + agentinfo.id + (req.query.key ? ('&key=' + req.query.key) : '') + '">' + agentinfo.rname + '</a></td>';
|
||||
response += '<td>' + agentinfo.size + '</td><td>' + agentinfo.hashhex + '</td>';
|
||||
response += '<td><a download href="' + req.originalUrl + '?meshcmd=' + agentinfo.id + '">' + agentinfo.rname.replace('agent', 'cmd') + '</a></td></tr>';
|
||||
response += '<td><a download href="' + originalUrl + '?meshcmd=' + agentinfo.id + (req.query.key ? ('&key=' + req.query.key) : '') + '">' + agentinfo.rname.replace('agent', 'cmd') + '</a></td></tr>';
|
||||
}
|
||||
response += '</table></body></html>';
|
||||
res.send(response);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue