diff --git a/meshcentral-config-schema.json b/meshcentral-config-schema.json index ef25de01..3e9a4273 100644 --- a/meshcentral-config-schema.json +++ b/meshcentral-config-schema.json @@ -170,7 +170,23 @@ "welcomePicture": { "type": "string", "description": "Name of the PNG or JPEG file that will be shown on the login screen. Put this file in the meshcentral-data folder and place the file name here." }, "hide": { "type": "integer" }, "footer": { "type": "string" }, - "certUrl": { "type": "string", "format": "uri", "description": "https url when to get the TLS certificate that MeshAgent's will see when connecting to this server. This setting is used when a reverse proxy like NGINX is used in front of MeshCentral." }, + "certUrl": { + "type": "string", + "format": "uri", + "description": "https url when to get the TLS certificate that MeshAgent's will see when connecting to this server. This setting is used when a reverse proxy like NGINX is used in front of MeshCentral." + }, + "myServer": { + "type": "object", + "additionalProperties": false, + "properties": { + "Backup": { "type": "boolean", "default": true, "description": "Allows administrators to backup the server from the My Server tab." }, + "Restore": { "type": "boolean", "default": true, "description": "Allows administrators to restore the server from the My Server tab." }, + "Upgrade": { "type": "boolean", "default": true, "description": "Allows administrators to update the server from the My Server tab." }, + "ShowLog": { "type": "boolean", "default": true, "description": "Allows administrators to see the server crash log the server from the My Server tab." }, + "Console": { "type": "boolean", "default": true, "description": "Allows administrators to access the server console from the My Server tab." }, + "Trace": { "type": "boolean", "default": true, "description": "Allows administrators to access the server trace tab from from the My Server tab." } + } + }, "passwordRequirements": { "type": "object", "properties": { diff --git a/meshuser.js b/meshuser.js index df37fef6..9872a887 100644 --- a/meshuser.js +++ b/meshuser.js @@ -444,8 +444,11 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use try { ws.send(JSON.stringify({ action: 'userinfo', userinfo: parent.CloneSafeUser(parent.users[user._id]) })); } catch (ex) { } if (user.siteadmin === SITERIGHT_ADMIN) { - // Send server tracing information - try { ws.send(JSON.stringify({ action: 'traceinfo', traceSources: parent.parent.debugRemoteSources })); } catch (ex) { } + // Check if tracing is allowed for this domain + if ((domain.myserver == null) || (domain.myserver.trace === true)) { + // Send server tracing information + try { ws.send(JSON.stringify({ action: 'traceinfo', traceSources: parent.parent.debugRemoteSources })); } catch (ex) { } + } // Send any server warnings if any var serverWarnings = parent.parent.getServerWarnings(); @@ -807,6 +810,9 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use // This is a server console message, only process this if full administrator if (user.siteadmin != SITERIGHT_ADMIN) break; + // Only accept is the console is allowed for this domain + if ((domain.myserver != null) && (domain.myserver.console !== true)) break; + var r = ''; var cmdargs = splitArgs(command.value); if (cmdargs.length == 0) break; @@ -2600,6 +2606,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use { // Check the server version if ((user.siteadmin & 16) == 0) break; + if ((domain.myserver != null) && (domain.myserver.upgrade !== true)) break; //parent.parent.getLatestServerVersion(function (currentVersion, latestVersion) { try { ws.send(JSON.stringify({ action: 'serverversion', current: currentVersion, latest: latestVersion })); } catch (ex) { } }); parent.parent.getServerTags(function (tags, err) { try { ws.send(JSON.stringify({ action: 'serverversion', tags: tags })); } catch (ex) { } }); break; @@ -2608,6 +2615,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use { // Perform server update if ((user.siteadmin & 16) == 0) break; + if ((domain.myserver != null) && (domain.myserver.upgrade !== true)) break; if ((command.version != null) && (typeof command.version != 'string')) break; parent.parent.performServerUpdate(command.version); break; @@ -2616,6 +2624,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use { // Load the server error log if ((user.siteadmin & 16) == 0) break; + if ((domain.myserver != null) && (domain.myserver.errorlog !== true)) break; fs.readFile(parent.parent.getConfigFilePath('mesherrors.txt'), 'utf8', function (err, data) { try { ws.send(JSON.stringify({ action: 'servererrors', data: data })); } catch (ex) { } }); break; } @@ -4512,6 +4521,9 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use break; } case 'traceinfo': { + // Only accept is the tracing is allowed for this domain + if ((domain.myserver != null) && (domain.myserver.trace !== true)) break; + if ((user.siteadmin === SITERIGHT_ADMIN) && (typeof command.traceSources == 'object')) { parent.parent.debugRemoteSources = command.traceSources; parent.parent.DispatchEvent(['*'], obj, { action: 'traceinfo', userid: user._id, username: user.name, traceSources: command.traceSources, nolog: 1, domain: domain.id }); diff --git a/sample-config-advanced.json b/sample-config-advanced.json index 201be6f3..210f3616 100644 --- a/sample-config-advanced.json +++ b/sample-config-advanced.json @@ -140,6 +140,14 @@ "_hide": 4, "_footer": "Twitter", "_certUrl": "https://192.168.2.106:443/", + "myServer": { + "Backup": false, + "Restore": false, + "Upgrade": false, + "ErrorLog": false, + "Console": false, + "Trace": false + }, "_passwordRequirements": { "min": 8, "max": 128, diff --git a/translate/translate.json b/translate/translate.json index d6ef20ae..215edcc6 100644 --- a/translate/translate.json +++ b/translate/translate.json @@ -31786,7 +31786,7 @@ "zh-chs": "服务器统计", "zh-cht": "伺服器統計", "xloc": [ - "default.handlebars->container->column_l->p6->p6info->6" + "default.handlebars->container->column_l->p6->p6info->5" ] }, { diff --git a/views/default.handlebars b/views/default.handlebars index 51b3e90e..58f1fe69 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -474,8 +474,9 @@
Check server version
Show server error log
+
-
Server Statistics

+ Server Statistics