mirror of
https://github.com/fosrl/pangolin.git
synced 2026-08-10 14:38:22 +02:00
Add auth daemon to blueprints
This commit is contained in:
@@ -225,7 +225,11 @@ export async function updateClientResources(
|
|||||||
: resourceData["udp-ports"],
|
: resourceData["udp-ports"],
|
||||||
fullDomain: resourceData["full-domain"] || null,
|
fullDomain: resourceData["full-domain"] || null,
|
||||||
subdomain: domainInfo ? domainInfo.subdomain : null,
|
subdomain: domainInfo ? domainInfo.subdomain : null,
|
||||||
domainId: domainInfo ? domainInfo.domainId : null
|
domainId: domainInfo ? domainInfo.domainId : null,
|
||||||
|
pamMode: resourceData["auth-daemon"]?.pam || "passthrough",
|
||||||
|
authDaemonMode:
|
||||||
|
resourceData["auth-daemon"]?.mode || "native",
|
||||||
|
authDaemonPort: resourceData["auth-daemon"]?.port || 22123
|
||||||
})
|
})
|
||||||
.where(
|
.where(
|
||||||
eq(
|
eq(
|
||||||
@@ -415,7 +419,11 @@ export async function updateClientResources(
|
|||||||
: resourceData["udp-ports"],
|
: resourceData["udp-ports"],
|
||||||
fullDomain: resourceData["full-domain"] || null,
|
fullDomain: resourceData["full-domain"] || null,
|
||||||
subdomain: domainInfo ? domainInfo.subdomain : null,
|
subdomain: domainInfo ? domainInfo.subdomain : null,
|
||||||
domainId: domainInfo ? domainInfo.domainId : null
|
domainId: domainInfo ? domainInfo.domainId : null,
|
||||||
|
pamMode: resourceData["auth-daemon"]?.pam || "passthrough",
|
||||||
|
authDaemonMode:
|
||||||
|
resourceData["auth-daemon"]?.mode || "native",
|
||||||
|
authDaemonPort: resourceData["auth-daemon"]?.port || 22123
|
||||||
})
|
})
|
||||||
.returning();
|
.returning();
|
||||||
|
|
||||||
|
|||||||
@@ -275,6 +275,12 @@ export async function updateProxyResources(
|
|||||||
headers: headers || null,
|
headers: headers || null,
|
||||||
applyRules:
|
applyRules:
|
||||||
resourceData.rules && resourceData.rules.length > 0,
|
resourceData.rules && resourceData.rules.length > 0,
|
||||||
|
pamMode:
|
||||||
|
resourceData["auth-daemon"]?.pam || "passthrough",
|
||||||
|
authDaemonMode:
|
||||||
|
resourceData["auth-daemon"]?.mode || "native",
|
||||||
|
authDaemonPort:
|
||||||
|
resourceData["auth-daemon"]?.port || 22123,
|
||||||
maintenanceModeEnabled:
|
maintenanceModeEnabled:
|
||||||
resourceData.maintenance?.enabled,
|
resourceData.maintenance?.enabled,
|
||||||
maintenanceModeType: resourceData.maintenance?.type,
|
maintenanceModeType: resourceData.maintenance?.type,
|
||||||
@@ -746,6 +752,10 @@ export async function updateProxyResources(
|
|||||||
headers: headers || null,
|
headers: headers || null,
|
||||||
applyRules:
|
applyRules:
|
||||||
resourceData.rules && resourceData.rules.length > 0,
|
resourceData.rules && resourceData.rules.length > 0,
|
||||||
|
pamMode: resourceData["auth-daemon"]?.pam || "passthrough",
|
||||||
|
authDaemonMode:
|
||||||
|
resourceData["auth-daemon"]?.mode || "native",
|
||||||
|
authDaemonPort: resourceData["auth-daemon"]?.port || 22123,
|
||||||
maintenanceModeEnabled: resourceData.maintenance?.enabled,
|
maintenanceModeEnabled: resourceData.maintenance?.enabled,
|
||||||
maintenanceModeType: resourceData.maintenance?.type,
|
maintenanceModeType: resourceData.maintenance?.type,
|
||||||
maintenanceTitle: resourceData.maintenance?.title,
|
maintenanceTitle: resourceData.maintenance?.title,
|
||||||
|
|||||||
@@ -161,6 +161,25 @@ export const HeaderSchema = z.object({
|
|||||||
value: z.string().min(1)
|
value: z.string().min(1)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const AuthDaemonSchema = z
|
||||||
|
.object({
|
||||||
|
pam: z.enum(["passthrough", "push"]).optional().default("passthrough"),
|
||||||
|
mode: z.enum(["site", "remote", "native"]).optional().default("site"),
|
||||||
|
port: z.int().min(1).max(65535).optional()
|
||||||
|
})
|
||||||
|
.refine(
|
||||||
|
(data) => {
|
||||||
|
if (data.mode === "remote") {
|
||||||
|
return data.port !== undefined;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: ["port"],
|
||||||
|
message: "port is required when auth-daemon mode is 'remote'"
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
// Schema for individual resource
|
// Schema for individual resource
|
||||||
export const PublicResourceSchema = z
|
export const PublicResourceSchema = z
|
||||||
.object({
|
.object({
|
||||||
@@ -180,7 +199,8 @@ export const PublicResourceSchema = z
|
|||||||
"tls-server-name": z.string().optional(),
|
"tls-server-name": z.string().optional(),
|
||||||
headers: z.array(HeaderSchema).optional(),
|
headers: z.array(HeaderSchema).optional(),
|
||||||
rules: z.array(RuleSchema).optional(),
|
rules: z.array(RuleSchema).optional(),
|
||||||
maintenance: MaintenanceSchema.optional()
|
maintenance: MaintenanceSchema.optional(),
|
||||||
|
"auth-daemon": AuthDaemonSchema.optional()
|
||||||
})
|
})
|
||||||
.refine(
|
.refine(
|
||||||
(resource) => {
|
(resource) => {
|
||||||
@@ -401,7 +421,8 @@ export const PrivateResourceSchema = z
|
|||||||
error: "Admin role cannot be included in roles"
|
error: "Admin role cannot be included in roles"
|
||||||
}),
|
}),
|
||||||
users: z.array(z.string()).optional().default([]),
|
users: z.array(z.string()).optional().default([]),
|
||||||
machines: z.array(z.string()).optional().default([])
|
machines: z.array(z.string()).optional().default([]),
|
||||||
|
"auth-daemon": AuthDaemonSchema.optional()
|
||||||
})
|
})
|
||||||
.refine(
|
.refine(
|
||||||
(data) => {
|
(data) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user