diff --git a/certoperations.js b/certoperations.js index b0c4c57d..699c3abb 100644 --- a/certoperations.js +++ b/certoperations.js @@ -111,7 +111,8 @@ module.exports.CertificateOperations = function () { cert.setSubject(attrs); cert.setIssuer(attrs); // Create a root certificate - cert.setExtensions([{ name: "basicConstraints", cA: true }, { name: "nsCertType", sslCA: true, emailCA: true, objCA: true }, { name: "subjectKeyIdentifier" }]); + //cert.setExtensions([{ name: "basicConstraints", cA: true }, { name: "nsCertType", sslCA: true, emailCA: true, objCA: true }, { name: "subjectKeyIdentifier" }]); + cert.setExtensions([{ name: "basicConstraints", cA: true }, { name: "subjectKeyIdentifier" }]); cert.sign(keys.privateKey, obj.forge.md.sha384.create()); return { cert: cert, key: keys.privateKey }; @@ -135,10 +136,10 @@ module.exports.CertificateOperations = function () { cert.setIssuer(rootcert.cert.subject.attributes); if (extKeyUsage == null) { extKeyUsage = { name: "extKeyUsage", serverAuth: true }; } else { extKeyUsage.name = "extKeyUsage"; } - var subjectAltName = null; - if (extKeyUsage.serverAuth === true) { subjectAltName = { name: "subjectAltName", altNames: [{ type: 6, value: "http://" + commonName + "/" }, { type: 6, value: "http://localhost/" }] }; } - var extensions = [{ name: "basicConstraints", cA: false }, { name: "keyUsage", keyCertSign: true, digitalSignature: true, nonRepudiation: true, keyEncipherment: true, dataEncipherment: true }, extKeyUsage, { name: "nsCertType", client: false, server: true, email: false, objsign: false, sslCA: false, emailCA: false, objCA: false }, { name: "subjectKeyIdentifier" }]; - if (subjectAltName != null) { extensions.push(subjectAltName); } + //var extensions = [{ name: "basicConstraints", cA: false }, { name: "keyUsage", keyCertSign: true, digitalSignature: true, nonRepudiation: true, keyEncipherment: true, dataEncipherment: true }, extKeyUsage, { name: "nsCertType", client: false, server: true, email: false, objsign: false, sslCA: false, emailCA: false, objCA: false }, { name: "subjectKeyIdentifier" }]; + var extensions = [{ name: "basicConstraints", cA: false }, { name: "keyUsage", keyCertSign: false, digitalSignature: true, nonRepudiation: false, keyEncipherment: true, dataEncipherment: (extKeyUsage.serverAuth !== true) }, extKeyUsage, { name: "subjectKeyIdentifier" }]; + if (extKeyUsage.serverAuth === true) { extensions.push({ name: "subjectAltName", altNames: [{ type: 6, value: "http://" + commonName + "/" }, { type: 6, value: "http://localhost/" }] }); } + cert.setExtensions(extensions); cert.sign(rootcert.key, obj.forge.md.sha384.create()); @@ -360,7 +361,7 @@ module.exports.CertificateOperations = function () { var agentCertAndKey, agentCertificate, agentPrivateKey; if (r.agent == null) { console.log("Generating MeshAgent certificate..."); - agentCertAndKey = obj.IssueWebServerCertificate(rootCertAndKey, true, "MeshCentralAgentServer", null, strongCertificate); + agentCertAndKey = obj.IssueWebServerCertificate(rootCertAndKey, true, "MeshCentralAgentServer", country, organization, { }, strongCertificate); agentCertificate = obj.pki.certificateToPem(agentCertAndKey.cert); agentPrivateKey = obj.pki.privateKeyToPem(agentCertAndKey.key); obj.fs.writeFileSync(parent.getConfigFilePath("agentserver-cert-public.crt"), agentCertificate); diff --git a/meshcentral.js b/meshcentral.js index 8b019dc3..8255f8a9 100644 --- a/meshcentral.js +++ b/meshcentral.js @@ -230,7 +230,7 @@ function CreateMeshCentralServer(config, args) { if (obj.config.domains == null) { obj.config.domains = {}; } if (obj.config.domains[''] == null) { obj.config.domains[''] = {}; } if (obj.config.domains[''].dns != null) { console.log("ERROR: Default domain can't have a DNS name."); return; } - var xdomains = {}; for (i in obj.config.domains) { if (!obj.config.domains[i].title) { obj.config.domains[i].title = 'MeshCentral'; } if (!obj.config.domains[i].title2) { obj.config.domains[i].title2 = '2.0 Beta 2'; } xdomains[i.toLowerCase()] = obj.config.domains[i]; } obj.config.domains = xdomains; + var xdomains = {}; for (i in obj.config.domains) { if (obj.config.domains[i].title == null) { obj.config.domains[i].title = 'MeshCentral'; } if (obj.config.domains[i].title2 == null) { obj.config.domains[i].title2 = '2.0 Beta 2'; } xdomains[i.toLowerCase()] = obj.config.domains[i]; } obj.config.domains = xdomains; var bannedDomains = ['public', 'private', 'images', 'scripts', 'styles', 'views']; // List of banned domains for (i in obj.config.domains) { for (var j in bannedDomains) { if (i == bannedDomains[j]) { console.log("ERROR: Domain '" + i + "' is not allowed domain name in ./data/config.json."); return; } } } for (i in obj.config.domains) { diff --git a/mpsserver.js b/mpsserver.js index e8c1f804..6fd012aa 100644 --- a/mpsserver.js +++ b/mpsserver.js @@ -33,6 +33,7 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) { } obj.server.listen(args.mpsport, function () { console.log("MeshCentral Intel(R) AMT server running on " + certificates.AmtMpsName + ":" + args.mpsport + ((args.mpsaliasport != null) ? (", alias port " + args.mpsaliasport) : "") + "."); }).on("error", function (err) { console.error("ERROR: MeshCentral Intel(R) AMT server port " + args.mpsport + " is not available."); if (args.exactports) { process.exit(); } }); + obj.server.on('tlsClientError', function (err, tlssocket) { if (args.mpsdebug) { var remoteAddress = tlssocket.remoteAddress; if (tlssocket.remoteFamily == 'IPv6') { remoteAddress = '[' + remoteAddress + ']'; } console.log('MPS:Invalid TLS connection from ' + remoteAddress + ':' + tlssocket.remotePort + '.'); } }); obj.parent.updateServerState("mps-port", args.mpsport); obj.parent.updateServerState("mps-name", certificates.AmtMpsName); if (args.mpsaliasport != null) { obj.parent.updateServerState("mps-alias-port", args.mpsaliasport); } @@ -119,7 +120,7 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) { if (socket.tag.first == true) { if (socket.tag.accumulator.length < 3) return; //if (!socket.tag.clientCert.subject) { console.log("MPS Connection, no client cert: " + socket.remoteAddress); socket.write('HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\nConnection: close\r\n\r\nMeshCentral2 MPS server.\r\nNo client certificate given.'); socket.end(); return; } - if (socket.tag.accumulator.substring(0, 3) == "GET") { console.log("MPS Connection, HTTP GET detected: " + socket.remoteAddress); socket.write("HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nConnection: close\r\n\r\nMeshCentral2 MPS server.
Intel® AMT computers should connect here."); socket.end(); return; } + if (socket.tag.accumulator.substring(0, 3) == "GET") { if (args.mpsdebug) { console.log("MPS Connection, HTTP GET detected: " + socket.remoteAddress); } socket.write("HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nConnection: close\r\n\r\nMeshCentral2 MPS server.
Intel® AMT computers should connect here."); socket.end(); return; } socket.tag.first = false; // Setup this node with certificate authentication diff --git a/package.json b/package.json index fcb82ba9..ba3f00a3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meshcentral", - "version": "0.2.5-b", + "version": "0.2.5-d", "keywords": [ "Remote Management", "Intel AMT", diff --git a/views/default-min.handlebars b/views/default-min.handlebars index 2a3ceae0..a3b61a9f 100644 --- a/views/default-min.handlebars +++ b/views/default-min.handlebars @@ -1 +1 @@ - MeshCentral
{{{title}}}
{{{title2}}}

{{{logoutControl}}}

 

\ No newline at end of file + MeshCentral
{{{title}}}
{{{title2}}}

{{{logoutControl}}}

 

\ No newline at end of file diff --git a/views/default-mobile-min.handlebars b/views/default-mobile-min.handlebars index 584e76ac..a9145768 100644 --- a/views/default-mobile-min.handlebars +++ b/views/default-mobile-min.handlebars @@ -1 +1 @@ - MeshCentral - Login
{{{title}}}
{{{title2}}}
\ No newline at end of file + MeshCentral
{{{title}}}
{{{title2}}}
\ No newline at end of file diff --git a/views/default-mobile.handlebars b/views/default-mobile.handlebars index 78ded960..fca4fe71 100644 --- a/views/default-mobile.handlebars +++ b/views/default-mobile.handlebars @@ -18,7 +18,7 @@ - MeshCentral - Login + MeshCentral MeshCentral - Login
{{{title}}}
{{{title2}}}

Welcome

Connect to your home or office devices from anywhere in the world using MeshCentral, the real time, open source remote monitoring and management web site. You will need to download and install a management agent on your computers. Once installed, computers will show up in the "My Devices" section of this web site and you will be able to monitor them and take control of them.


\ No newline at end of file + MeshCentral - Login
{{{title}}}
{{{title2}}}

Welcome

Connect to your home or office devices from anywhere in the world using MeshCentral, the real time, open source remote monitoring and management web site. You will need to download and install a management agent on your computers. Once installed, computers will show up in the "My Devices" section of this web site and you will be able to monitor them and take control of them.


\ No newline at end of file diff --git a/views/login-mobile-min.handlebars b/views/login-mobile-min.handlebars index 5217cf66..976100b8 100644 --- a/views/login-mobile-min.handlebars +++ b/views/login-mobile-min.handlebars @@ -1 +1 @@ - MeshCentral - Login
{{{title}}}
{{{title2}}}
\ No newline at end of file + MeshCentral - Login
{{{title}}}
{{{title2}}}
\ No newline at end of file diff --git a/views/login-mobile.handlebars b/views/login-mobile.handlebars index 4293fb7e..63c82b29 100644 --- a/views/login-mobile.handlebars +++ b/views/login-mobile.handlebars @@ -28,7 +28,7 @@
-
+
{{{title}}}
diff --git a/views/login.handlebars b/views/login.handlebars index 9750d48e..1b74cf1f 100644 --- a/views/login.handlebars +++ b/views/login.handlebars @@ -92,7 +92,7 @@
-
+
{{{title}}}
diff --git a/views/messenger-min.handlebars b/views/messenger-min.handlebars index b6c9e7a9..a7a83aed 100644 --- a/views/messenger-min.handlebars +++ b/views/messenger-min.handlebars @@ -356,14 +356,13 @@ function trademarks(x) { return x.replace(/\(R\)/g, '®').replace(/\(TM\)/g, // 0 = nomedia, 1 = miconly, 2 = mic&cam function getUserMediaSupport(func) { try { - navigator.mediaDevices.enumerateDevices() - .then(devices => { + navigator.mediaDevices.enumerateDevices().then(function (devices) { try { var mic = 0, cam = 0; - devices.forEach(device => { + devices.forEach(function (device) { if (device.kind === 'audioinput') { mic = 1; } if (device.kind === 'videoinput') { cam = 1; } - }) + }); if (mic == 0) { func(0); } func(mic + cam); } catch (ex) { } diff --git a/views/terms.handlebars b/views/terms.handlebars index 9e4b83a9..2330df9b 100644 --- a/views/terms.handlebars +++ b/views/terms.handlebars @@ -101,7 +101,7 @@
-
+
{{{title}}}
diff --git a/webserver.js b/webserver.js index 48806986..10f581a9 100644 --- a/webserver.js +++ b/webserver.js @@ -991,6 +991,20 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) { } } + // Handle logo request + function handleLogoRequest(req, res) { + var domain = checkUserIpAddress(req, res); + + res.set({ 'Cache-Control': 'max-age=86400' }); // 1 day + if ((domain != null) && domain.titlepicture) { + try { res.sendFile(obj.path.join(obj.parent.datapath, domain.titlepicture)); } catch (e) { + try { res.sendFile(obj.path.join(__dirname, 'public/images/logoback.png')); } catch (e) { res.sendStatus(404); } + } + } else { + try { res.sendFile(obj.path.join(__dirname, 'public/images/logoback.png')); } catch (e) { res.sendStatus(404); } + } + } + // Take a "user/domain/userid/path/file" format and return the actual server disk file path if access is allowed obj.getServerFilePath = function (user, domain, path) { var splitpath = path.split('/'), serverpath = obj.path.join(obj.filespath, 'domain'), filename = ''; @@ -1881,6 +1895,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) { obj.app.get(url + 'webrelay.ashx', function (req, res) { res.send('Websocket connection expected'); }); obj.app.ws(url + 'webrelay.ashx', function (ws, req) { PerformWSSessionAuth(ws, req, false, handleRelayWebSocket); }); obj.app.ws(url + 'control.ashx', function (ws, req) { PerformWSSessionAuth(ws, req, false, function (ws1, req1, domain, user, cookie) { obj.meshUserHandler.CreateMeshUser(obj, obj.db, ws1, req1, obj.args, domain, user); }); }); + obj.app.get(url + 'logo.png', handleLogoRequest); // Server picture obj.app.get(url + 'serverpic.ashx', function (req, res) {