Skip to content

Commit

Permalink
Enable unique cert verification in testnet
Browse files Browse the repository at this point in the history
  • Loading branch information
Diego Rodriguez Baquero committed Nov 21, 2023
1 parent 6af8be7 commit d6c369a
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions container/shim/src/modules/registration.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,19 @@ async function checkCertValidity(certBuffer, registerOptions, preregisterRespons
}
}

if (NETWORK === "test" && cert.subjectAltName && !cert.subjectAltName.includes("l1s.saturn-test.ms")) {
debug("Certificate is missing l1s.saturn-test.ms SAN, getting a new one...");
valid = false;
if (NETWORK === "test" && cert.subjectAltName) {
if (!cert.subjectAltName.includes("l1s.saturn-test.ms")) {
debug("Certificate is missing l1s.saturn-test.ms SAN, getting a new one...");
valid = false;
}

const subdomain = preregisterResponse?.ip?.replace(/\./g, "-");
const targetSAN = subdomain ? `${subdomain}.l1s.saturn-test.ms` : ".l1s.saturn-test.ms";

if (!cert.subjectAltName.includes(targetSAN)) {
debug(`Certificate is missing ${targetSAN} unique SAN, getting a new one...`);
valid = false;
}
}

if (!valid) {
Expand Down

0 comments on commit d6c369a

Please sign in to comment.