1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-02-12 11:01:52 +00:00

Fixed what certificate name is used.

This commit is contained in:
Ylian Saint-Hilaire 2019-10-29 14:05:58 -07:00
parent 565b549ff6
commit 41393d12a8
2 changed files with 6 additions and 7 deletions

View file

@ -497,13 +497,12 @@ module.exports.CertificateOperations = function (parent) {
r.AmtMpsName = obj.pki.certificateFromPem(r.mps.cert).subject.getField("CN").value; r.AmtMpsName = obj.pki.certificateFromPem(r.mps.cert).subject.getField("CN").value;
var webCertificate = obj.pki.certificateFromPem(r.web.cert); var webCertificate = obj.pki.certificateFromPem(r.web.cert);
r.WebIssuer = webCertificate.issuer.getField("CN").value; r.WebIssuer = webCertificate.issuer.getField("CN").value;
r.CommonName = webCertificate.subject.getField("CN").value; if (commonName == "un-configured") { // If the "cert" name is not set, try to use the certificate CN instead (ok if the certificate is not wildcard).
if (r.CommonName.startsWith('*.')) { commonName = webCertificate.subject.getField("CN").value;
if (commonName.indexOf('.') == -1) { console.log("ERROR: Must specify a server full domain name in Config.json->Settings->Cert when using a wildcard certificate."); process.exit(0); return; } if (commonName.startsWith('*.')) { console.log("ERROR: Must specify a server full domain name in Config.json->Settings->Cert when using a wildcard certificate."); process.exit(0); return; }
if (commonName.startsWith('*.')) { console.log("ERROR: Server can't use a wildcard name: " + commonName); process.exit(0); return; }
r.CommonName = commonName;
} }
r.CommonNames = [ r.CommonName.toLowerCase() ]; r.CommonName = commonName;
r.CommonNames = [commonName.toLowerCase()];
var altNames = webCertificate.getExtension("subjectAltName"); var altNames = webCertificate.getExtension("subjectAltName");
if (altNames) { if (altNames) {
for (i = 0; i < altNames.altNames.length; i++) { for (i = 0; i < altNames.altNames.length; i++) {

View file

@ -1,6 +1,6 @@
{ {
"name": "meshcentral", "name": "meshcentral",
"version": "0.4.3-m", "version": "0.4.3-o",
"keywords": [ "keywords": [
"Remote Management", "Remote Management",
"Intel AMT", "Intel AMT",