Skip to content

Commit d6c369a

Browse files
author
Diego Rodriguez Baquero
committed
Enable unique cert verification in testnet
1 parent 6af8be7 commit d6c369a

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

container/shim/src/modules/registration.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,19 @@ async function checkCertValidity(certBuffer, registerOptions, preregisterRespons
202202
}
203203
}
204204

205-
if (NETWORK === "test" && cert.subjectAltName && !cert.subjectAltName.includes("l1s.saturn-test.ms")) {
206-
debug("Certificate is missing l1s.saturn-test.ms SAN, getting a new one...");
207-
valid = false;
205+
if (NETWORK === "test" && cert.subjectAltName) {
206+
if (!cert.subjectAltName.includes("l1s.saturn-test.ms")) {
207+
debug("Certificate is missing l1s.saturn-test.ms SAN, getting a new one...");
208+
valid = false;
209+
}
210+
211+
const subdomain = preregisterResponse?.ip?.replace(/\./g, "-");
212+
const targetSAN = subdomain ? `${subdomain}.l1s.saturn-test.ms` : ".l1s.saturn-test.ms";
213+
214+
if (!cert.subjectAltName.includes(targetSAN)) {
215+
debug(`Certificate is missing ${targetSAN} unique SAN, getting a new one...`);
216+
valid = false;
217+
}
208218
}
209219

210220
if (!valid) {

0 commit comments

Comments
 (0)