Prepare verified laboratory 7 implementation and evidence

This commit is contained in:
rey
2026-11-17 17:32:06 +03:00
parent 20afc2c790
commit eb1b5c7b84
677 changed files with 208256 additions and 64 deletions
+28
View File
@@ -0,0 +1,28 @@
import { requireThat, project } from "./runtime";
export function publicLBEndpoint(inspection: any): {
host: string;
port: number;
servername: string;
} {
requireThat(
inspection?.Config?.Labels?.["com.docker.compose.project"] === project &&
inspection?.Config?.Labels?.["com.docker.compose.service"] === "lb" &&
inspection?.State?.Running === true,
"LB_RESOURCE_GUARD_FAILED",
);
const bindings = inspection?.NetworkSettings?.Ports?.["8443/tcp"];
requireThat(
Array.isArray(bindings) && bindings.length === 1,
"LB_PUBLIC_TLS_BINDING_MISSING",
);
const binding = bindings[0];
requireThat(
binding.HostIp === "127.0.0.1" &&
typeof binding.HostPort === "string" &&
/^[0-9]{1,5}$/.test(binding.HostPort),
"LB_PUBLIC_TLS_BINDING_UNSAFE",
);
const port = Number(binding.HostPort);
requireThat(port >= 1 && port <= 65535, "LB_PUBLIC_TLS_PORT_INVALID");
return { host: "127.0.0.1", port, servername: "localhost" };
}