Add mtls to blueprint, policy, and oss getTraefikConfig

This commit is contained in:
Owen
2026-10-20 10:02:44 -04:00
parent 6aaaae3819
commit f4140fd6f6
34 changed files with 1607 additions and 516 deletions
-24
View File
@@ -696,27 +696,6 @@ export const aiSessionLog = sqliteTable(
]
);
export const resourceMtlsCertificates = sqliteTable(
"resourceMtlsCertificates",
{
mtlsCertificateId: integer("mtlsCertificateId").primaryKey({
autoIncrement: true
}),
resourceId: integer("resourceId")
.notNull()
.references(() => resources.resourceId, { onDelete: "cascade" }),
name: text("name"),
certificate: text("certificate").notNull(),
subject: text("subject"),
issuer: text("issuer"),
serialNumber: text("serialNumber"),
fingerprint: text("fingerprint"),
notBefore: integer("notBefore"),
notAfter: integer("notAfter"),
createdAt: integer("createdAt").notNull()
}
);
export type Approval = InferSelectModel<typeof approvals>;
export type Limit = InferSelectModel<typeof limits>;
export type Account = InferSelectModel<typeof account>;
@@ -756,6 +735,3 @@ export type AlertEmailRecipient = InferSelectModel<typeof alertEmailRecipients>;
export type AlertWebhookAction = InferSelectModel<typeof alertWebhookActions>;
export type TrialNotification = InferSelectModel<typeof trialNotifications>;
export type AiSessionLog = InferSelectModel<typeof aiSessionLog>;
export type ResourceMtlsCertificate = InferSelectModel<
typeof resourceMtlsCertificates
>;
+58 -1
View File
@@ -1,7 +1,6 @@
import { randomUUID } from "crypto";
import { InferSelectModel, sql } from "drizzle-orm";
import {
check,
index,
integer,
primaryKey,
@@ -227,6 +226,11 @@ export const resources = sqliteTable(
mtlsEnabled: integer("mtlsEnabled", { mode: "boolean" })
.notNull()
.default(false),
forwardIdentityHeaders: integer("forwardIdentityHeaders", {
mode: "boolean"
})
.notNull()
.default(true),
postAuthPath: text("postAuthPath"),
health: text("health").default("unknown"), // "healthy", "unhealthy", "unknown"
wildcard: integer("wildcard", { mode: "boolean" })
@@ -1553,6 +1557,9 @@ export const resourcePolicies = sqliteTable("resourcePolicies", {
emailWhitelistEnabled: integer("emailWhitelistEnabled", { mode: "boolean" })
.notNull()
.default(false),
mtlsEnabled: integer("mtlsEnabled", { mode: "boolean" })
.notNull()
.default(false),
niceId: text("niceId").notNull(),
idpId: integer("idpId").references(() => idp.idpId, {
onDelete: "set null"
@@ -2090,6 +2097,50 @@ export const certificates = sqliteTable("certificates", {
keyFile: text("keyFile")
});
export const resourceMtlsCertificates = sqliteTable(
"resourceMtlsCertificates",
{
mtlsCertificateId: integer("mtlsCertificateId").primaryKey({
autoIncrement: true
}),
resourceId: integer("resourceId")
.notNull()
.references(() => resources.resourceId, { onDelete: "cascade" }),
name: text("name"),
certificate: text("certificate").notNull(),
subject: text("subject"),
issuer: text("issuer"),
serialNumber: text("serialNumber"),
fingerprint: text("fingerprint"),
notBefore: integer("notBefore"),
notAfter: integer("notAfter"),
createdAt: integer("createdAt").notNull()
}
);
export const resourcePolicyMtlsCertificates = sqliteTable(
"resourcePolicyMtlsCertificates",
{
mtlsCertificateId: integer("mtlsCertificateId").primaryKey({
autoIncrement: true
}),
resourcePolicyId: integer("resourcePolicyId")
.notNull()
.references(() => resourcePolicies.resourcePolicyId, {
onDelete: "cascade"
}),
name: text("name"),
certificate: text("certificate").notNull(),
subject: text("subject"),
issuer: text("issuer"),
serialNumber: text("serialNumber"),
fingerprint: text("fingerprint"),
notBefore: integer("notBefore"),
notAfter: integer("notAfter"),
createdAt: integer("createdAt").notNull()
}
);
export type Org = InferSelectModel<typeof orgs>;
export type User = InferSelectModel<typeof users>;
export type Site = InferSelectModel<typeof sites>;
@@ -2190,3 +2241,9 @@ export type SiteResourceAiProvider = InferSelectModel<
export type ResourceAiModel = InferSelectModel<typeof resourceAiModels>;
export type SiteResourceAiModel = InferSelectModel<typeof siteResourceAiModels>;
export type Certificate = InferSelectModel<typeof certificates>;
export type ResourceMtlsCertificate = InferSelectModel<
typeof resourceMtlsCertificates
>;
export type ResourcePolicyMtlsCertificate = InferSelectModel<
typeof resourcePolicyMtlsCertificates
>;