diff --git a/meshcentral-config-schema.json b/meshcentral-config-schema.json index f36a46f2..cb9e6397 100644 --- a/meshcentral-config-schema.json +++ b/meshcentral-config-schema.json @@ -292,6 +292,7 @@ "userQuota": { "type": "integer" }, "meshQuota": { "type": "integer" }, "loginKey": { "type": [ "string", "array" ], "items": { "type": "string" }, "default": null, "description": "Requires that users add the value ?key=xxx in the URL in order to see the web site." }, + "ipkvm": { "type": "boolean", "default": false, "description": "Set to true to enable IP KVM device support in this domain." }, "minify": { "type": "boolean", "default": false, "description": "When enabled, the server will send reduced sided web pages." }, "newAccounts": { "type": "boolean", "default": false, "description": "When set to true, allow new user accounts to be created from the login page." }, "newAccountsUserGroups": { "type": "array", "uniqueItems": true, "items": { "type": "string" } }, diff --git a/meshuser.js b/meshuser.js index d94b8349..79e1201d 100644 --- a/meshuser.js +++ b/meshuser.js @@ -2457,10 +2457,17 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use else if ((domain.mailserver != null) && (domain.auth != 'sspi') && (domain.auth != 'ldap') && (user.emailVerified !== true) && (user.siteadmin != SITERIGHT_ADMIN)) { err = 'Email verification required'; } // User must verify it's email first. // Create mesh - else if (common.validateString(command.meshname, 1, 128) == false) { err = 'Invalid group name'; } // Meshname is between 1 and 64 characters + else if (common.validateString(command.meshname, 1, 128) == false) { err = 'Invalid group name'; } // Meshname is between 1 and 128 characters else if ((command.desc != null) && (common.validateString(command.desc, 0, 1024) == false)) { err = 'Invalid group description'; } // Mesh description is between 0 and 1024 characters - else if ((command.meshtype < 1) && (command.meshtype > 3)) { err = 'Invalid group type'; } // Device group types are 1 = AMT, 2 = Agent, 3 = Local + else if ((command.meshtype < 1) || (command.meshtype > 4)) { err = 'Invalid group type'; } // Device group types are 1 = AMT, 2 = Agent, 3 = Local else if ((parent.args.wanonly == true) && (command.meshtype == 3)) { err = 'Invalid group type'; } // Local device group type is not allowed in WAN mode + else if ((domain.ipkvm == null) && (command.meshtype == 4)) { err = 'Invalid group type'; } // IP KVM device group type is not allowed unless enabled + if ((err == null) && (command.meshtype == 4)) { + if (command.kvmmodel !== 1) { err = 'Invalid KVM model'; } + else if (common.validateString(command.kvmhost, 1, 128) == false) { err = 'Invalid KVM hostname'; } + else if (common.validateString(command.kvmuser, 1, 128) == false) { err = 'Invalid KVM username'; } + else if (common.validateString(command.kvmpass, 1, 128) == false) { err = 'Invalid KVM password'; } + } } catch (ex) { err = 'Validation exception: ' + ex; } // Handle any errors @@ -2483,6 +2490,9 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use if (typeof command.flags == 'number') { mesh.flags = command.flags; } if (typeof command.consent == 'number') { mesh.consent = command.consent; } + // Add KVM information if needed + if (command.meshtype == 4) { mesh.kvm = { model: command.kvmmodel, host: command.kvmhost, user: command.kvmuser, pass: command.kvmpass }; } + // Save the new device group db.Set(mesh); parent.meshes[meshid] = mesh; diff --git a/views/default-mobile.handlebars b/views/default-mobile.handlebars index 515ef72f..33b5dbeb 100644 --- a/views/default-mobile.handlebars +++ b/views/default-mobile.handlebars @@ -2995,7 +2995,7 @@ //r += getMeshActions(mesh, meshrights); r += '' + EscapeHtml(mesh.name) + ''; if (mesh.mtype == 1) { r += '