Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Add PKI sync for KEMP Loadbalancer

Carlos Monastyrski5133928e35e1
diff --git a/backend/package-lock.json b/backend/package-lock.json
index 19c6b9858b..ea7f0fff0d 100644
--- a/backend/package-lock.json
+++ b/backend/package-lock.json
@@ -95,6 +95,7 @@
"dd-trace": "^5.40.0",
"dns-packet": "^5.6.1",
"dotenv": "^16.4.1",
+ "fast-xml-parser": "^5.7.0",
"fastify": "^5.8.3",
"fastify-plugin": "^5.0.1",
"file-type": "^22.0.0",
diff --git a/backend/package.json b/backend/package.json
index 786b0ad1b9..ca665a7d3c 100644
--- a/backend/package.json
+++ b/backend/package.json
@@ -234,6 +234,7 @@
"dd-trace": "^5.40.0",
"dns-packet": "^5.6.1",
"dotenv": "^16.4.1",
+ "fast-xml-parser": "^5.7.0",
"fastify": "^5.8.3",
"fastify-plugin": "^5.0.1",
"file-type": "^22.0.0",
diff --git a/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts b/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts
index dee00a6bfc..e4bcbe04ab 100644
--- a/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts
+++ b/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts
@@ -141,6 +141,10 @@ import {
HumanitecConnectionListItemSchema,
SanitizedHumanitecConnectionSchema
} from "@app/services/app-connection/humanitec";
+import {
+ KempLoadMasterConnectionListItemSchema,
+ SanitizedKempLoadMasterConnectionSchema
+} from "@app/services/app-connection/kemp-loadmaster";
import {
LaravelForgeConnectionListItemSchema,
SanitizedLaravelForgeConnectionSchema
@@ -311,6 +315,7 @@ const SanitizedAppConnectionSchema = z.union([
...SanitizedVenafiTppConnectionSchema.options,
...SanitizedExternalInfisicalConnectionSchema.options,
...SanitizedNetScalerConnectionSchema.options,
+ ...SanitizedKempLoadMasterConnectionSchema.options,
...SanitizedDopplerConnectionSchema.options,
...SanitizedOvhConnectionSchema.options,
...SanitizedOnaConnectionSchema.options,
@@ -392,6 +397,7 @@ const AppConnectionOptionsSchema = z.discriminatedUnion("app", [
ExternalInfisicalConnectionListItemSchema,
DopplerConnectionListItemSchema,
NetScalerConnectionListItemSchema,
+ KempLoadMasterConnectionListItemSchema,
AnthropicConnectionListItemSchema,
OvhConnectionListItemSchema,
DevinConnectionListItemSchema,
diff --git a/backend/src/server/routes/v1/app-connection-routers/index.ts b/backend/src/server/routes/v1/app-connection-routers/index.ts
index 61f195b647..fb992a001d 100644
--- a/backend/src/server/routes/v1/app-connection-routers/index.ts
+++ b/backend/src/server/routes/v1/app-connection-routers/index.ts
@@ -43,6 +43,7 @@ import { registerHasuraCloudConnectionRouter } from "./hasura-cloud-connection-r
import { registerHCVaultConnectionRouter } from "./hc-vault-connection-router";
import { registerHerokuConnectionRouter } from "./heroku-connection-router";
import { registerHumanitecConnectionRouter } from "./humanitec-connection-router";
+import { registerKempLoadMasterConnectionRouter } from "./kemp-loadmaster-connection-router";
import { registerLaravelForgeConnectionRouter } from "./laravel-forge-connection-router";
import { registerLdapConnectionRouter } from "./ldap-connection-router";
import { registerLiteLLMConnectionRouter } from "./litellm-connection-router";
@@ -146,6 +147,7 @@ export const APP_CONNECTION_REGISTER_ROUTER_MAP: Record<AppConnection, (server:
[AppConnection.ExternalInfisical]: registerExternalInfisicalConnectionRouter,
[AppConnection.Doppler]: registerDopplerConnectionRouter,
[AppConnection.NetScaler]: registerNetScalerConnectionRouter,
+ [AppConnection.KempLoadMaster]: registerKempLoadMasterConnectionRouter,
[AppConnection.Anthropic]: registerAnthropicConnectionRouter,
[AppConnection.OVH]: registerOvhConnectionRouter,
[AppConnection.Devin]: registerDevinConnectionRouter,
diff --git a/backend/src/server/routes/v1/app-connection-routers/kemp-loadmaster-connection-router.ts b/backend/src/server/routes/v1/app-connection-routers/kemp-loadmaster-connection-router.ts
new file mode 100644
index 0000000000..35d721415d
--- /dev/null
+++ b/backend/src/server/routes/v1/app-connection-routers/kemp-loadmaster-connection-router.ts
@@ -0,0 +1,18 @@
+import { AppConnection } from "@app/services/app-connection/app-connection-enums";
+import {
+ CreateKempLoadMasterConnectionSchema,
+ SanitizedKempLoadMasterConnectionSchema,
+ UpdateKempLoadMasterConnectionSchema
+} from "@app/services/app-connection/kemp-loadmaster";
+
+import { registerAppConnectionEndpoints } from "./app-connection-endpoints";
+
+export const registerKempLoadMasterConnectionRouter = async (server: FastifyZodProvider) => {
+ registerAppConnectionEndpoints({
+ app: AppConnection.KempLoadMaster,
+ server,
+ sanitizedResponseSchema: SanitizedKempLoadMasterConnectionSchema,
+ createSchema: CreateKempLoadMasterConnectionSchema,
+ updateSchema: UpdateKempLoadMasterConnectionSchema
+ });
+};
diff --git a/backend/src/server/routes/v1/pki-sync-routers/index.ts b/backend/src/server/routes/v1/pki-sync-routers/index.ts
index a2e474b560..9b002374ed 100644
--- a/backend/src/server/routes/v1/pki-sync-routers/index.ts
+++ b/backend/src/server/routes/v1/pki-sync-routers/index.ts
@@ -7,6 +7,7 @@ import { registerAzureKeyVaultPkiSyncRouter } from "./azure-key-vault-pki-sync-r
import { registerChefPkiSyncRouter } from "./chef-pki-sync-router";
import { registerCloudflareCustomCertificatePkiSyncRouter } from "./cloudflare-custom-certificate-pki-sync-router";
import { registerF5BigIpPkiSyncRouter } from "./f5-big-ip-pki-sync-router";
+import { registerKempLoadMasterPkiSyncRouter } from "./kemp-loadmaster-pki-sync-router";
import { registerLinuxServerPkiSyncRouter } from "./linux-server-pki-sync-router";
import { registerNetScalerPkiSyncRouter } from "./netscaler-pki-sync-router";
import { registerWindowsServerPkiSyncRouter } from "./windows-server-pki-sync-router";
@@ -25,6 +26,7 @@ export const PKI_SYNC_REGISTER_ROUTER_MAP: Record<
[PkiSync.CloudflareCustomCertificate]: registerCloudflareCustomCertificatePkiSyncRouter,
[PkiSync.NetScaler]: registerNetScalerPkiSyncRouter,
[PkiSync.F5BigIp]: registerF5BigIpPkiSyncRouter,
+ [PkiSync.KempLoadMaster]: registerKempLoadMasterPkiSyncRouter,
[PkiSync.LinuxServer]: registerLinuxServerPkiSyncRouter,
[PkiSync.WindowsServer]: registerWindowsServerPkiSyncRouter
};
diff --git a/backend/src/server/routes/v1/pki-sync-routers/kemp-loadmaster-pki-sync-router.ts b/backend/src/server/routes/v1/pki-sync-routers/kemp-loadmaster-pki-sync-router.ts
new file mode 100644
index 0000000000..3d7cad4b2e
--- /dev/null
+++ b/backend/src/server/routes/v1/pki-sync-routers/kemp-loadmaster-pki-sync-router.ts
@@ -0,0 +1,72 @@
+import { z } from "zod";
+
+import { readLimit } from "@app/server/config/rateLimiter";
+import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
+import { AuthMode } from "@app/services/auth/auth-type";
+import {
+ CreateKempLoadMasterPkiSyncSchema,
+ KEMP_LOADMASTER_PKI_SYNC_LIST_OPTION,
+ KempLoadMasterPkiSyncSchema,
+ UpdateKempLoadMasterPkiSyncSchema
+} from "@app/services/pki-sync/kemp-loadmaster";
+import { PkiSync } from "@app/services/pki-sync/pki-sync-enums";
+
+import { registerSyncPkiEndpoints } from "./pki-sync-endpoints";
+
+export const registerKempLoadMasterPkiSyncRouter = async (
+ server: FastifyZodProvider,
+ enableOperationId: boolean = true
+) => {
+ registerSyncPkiEndpoints({
+ destination: PkiSync.KempLoadMaster,
+ server,
+ responseSchema: KempLoadMasterPkiSyncSchema,
+ createSchema: CreateKempLoadMasterPkiSyncSchema,
+ updateSchema: UpdateKempLoadMasterPkiSyncSchema,
+ syncOptions: {
+ canImportCertificates: KEMP_LOADMASTER_PKI_SYNC_LIST_OPTION.canImportCertificates,
+ canRemoveCertificates: KEMP_LOADMASTER_PKI_SYNC_LIST_OPTION.canRemoveCertificates
+ },
+ enableOperationId
+ });
+
+ server.route({
+ method: "GET",
+ url: "/virtual-services",
+ config: {
+ rateLimit: readLimit
+ },
+ schema: {
+ hide: false,
+ ...(enableOperationId ? { operationId: "listKempLoadMasterVirtualServices" } : {}),
+ description: "List the Virtual Services available on the Kemp LoadMaster for the specified connection.",
+ querystring: z.object({
+ connectionId: z.string().uuid()
+ }),
+ response: {
+ 200: z.object({
+ virtualServices: z.array(
+ z.object({
+ id: z.string(),
+ name: z.string(),
+ address: z.string(),
+ port: z.number(),
+ protocol: z.string()
+ })
+ )
+ })
+ }
+ },
+ onRequest: verifyAuth([AuthMode.JWT]),
+ handler: async (req) => {
+ const { connectionId } = req.query;
+
+ const virtualServices = await server.services.appConnection.kempLoadMaster.listVirtualServices(
+ connectionId,
+ req.permission
+ );
+
+ return { virtualServices };
+ }
+ });
+};
diff --git a/backend/src/services/app-connection/app-connection-enums.ts b/backend/src/services/app-connection/app-connection-enums.ts
index 44b4109b6c..5ad714ad09 100644
--- a/backend/src/services/app-connection/app-connection-enums.ts
+++ b/backend/src/services/app-connection/app-connection-enums.ts
@@ -77,7 +77,8 @@ export enum AppConnection {
Qovery = "qovery",
Cloud66 = "cloud-66",
LiteLLM = "litellm",
- Fireworks = "fireworks"
+ Fireworks = "fireworks",
+ KempLoadMaster = "kemp-loadmaster"
}
export enum AWSRegion {
diff --git a/backend/src/services/app-connection/app-connection-fns.ts b/backend/src/services/app-connection/app-connection-fns.ts
index 751192345b..6c92e10d48 100644
--- a/backend/src/services/app-connection/app-connection-fns.ts
+++ b/backend/src/services/app-connection/app-connection-fns.ts
@@ -187,6 +187,11 @@ import {
HumanitecConnectionMethod,
validateHumanitecConnectionCredentials
} from "./humanitec";
+import {
+ getKempLoadMasterConnectionListItem,
+ KempLoadMasterConnectionMethod,
+ validateKempLoadMasterConnectionCredentials
+} from "./kemp-loadmaster";
import {
getLaravelForgeConnectionListItem,
LaravelForgeConnectionMethod,
@@ -309,6 +314,7 @@ const PKI_APP_CONNECTIONS = [
AppConnection.Venafi,
AppConnection.VenafiTpp,
AppConnection.NetScaler,
+ AppConnection.KempLoadMaster,
AppConnection.DigiCert,
AppConnection.F5BigIp,
AppConnection.GoDaddy,
@@ -383,6 +389,7 @@ export const listAppConnectionOptions = (projectType?: ProjectType) => {
getExternalInfisicalConnectionListItem(),
getDopplerConnectionListItem(),
getNetScalerConnectionListItem(),
+ getKempLoadMasterConnectionListItem(),
getOvhConnectionListItem(),
getOnaConnectionListItem(),
getDigiCertConnectionListItem(),
@@ -627,6 +634,7 @@ export const validateAppConnectionCredentials = async (
gatewayV2Service
)) as TAppConnectionCredentialsValidator,
[AppConnection.NetScaler]: validateNetScalerConnectionCredentials as TAppConnectionCredentialsValidator,
+ [AppConnection.KempLoadMaster]: validateKempLoadMasterConnectionCredentials as TAppConnectionCredentialsValidator,
[AppConnection.Ona]: validateOnaConnectionCredentials as TAppConnectionCredentialsValidator,
[AppConnection.TravisCI]: validateTravisCIConnectionCredentials as TAppConnectionCredentialsValidator,
[AppConnection.ExternalInfisical]: ((config: TAppConnectionConfig) =>
@@ -759,6 +767,8 @@ export const getAppConnectionMethodName = (method: TAppConnection["method"]) =>
return "Access Token";
case NetScalerConnectionMethod.BasicAuth:
return "Basic Auth";
+ case KempLoadMasterConnectionMethod.BasicAuth:
+ return "Basic Auth";
case F5BigIpConnectionMethod.BasicAuth:
return "Basic Auth";
case ExternalInfisicalConnectionMethod.MachineIdentityUniversalAuth:
@@ -893,6 +903,7 @@ export const TRANSITION_CONNECTION_CREDENTIALS_TO_PLATFORM: Record<
[AppConnection.VenafiTpp]: platformManagedCredentialsNotSupported,
[AppConnection.ExternalInfisical]: platformManagedCredentialsNotSupported,
[AppConnection.NetScaler]: platformManagedCredentialsNotSupported,
+ [AppConnection.KempLoadMaster]: platformManagedCredentialsNotSupported,
[AppConnection.Doppler]: platformManagedCredentialsNotSupported,
[AppConnection.OVH]: platformManagedCredentialsNotSupported,
[AppConnection.Ona]: platformManagedCredentialsNotSupported,
diff --git a/backend/src/services/app-connection/app-connection-maps.ts b/backend/src/services/app-connection/app-connection-maps.ts
index b034bd6d46..d1e7bf6762 100644
--- a/backend/src/services/app-connection/app-connection-maps.ts
+++ b/backend/src/services/app-connection/app-connection-maps.ts
@@ -62,6 +62,7 @@ export const APP_CONNECTION_NAME_MAP: Record<AppConnection, string> = {
[AppConnection.ExternalInfisical]: "Infisical",
[AppConnection.Doppler]: "Doppler",
[AppConnection.NetScaler]: "NetScaler",
+ [AppConnection.KempLoadMaster]: "Kemp LoadMaster",
[AppConnection.Anthropic]: "Anthropic",
[AppConnection.OVH]: "OVH",
[AppConnection.Devin]: "Devin",
@@ -144,6 +145,7 @@ export const APP_CONNECTION_PLAN_MAP: Record<AppConnection, AppConnectionPlanTyp
[AppConnection.ExternalInfisical]: AppConnectionPlanType.Regular,
[AppConnection.Doppler]: AppConnectionPlanType.Regular,
[AppConnection.NetScaler]: AppConnectionPlanType.Regular,
+ [AppConnection.KempLoadMaster]: AppConnectionPlanType.Regular,
[AppConnection.Anthropic]: AppConnectionPlanType.Regular,
[AppConnection.OVH]: AppConnectionPlanType.Regular,
[AppConnection.Devin]: AppConnectionPlanType.Regular,
diff --git a/backend/src/services/app-connection/app-connection-service.ts b/backend/src/services/app-connection/app-connection-service.ts
index d2ced3171f..24b979ee7c 100644
--- a/backend/src/services/app-connection/app-connection-service.ts
+++ b/backend/src/services/app-connection/app-connection-service.ts
@@ -131,6 +131,8 @@ import { ValidateHerokuConnectionCredentialsSchema } from "./heroku";
import { herokuConnectionService } from "./heroku/heroku-connection-service";
import { ValidateHumanitecConnectionCredentialsSchema } from "./humanitec";
import { humanitecConnectionService } from "./humanitec/humanitec-connection-service";
+import { ValidateKempLoadMasterConnectionCredentialsSchema } from "./kemp-loadmaster";
+import { kempLoadMasterConnectionService } from "./kemp-loadmaster/kemp-loadmaster-connection-service";
import { ValidateLaravelForgeConnectionCredentialsSchema } from "./laravel-forge";
import { laravelForgeConnectionService } from "./laravel-forge/laravel-forge-connection-service";
import { ValidateLdapConnectionCredentialsSchema } from "./ldap";
@@ -277,6 +279,7 @@ const VALIDATE_APP_CONNECTION_CREDENTIALS_MAP: Record<AppConnection, TValidateAp
[AppConnection.ExternalInfisical]: ValidateExternalInfisicalConnectionCredentialsSchema,
[AppConnection.Doppler]: ValidateDopplerConnectionCredentialsSchema,
[AppConnection.NetScaler]: ValidateNetScalerConnectionCredentialsSchema,
+ [AppConnection.KempLoadMaster]: ValidateKempLoadMasterConnectionCredentialsSchema,
[AppConnection.Anthropic]: ValidateAnthropicConnectionCredentialsSchema,
[AppConnection.OVH]: ValidateOvhConnectionCredentialsSchema,
[AppConnection.Devin]: ValidateDevinConnectionCredentialsSchema,
@@ -1342,6 +1345,7 @@ export const appConnectionServiceFactory = ({
gcp: gcpConnectionService(connectAppConnectionById),
databricks: databricksConnectionService(connectAppConnectionById, appConnectionDAL, kmsService),
aws: awsConnectionService(connectAppConnectionById),
+ kempLoadMaster: kempLoadMasterConnectionService(connectAppConnectionById, gatewayV2Service, gatewayPoolService),
humanitec: humanitecConnectionService(connectAppConnectionById),
terraformCloud: terraformCloudConnectionService(connectAppConnectionById),
camunda: camundaConnectionService(connectAppConnectionById, appConnectionDAL, kmsService),
diff --git a/backend/src/services/app-connection/app-connection-types.ts b/backend/src/services/app-connection/app-connection-types.ts
index 2cfb9318fd..a9b2905ae7 100644
--- a/backend/src/services/app-connection/app-connection-types.ts
+++ b/backend/src/services/app-connection/app-connection-types.ts
@@ -262,6 +262,12 @@ import {
THumanitecConnectionInput,
TValidateHumanitecConnectionCredentialsSchema
} from "./humanitec";
+import {
+ TKempLoadMasterConnection,
+ TKempLoadMasterConnectionConfig,
+ TKempLoadMasterConnectionInput,
+ TValidateKempLoadMasterConnectionCredentialsSchema
+} from "./kemp-loadmaster";
import {
TLaravelForgeConnection,
TLaravelForgeConnectionConfig,
@@ -533,6 +539,7 @@ export type TAppConnection = { id: string; configuration?: TAppConnectionConfigu
| TExternalInfisicalConnection
| TDopplerConnection
| TNetScalerConnection
+ | TKempLoadMasterConnection
| TAnthropicConnection
| TOvhConnection
| TDevinConnection
@@ -623,6 +630,7 @@ export type TAppConnectionInput = { id: string } & (
| TExternalInfisicalConnectionInput
| TDopplerConnectionInput
| TNetScalerConnectionInput
+ | TKempLoadMasterConnectionInput
| TAnthropicConnectionInput
| TOvhConnectionInput
| TDevinConnectionInput
@@ -745,6 +753,7 @@ export type TAppConnectionConfig =
| TExternalInfisicalConnectionConfig
| TDopplerConnectionConfig
| TNetScalerConnectionConfig
+ | TKempLoadMasterConnectionConfig
| TAnthropicConnectionConfig
| TOvhConnectionConfig
| TDevinConnectionConfig
@@ -826,6 +835,7 @@ export type TValidateAppConnectionCredentialsSchema =
| TValidateExternalInfisicalConnectionCredentialsSchema
| TValidateDopplerConnectionCredentialsSchema
| TValidateNetScalerConnectionCredentialsSchema
+ | TValidateKempLoadMasterConnectionCredentialsSchema
| TValidateAnthropicConnectionCredentialsSchema
| TValidateOvhConnectionCredentialsSchema
| TValidateDevinConnectionCredentialsSchema
diff --git a/backend/src/services/app-connection/kemp-loadmaster/index.ts b/backend/src/services/app-connection/kemp-loadmaster/index.ts
new file mode 100644
index 0000000000..fb3c082fee
--- /dev/null
+++ b/backend/src/services/app-connection/kemp-loadmaster/index.ts
@@ -0,0 +1,18 @@
+export { KempLoadMasterConnectionMethod } from "./kemp-loadmaster-connection-enums";
+export {
+ getKempLoadMasterConnectionListItem,
+ validateKempLoadMasterConnectionCredentials
+} from "./kemp-loadmaster-connection-fns";
+export {
+ CreateKempLoadMasterConnectionSchema,
+ KempLoadMasterConnectionListItemSchema,
+ SanitizedKempLoadMasterConnectionSchema,
+ UpdateKempLoadMasterConnectionSchema,
+ ValidateKempLoadMasterConnectionCredentialsSchema
+} from "./kemp-loadmaster-connection-schemas";
+export type {
+ TKempLoadMasterConnection,
+ TKempLoadMasterConnectionConfig,
+ TKempLoadMasterConnectionInput,
+ TValidateKempLoadMasterConnectionCredentialsSchema
+} from "./kemp-loadmaster-connection-types";
diff --git a/backend/src/services/app-connection/kemp-loadmaster/kemp-loadmaster-connection-enums.ts b/backend/src/services/app-connection/kemp-loadmaster/kemp-loadmaster-connection-enums.ts
new file mode 100644
index 0000000000..7816a86345
--- /dev/null
+++ b/backend/src/services/app-connection/kemp-loadmaster/kemp-loadmaster-connection-enums.ts
@@ -0,0 +1,3 @@
+export enum KempLoadMasterConnectionMethod {
+ BasicAuth = "basic-auth"
+}
diff --git a/backend/src/services/app-connection/kemp-loadmaster/kemp-loadmaster-connection-fns.ts b/backend/src/services/app-connection/kemp-loadmaster/kemp-loadmaster-connection-fns.ts
new file mode 100644
index 0000000000..03429a33be
--- /dev/null
+++ b/backend/src/services/app-connection/kemp-loadmaster/kemp-loadmaster-connection-fns.ts
@@ -0,0 +1,240 @@
+import { AxiosError, AxiosRequestConfig } from "axios";
+import { XMLParser } from "fast-xml-parser";
+import https from "https";
+
+import { TGatewayServiceFactory } from "@app/ee/services/gateway/gateway-service";
+import { TGatewayV2ServiceFactory } from "@app/ee/services/gateway-v2/gateway-v2-service";
+import { getConfig } from "@app/lib/config/env";
+import { request } from "@app/lib/config/request";
+import { BadRequestError } from "@app/lib/errors";
+import { GatewayProxyProtocol } from "@app/lib/gateway";
+import { withGatewayV2Proxy } from "@app/lib/gateway-v2/gateway-v2";
+import { safeRequest } from "@app/lib/validator";
+import { AppConnection } from "@app/services/app-connection/app-connection-enums";
+
+import { KempLoadMasterConnectionMethod } from "./kemp-loadmaster-connection-enums";
+import { TKempLoadMasterConnectionConfig } from "./kemp-loadmaster-connection-types";
+
+export const KEMP_LOADMASTER_DEFAULT_PORT = 8443;
+
+type TKempCredentials = TKempLoadMasterConnectionConfig["credentials"];
+
+export type TKempRequestFn = <R>(requestCfg: AxiosRequestConfig) => Promise<R>;
+
+export type TKempParsedResponse = {
+ ok: boolean;
+ stat: string;
+ code: string;
+ error?: string;
+ data?: unknown;
+};
+
+const kempXmlParser = new XMLParser({ ignoreAttributes: false, attributeNamePrefix: "@_" });
+
+export const parseKempResponse = (payload: unknown): TKempParsedResponse => {
+ const parsed: unknown = typeof payload === "string" ? kempXmlParser.parse(payload) : payload;
+ const response = (parsed as { Response?: Record<string, unknown> })?.Response;
+
+ const stat = response?.["@_stat"] !== undefined ? String(response["@_stat"]) : "";
+ const code = response?.["@_code"] !== undefined ? String(response["@_code"]) : "";
+ const error = response?.Error !== undefined ? String(response.Error) : undefined;
+ const data = (response?.Success as { Data?: unknown })?.Data;
+
+ return { ok: stat === "200" && code === "ok", stat, code, error, data };
+};
+
+export const getKempBaseUrl = (credentials: TKempCredentials): string =>
+ `https://${credentials.hostname}:${credentials.port ?? KEMP_LOADMASTER_DEFAULT_PORT}`;
+
+export const getKempAuthHeaders = (credentials: TKempCredentials): Record<string, string> => {
+ const token = Buffer.from(`${credentials.username}:${credentials.password}`).toString("base64");
+ return { Authorization: `Basic ${token}` };
+};
+
+export const getKempLoadMasterConnectionListItem = () => {
+ return {
+ name: "Kemp LoadMaster" as const,
+ app: AppConnection.KempLoadMaster as const,
+ methods: Object.values(KempLoadMasterConnectionMethod) as [KempLoadMasterConnectionMethod.BasicAuth]
+ };
+};
+
+export const executeKempLoadMasterOperationWithGateway = async <T>(
+ config: {
+ gatewayId?: string | null;
+ credentials: TKempCredentials;
+ },
+ gatewayV2Service: Pick<TGatewayV2ServiceFactory, "getPlatformConnectionDetailsByGatewayId"> | undefined,
+ operation: (makeRequest: TKempRequestFn) => Promise<T>
+): Promise<T> => {
+ const { gatewayId, credentials } = config;
+ const { hostname, port: credPort } = credentials;
+ const port = credPort ?? KEMP_LOADMASTER_DEFAULT_PORT;
+
+ if (gatewayId && gatewayV2Service) {
+ const platformConnectionDetails = await gatewayV2Service.getPlatformConnectionDetailsByGatewayId({
+ gatewayId,
+ targetHost: hostname,
+ targetPort: port
+ });
+
+ if (!platformConnectionDetails) {
+ throw new BadRequestError({ message: "Unable to connect to gateway, no platform connection details found" });
+ }
+
+ return withGatewayV2Proxy(
+ async (proxyPort) => {
+ const httpsAgent = new https.Agent({
+ servername: hostname,
+ rejectUnauthorized: credentials.sslRejectUnauthorized,
+ ca: credentials.sslCertificate ? [credentials.sslCertificate] : undefined
+ });
+
+ const proxyBaseUrl = `https://localhost:${proxyPort}`;
+ const targetBaseUrl = `https://${hostname}:${port}`;
+
+ const makeRequest = async <R>(requestCfg: AxiosRequestConfig): Promise<R> => {
+ const resp = await request.request<R>({
+ ...requestCfg,
+ url: requestCfg.url?.replace(targetBaseUrl, proxyBaseUrl),
+ headers: {
+ ...requestCfg.headers,
+ Host: hostname
+ },
+ httpsAgent
+ });
+ return resp.data;
+ };
+
+ return operation(makeRequest);
+ },
+ {
+ protocol: GatewayProxyProtocol.Tcp,
+ relayHost: platformConnectionDetails.relayHost,
+ gateway: platformConnectionDetails.gateway,
+ relay: platformConnectionDetails.relay
+ }
+ );
+ }
+
+ const makeRequest = async <R>(requestCfg: AxiosRequestConfig): Promise<R> => {
+ const resp = await safeRequest.request<R>({
+ ...requestCfg,
+ url: requestCfg.url as string,
+ ca: credentials.sslCertificate,
+ rejectUnauthorized: credentials.sslRejectUnauthorized,
+ servername: hostname,
+ allowPrivateIps: getConfig().ALLOW_INTERNAL_IP_CONNECTIONS
+ });
+ return resp.data;
+ };
+
+ return operation(makeRequest);
+};
+
+export type TKempVirtualService = {
+ id: string;
+ name: string;
+ address: string;
+ port: number;
+ protocol: string;
+};
+
+export const listKempVirtualServices = async (
+ config: {
+ gatewayId?: string | null;
+ credentials: TKempCredentials;
+ },
+ gatewayV2Service: Pick<TGatewayV2ServiceFactory, "getPlatformConnectionDetailsByGatewayId"> | undefined
+): Promise<TKempVirtualService[]> => {
+ const baseUrl = getKempBaseUrl(config.credentials);
+
+ return executeKempLoadMasterOperationWithGateway(config, gatewayV2Service, async (makeRequest) => {
+ const payload = await makeRequest<string>({
+ method: "GET",
+ url: `${baseUrl}/access/listvs`,
+ headers: getKempAuthHeaders(config.credentials),
+ responseType: "text"
+ });
+
+ const parsed = parseKempResponse(payload);
+ if (!parsed.ok) {
+ throw new BadRequestError({
+ message: `Unable to list Virtual Services: ${parsed.error || "the LoadMaster rejected the request"}`
+ });
+ }
+
+ const data = parsed.data as { VS?: unknown } | undefined;
+ if (!data?.VS) return [];
+
+ const entries = Array.isArray(data.VS) ? data.VS : [data.VS];
+ return entries
+ .map((entry) => {
+ const vs = entry as Record<string, unknown>;
+ const index = vs.Index !== undefined && vs.Index !== null ? String(vs.Index) : "";
+ return {
+ id: index,
+ name: vs.NickName !== undefined && vs.NickName !== null ? String(vs.NickName) : "",
+ address: vs.VSAddress !== undefined && vs.VSAddress !== null ? String(vs.VSAddress) : "",
+ port: vs.VSPort !== undefined && vs.VSPort !== null ? Number(vs.VSPort) : 0,
+ protocol: vs.Protocol !== undefined && vs.Protocol !== null ? String(vs.Protocol) : ""
+ };
+ })
+ .filter((vs) => vs.id !== "");
+ });
+};
+
+export const validateKempLoadMasterConnectionCredentials = async (
+ config: TKempLoadMasterConnectionConfig,
+ _gatewayService: Pick<TGatewayServiceFactory, "fnGetGatewayClientTlsByGatewayId">,
+ gatewayV2Service: Pick<TGatewayV2ServiceFactory, "getPlatformConnectionDetailsByGatewayId">
+) => {
+ const { credentials } = config;
+ const baseUrl = getKempBaseUrl(credentials);
+
+ try {
+ await executeKempLoadMasterOperationWithGateway(
+ { gatewayId: config.gatewayId, credentials },
+ gatewayV2Service,
+ async (makeRequest) => {
+ const payload = await makeRequest<string>({
+ method: "GET",
+ url: `${baseUrl}/access/listcert`,
+ headers: getKempAuthHeaders(credentials),
+ responseType: "text"
+ });
+
+ const parsed = parseKempResponse(payload);
+ if (!parsed.ok) {
+ throw new BadRequestError({
+ message: `Unable to validate connection: ${parsed.error || "the LoadMaster rejected the request"}`
+ });
+ }
+ }
+ );
+ } catch (error: unknown) {
+ if (error instanceof BadRequestError) {
+ throw error;
+ }
+
+ if (error instanceof AxiosError) {
+ if (error.response?.status === 401) {
+ throw new BadRequestError({ message: "Unable to validate connection: invalid username or password" });
+ }
+ if (error.response?.status === 404) {
+ throw new BadRequestError({
+ message:
+ "Unable to validate connection: the LoadMaster API interface is not enabled. Enable it under Certificates & Security > Remote Access > Enable API Interface."
+ });
+ }
+ }
+
+ throw new BadRequestError({
+ message: `Unable to validate connection: ${
+ error instanceof Error ? error.message : "verify credentials and that the LoadMaster is reachable"
+ }`
+ });
+ }
+
+ return config.credentials;
+};
diff --git a/backend/src/services/app-connection/kemp-loadmaster/kemp-loadmaster-connection-schemas.ts b/backend/src/services/app-connection/kemp-loadmaster/kemp-loadmaster-connection-schemas.ts
new file mode 100644
index 0000000000..488c25db38
--- /dev/null
+++ b/backend/src/services/app-connection/kemp-loadmaster/kemp-loadmaster-connection-schemas.ts
@@ -0,0 +1,91 @@
+import z from "zod";
+
+import { AppConnections } from "@app/lib/api-docs";
+import { AppConnection } from "@app/services/app-connection/app-connection-enums";
+import {
+ BaseAppConnectionSchema,
+ GenericCreateAppConnectionFieldsSchema,
+ GenericUpdateAppConnectionFieldsSchema
+} from "@app/services/app-connection/app-connection-schemas";
+
+import { APP_CONNECTION_NAME_MAP } from "../app-connection-maps";
+import { KempLoadMasterConnectionMethod } from "./kemp-loadmaster-connection-enums";
+
+export const KempLoadMasterConnectionBasicAuthCredentialsSchema = z.object({
+ hostname: z
+ .string()
+ .trim()
+ .min(1, "Hostname is required")
+ .max(512, "Hostname cannot exceed 512 characters")
+ .refine((val) => !val.includes("/") && !val.includes("@") && !val.includes("?"), {
+ message: "Hostname must not contain /, @, or ? characters"
+ }),
+ port: z.number().int().min(1).max(65535).optional(),
+ username: z.string().trim().min(1, "Username is required").max(256, "Username cannot exceed 256 characters"),
+ password: z.string().trim().min(1, "Password is required").max(512, "Password cannot exceed 512 characters"),
+ sslRejectUnauthorized: z.boolean().optional(),
+ sslCertificate: z
+ .string()
+ .trim()
+ .transform((value) => value || undefined)
+ .optional()
+});
+
+const BaseKempLoadMasterConnectionSchema = BaseAppConnectionSchema.extend({
+ app: z.literal(AppConnection.KempLoadMaster)
+});
+
+export const KempLoadMasterConnectionSchema = BaseKempLoadMasterConnectionSchema.extend({
+ method: z.literal(KempLoadMasterConnectionMethod.BasicAuth),
+ credentials: KempLoadMasterConnectionBasicAuthCredentialsSchema
+});
+
+export const SanitizedKempLoadMasterConnectionSchema = z.discriminatedUnion("method", [
+ BaseKempLoadMasterConnectionSchema.extend({
+ method: z.literal(KempLoadMasterConnectionMethod.BasicAuth),
+ credentials: KempLoadMasterConnectionBasicAuthCredentialsSchema.pick({
+ hostname: true,
+ port: true,
+ username: true,
+ sslRejectUnauthorized: true,
+ sslCertificate: true
+ })
+ }).describe(JSON.stringify({ title: `${APP_CONNECTION_NAME_MAP[AppConnection.KempLoadMaster]} (Basic Auth)` }))
+]);
+
+export const ValidateKempLoadMasterConnectionCredentialsSchema = z.discriminatedUnion("method", [
+ z.object({
+ method: z
+ .literal(KempLoadMasterConnectionMethod.BasicAuth)
+ .describe(AppConnections.CREATE(AppConnection.KempLoadMaster).method),
+ credentials: KempLoadMasterConnectionBasicAuthCredentialsSchema.describe(
+ AppConnections.CREATE(AppConnection.KempLoadMaster).credentials
+ )
+ })
+]);
+
+export const CreateKempLoadMasterConnectionSchema = ValidateKempLoadMasterConnectionCredentialsSchema.and(
+ GenericCreateAppConnectionFieldsSchema(AppConnection.KempLoadMaster, {
+ supportsGateways: true
+ })
+);
+
+export const UpdateKempLoadMasterConnectionSchema = z
+ .object({
+ credentials: KempLoadMasterConnectionBasicAuthCredentialsSchema.optional().describe(
+ AppConnections.UPDATE(AppConnection.KempLoadMaster).credentials
+ )
+ })
+ .and(
+ GenericUpdateAppConnectionFieldsSchema(AppConnection.KempLoadMaster, {
+ supportsGateways: true
+ })
+ );
+
+export const KempLoadMasterConnectionListItemSchema = z
+ .object({
+ name: z.literal("Kemp LoadMaster"),
+ app: z.literal(AppConnection.KempLoadMaster),
+ methods: z.nativeEnum(KempLoadMasterConnectionMethod).array()
+ })
+ .describe(JSON.stringify({ title: APP_CONNECTION_NAME_MAP[AppConnection.KempLoadMaster] }));
diff --git a/backend/src/services/app-connection/kemp-loadmaster/kemp-loadmaster-connection-service.ts b/backend/src/services/app-connection/kemp-loadmaster/kemp-loadmaster-connection-service.ts
new file mode 100644
index 0000000000..5d5f05a17e
--- /dev/null
+++ b/backend/src/services/app-connection/kemp-loadmaster/kemp-loadmaster-connection-service.ts
@@ -0,0 +1,39 @@
+import { TGatewayPoolServiceFactory } from "@app/ee/services/gateway-pool/gateway-pool-service";
+import { TGatewayV2ServiceFactory } from "@app/ee/services/gateway-v2/gateway-v2-service";
+import { OrgServiceActor } from "@app/lib/types";
+import { AppConnection } from "@app/services/app-connection/app-connection-enums";
+
+import { listKempVirtualServices } from "./kemp-loadmaster-connection-fns";
+import { TKempLoadMasterConnection } from "./kemp-loadmaster-connection-types";
+
+type TGetAppConnectionFunc = (
+ app: AppConnection,
+ connectionId: string,
+ actor: OrgServiceActor
+) => Promise<TKempLoadMasterConnection>;
+
+export const kempLoadMasterConnectionService = (
+ getAppConnection: TGetAppConnectionFunc,
+ gatewayV2Service: Pick<TGatewayV2ServiceFactory, "getPlatformConnectionDetailsByGatewayId">,
+ gatewayPoolService: Pick<TGatewayPoolServiceFactory, "resolveEffectiveGatewayId">
+) => {
+ const listVirtualServices = async (connectionId: string, actor: OrgServiceActor) => {
+ const appConnection = await getAppConnection(AppConnection.KempLoadMaster, connectionId, actor);
+
+ const gatewayId = await gatewayPoolService.resolveEffectiveGatewayId({
+ gatewayId: appConnection.gatewayId,
+ gatewayPoolId: appConnection.gatewayPoolId
+ });
+
+ const virtualServices = await listKempVirtualServices(
+ { gatewayId, credentials: appConnection.credentials },
+ gatewayV2Service
+ );
+
+ return virtualServices;
+ };
+
+ return {
+ listVirtualServices
+ };
+};
diff --git a/backend/src/services/app-connection/kemp-loadmaster/kemp-loadmaster-connection-types.ts b/backend/src/services/app-connection/kemp-loadmaster/kemp-loadmaster-connection-types.ts
new file mode 100644
index 0000000000..4856beb53c
--- /dev/null
+++ b/backend/src/services/app-connection/kemp-loadmaster/kemp-loadmaster-connection-types.ts
@@ -0,0 +1,26 @@
+import z from "zod";
+
+import { DiscriminativePick } from "@app/lib/types";
+
+import { AppConnection } from "../app-connection-enums";
+import {
+ CreateKempLoadMasterConnectionSchema,
+ KempLoadMasterConnectionSchema,
+ ValidateKempLoadMasterConnectionCredentialsSchema
+} from "./kemp-loadmaster-connection-schemas";
+
+export type TKempLoadMasterConnection = z.infer<typeof KempLoadMasterConnectionSchema>;
+
+export type TKempLoadMasterConnectionInput = z.infer<typeof CreateKempLoadMasterConnectionSchema> & {
+ app: AppConnection.KempLoadMaster;
+};
+
+export type TValidateKempLoadMasterConnectionCredentialsSchema =
+ typeof ValidateKempLoadMasterConnectionCredentialsSchema;
+
+export type TKempLoadMasterConnectionConfig = DiscriminativePick<
+ TKempLoadMasterConnectionInput,
+ "method" | "app" | "credentials" | "gatewayId" | "gatewayPoolId"
+> & {
+ orgId: string;
+};
diff --git a/backend/src/services/pki-sync/kemp-loadmaster/index.ts b/backend/src/services/pki-sync/kemp-loadmaster/index.ts
new file mode 100644
index 0000000000..48261c8e30
--- /dev/null
+++ b/backend/src/services/pki-sync/kemp-loadmaster/index.ts
@@ -0,0 +1,4 @@
+export * from "./kemp-loadmaster-pki-sync-constants";
+export * from "./kemp-loadmaster-pki-sync-fns";
+export * from "./kemp-loadmaster-pki-sync-schemas";
+export * from "./kemp-loadmaster-pki-sync-types";
diff --git a/backend/src/services/pki-sync/kemp-loadmaster/kemp-loadmaster-pki-sync-constants.ts b/backend/src/services/pki-sync/kemp-loadmaster/kemp-loadmaster-pki-sync-constants.ts
new file mode 100644
index 0000000000..5e4d07de9e
--- /dev/null
+++ b/backend/src/services/pki-sync/kemp-loadmaster/kemp-loadmaster-pki-sync-constants.ts
@@ -0,0 +1,31 @@
+import RE2 from "re2";
+
+import { AppConnection } from "@app/services/app-connection/app-connection-enums";
+import { PkiSync } from "@app/services/pki-sync/pki-sync-enums";
+
+// The LoadMaster stores each cert as `<name>.pem`, so the identifier limit is 251 chars (255 filesystem
+// name limit minus ".pem")
+const KEMP_LOADMASTER_NAME_REGEX_SOURCE = "^[a-zA-Z0-9._-]{1,251}$";
+
+export const KEMP_LOADMASTER_NAMING = {
+ NAME_PATTERN: new RE2(KEMP_LOADMASTER_NAME_REGEX_SOURCE),
+ FORBIDDEN_CHARACTERS: "!@#$%^&*()+=[]{}|\\:;\"'<>,?/~` ",
+ MAX_NAME_LENGTH: 251,
+ MIN_NAME_LENGTH: 1,
+ ALLOWED_CHARACTER_PATTERN: KEMP_LOADMASTER_NAME_REGEX_SOURCE
+} as const;
+
+export const KEMP_LOADMASTER_DEFAULT_CA_NAME_SCHEMA = "Infisical-ca-{{fingerprint}}";
+
+export const KEMP_LOADMASTER_PKI_SYNC_LIST_OPTION = {
+ name: "Kemp LoadMaster" as const,
+ connection: AppConnection.KempLoadMaster,
+ destination: PkiSync.KempLoadMaster,
+ canImportCertificates: false,
+ canRemoveCertificates: true,
+ defaultCertificateNameSchema: "Infisical-{{certificateId}}",
+ forbiddenCharacters: KEMP_LOADMASTER_NAMING.FORBIDDEN_CHARACTERS,
+ allowedCharacterPattern: KEMP_LOADMASTER_NAMING.ALLOWED_CHARACTER_PATTERN,
+ maxCertificateNameLength: KEMP_LOADMASTER_NAMING.MAX_NAME_LENGTH,
+ minCertificateNameLength: KEMP_LOADMASTER_NAMING.MIN_NAME_LENGTH
+} as const;
diff --git a/backend/src/services/pki-sync/kemp-loadmaster/kemp-loadmaster-pki-sync-fns.test.ts b/backend/src/services/pki-sync/kemp-loadmaster/kemp-loadmaster-pki-sync-fns.test.ts
new file mode 100644
index 0000000000..7cc4b7c4bf
--- /dev/null
+++ b/backend/src/services/pki-sync/kemp-loadmaster/kemp-loadmaster-pki-sync-fns.test.ts
@@ -0,0 +1,95 @@
+import {
+ buildCertificateBundle,
+ buildIntermediateIdentifier,
+ buildManagedCertNamePattern,
+ splitPemChain
+} from "./kemp-loadmaster-pki-sync-fns";
+
+const HEX = "550e8400e29b41d4a716446655440000";
+
+// Self-signed test CA with subject CN "Test CA".
+const TEST_CA_PEM = `-----BEGIN CERTIFICATE-----
+MIIDBTCCAe2gAwIBAgIUao3kOQBkH3sANDG5ANZHZxIC1BYwDQYJKoZIhvcNAQEL
+BQAwEjEQMA4GA1UEAwwHVGVzdCBDQTAeFw0yNjA3MTcwMzQ3MjhaFw0yNjA3MTkw
+MzQ3MjhaMBIxEDAOBgNVBAMMB1Rlc3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IB
+DwAwggEKAoIBAQCoSkMNKQB6L9HD+ENlnKFmd+/A8RaDwvcQkPEu5Z/TQSvPAPIv
+sC5a8UKTrXXJ69NuGVmae8TgZlxihv3o0Z2F5/BT3+nYZ2aTbHXCIhlNc4lGa30Q
+4Xrqt39/1XL0ym4r4ehEeqcu4tSD4kAHv1VRAeKGzHrq3M8C2xF6Sk9WDKWm9Gzk
+oFhXdHaoqFSb6wwq5gzdMYZjUTkZSEkpyGXD1TAVihP46vQa1t1oTh30PJ7zpVA9
+7B28Gajwcg7QI+BUcG2xNb1MyfuisDO4I/r/Cc2WMeIy66vY9ZLrEnsuRqGHkAe7
+0iX9EjjZvPJHMRFhJwOjBl7v3m6g73Tg8IpZAgMBAAGjUzBRMB0GA1UdDgQWBBSp
+fMdz2ME+miLUnx9+bKp2wd388jAfBgNVHSMEGDAWgBSpfMdz2ME+miLUnx9+bKp2
+wd388jAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQAF60yyYITU
+NP/lo090LzRfJjyIlbxak5qfTNgSAEjjc83Ta/00rXhUYnzXWVZ3Xk1EDEtiwnor
+CvgSMLonv63+dUx0lXTMPbbz/pRBYYu2rPiRzMzvh/m53WWXZ0QXsRXFamKAs3mB
+gCv8Is6ku7qJ8dIMV5BVpl5iX1GCjRpEXYJLMnVmh/u5ekeiRwrldL+66yacNc6n
+0GNb0XwliIjXpyXWd5SRGhWpANyphjXpTzY5zCm6oAqrqQnf91k7N3lJQz2ugbCM
+KAiy0HrJdJahbGfhFMfEjGSzHaByj+Suki9ufwzq5Bvl0u9OIp9PFPvBZskUYG1T
+cpEmHIN8/vxJ
+-----END CERTIFICATE-----`;
+
+describe("Kemp buildManagedCertNamePattern (orphan cleanup detection)", () => {
+ test("default pattern matches Infisical names and renewal suffixes, not unrelated certs", () => {
+ const pattern = buildManagedCertNamePattern(undefined);
+ expect(pattern.test(`Infisical-${HEX}`)).toBe(true);
+ expect(pattern.test(`Infisical-${HEX}-1`)).toBe(true);
+ expect(pattern.test("wildcard-prod-cert")).toBe(false);
+ expect(pattern.test(`Other-${HEX}`)).toBe(false);
+ });
+
+ test("schema-based pattern anchors on the resolved placeholders", () => {
+ const pattern = buildManagedCertNamePattern("Infisical-{{certificateId}}");
+ expect(pattern.test(`Infisical-${HEX}`)).toBe(true);
+ expect(pattern.test("Infisical-notavalidid")).toBe(false);
+ });
+});
+
+describe("Kemp splitPemChain", () => {
+ test("returns an empty array for missing or empty chains", () => {
+ expect(splitPemChain(undefined)).toEqual([]);
+ expect(splitPemChain("")).toEqual([]);
+ });
+
+ test("returns each CERTIFICATE block for single and multi-CA chains", () => {
+ expect(splitPemChain(TEST_CA_PEM)).toHaveLength(1);
+ expect(splitPemChain(`${TEST_CA_PEM}\n${TEST_CA_PEM}`)).toHaveLength(2);
+ });
+
+ test("ignores non-certificate PEM blocks (e.g. private keys)", () => {
+ const withKey = `${TEST_CA_PEM}\n-----BEGIN PRIVATE KEY-----\nabc\n-----END PRIVATE KEY-----`;
+ expect(splitPemChain(withKey)).toHaveLength(1);
+ });
+});
+
+describe("Kemp buildCertificateBundle", () => {
+ test("bundles cert + key when no chain is present", () => {
+ const bundle = buildCertificateBundle("CERT", "KEY");
+ expect(bundle).toBe("CERT\nKEY\n");
+ });
+
+ test("includes the chain between the leaf and the key when present", () => {
+ const bundle = buildCertificateBundle("CERT", "KEY", "CHAIN");
+ expect(bundle).toBe("CERT\nCHAIN\nKEY\n");
+ });
+});
+
+describe("Kemp buildIntermediateIdentifier", () => {
+ test("compiles {{fingerprint}} to a stable, content-addressed 24-char hex", () => {
+ const a = buildIntermediateIdentifier(TEST_CA_PEM, "Infisical-ca-{{fingerprint}}");
+ const b = buildIntermediateIdentifier(TEST_CA_PEM, "Infisical-ca-{{fingerprint}}");
+ expect(a).toBe(b);
+ expect(a).toMatch(/^Infisical-ca-[0-9a-f]{24}$/);
+ expect(buildIntermediateIdentifier("different-content", "Infisical-ca-{{fingerprint}}")).not.toBe(a);
+ });
+
+ test("compiles {{commonName}} from the certificate subject, sanitizing to Kemp-safe characters", () => {
+ // CN is "Test CA"; the space is sanitized to a dash.
+ expect(buildIntermediateIdentifier(TEST_CA_PEM, "{{commonName}}-{{fingerprint}}")).toMatch(
+ /^Test-CA-[0-9a-f]{24}$/
+ );
+ });
+
+ test("falls back to 'ca' for {{commonName}} when the certificate cannot be parsed", () => {
+ expect(buildIntermediateIdentifier("not-a-real-pem", "{{commonName}}")).toBe("ca");
+ });
+});
diff --git a/backend/src/services/pki-sync/kemp-loadmaster/kemp-loadmaster-pki-sync-fns.ts b/backend/src/services/pki-sync/kemp-loadmaster/kemp-loadmaster-pki-sync-fns.ts
new file mode 100644
index 0000000000..00f478ea44
--- /dev/null
+++ b/backend/src/services/pki-sync/kemp-loadmaster/kemp-loadmaster-pki-sync-fns.ts
@@ -0,0 +1,800 @@
+/* eslint-disable no-await-in-loop */
+import { AxiosError } from "axios";
+import { createHash } from "crypto";
+import forge from "node-forge";
+import RE2 from "re2";
+
+import { TCertificateSyncs } from "@app/db/schemas";
+import { TGatewayPoolServiceFactory } from "@app/ee/services/gateway-pool/gateway-pool-service";
+import { TGatewayV2ServiceFactory } from "@app/ee/services/gateway-v2/gateway-v2-service";
+import { logger } from "@app/lib/logger";
+import {
+ executeKempLoadMasterOperationWithGateway,
+ getKempAuthHeaders,
+ getKempBaseUrl,
+ parseKempResponse,
+ TKempRequestFn
+} from "@app/services/app-connection/kemp-loadmaster/kemp-loadmaster-connection-fns";
+import { TKempLoadMasterConnection } from "@app/services/app-connection/kemp-loadmaster/kemp-loadmaster-connection-types";
+import { TCertificateDALFactory } from "@app/services/certificate/certificate-dal";
+import { TCertificateSyncDALFactory } from "@app/services/certificate-sync/certificate-sync-dal";
+import { CertificateSyncStatus } from "@app/services/certificate-sync/certificate-sync-enums";
+import { TCertificateMap } from "@app/services/pki-sync/pki-sync-types";
+
+import {
+ buildManagedCertificateNameRegexSource,
+ certificateNameSchemaHasFreeTextPlaceholder,
+ compileCertificateNameSchema,
+ SHORT_UUID_NAME_REGEX_FRAGMENT,
+ UUID_NAME_REGEX_FRAGMENT
+} from "../pki-sync-certificate-name-fns";
+import { PkiSync } from "../pki-sync-enums";
+import { PkiSyncError } from "../pki-sync-errors";
+import { TPkiSyncWithCredentials } from "../pki-sync-types";
+import { KEMP_LOADMASTER_DEFAULT_CA_NAME_SCHEMA } from "./kemp-loadmaster-pki-sync-constants";
+import { TKempLoadMasterPkiSyncConfig } from "./kemp-loadmaster-pki-sync-types";
+
+type TKempCredentials = TKempLoadMasterConnection["credentials"];
+
+type TKempLoadMasterPkiSyncFactoryDeps = {
+ certificateSyncDAL: Pick<
+ TCertificateSyncDALFactory,
+ | "removeCertificates"
+ | "addCertificates"
+ | "findByPkiSyncAndCertificate"
+ | "updateById"
+ | "findByPkiSyncId"
+ | "updateSyncStatus"
+ >;
+ certificateDAL: Pick<TCertificateDALFactory, "findById">;
+ gatewayV2Service?: Pick<TGatewayV2ServiceFactory, "getPlatformConnectionDetailsByGatewayId">;
+ gatewayPoolService?: Pick<TGatewayPoolServiceFactory, "resolveEffectiveGatewayId">;
+};
+
+const getKempCredentials = (pkiSync: TPkiSyncWithCredentials): TKempCredentials => {
+ const credentials = pkiSync.connection.credentials as TKempCredentials;
+ if (!credentials?.hostname || !credentials?.username || !credentials?.password) {
+ throw new PkiSyncError({
+ message: "Kemp LoadMaster credentials (hostname, username, password) not found in connection credentials"
+ });
+ }
+ return credentials;
+};
+
+export const buildCertificateBundle = (cert: string, privateKey: string, certificateChain?: string): string => {
+ const parts = [cert.trim()];
+ if (certificateChain) {
+ parts.push(certificateChain.trim());
+ }
+ parts.push(privateKey.trim());
+ return `${parts.join("\n")}\n`;
+};
+
+const PEM_CERT_BLOCK = new RE2("-----BEGIN CERTIFICATE-----[\\s\\S]*?-----END CERTIFICATE-----", "g");
+const WHITESPACE_SPLIT = new RE2("\\s+");
+
+export const splitPemChain = (chainPem?: string): string[] => {
+ if (!chainPem) return [];
+ return chainPem.match(PEM_CERT_BLOCK) ?? [];
+};
+
+const extractCertNames = (data: unknown): Set<string> => {
+ const names = new Set<string>();
+ const certs = (data as { cert?: unknown } | undefined)?.cert;
+ if (certs) {
+ const list = Array.isArray(certs) ? certs : [certs];
+ for (const cert of list) {
+ const name = (cert as { name?: unknown })?.name;
+ if (name !== undefined && name !== null) {
+ names.add(String(name));
+ }
+ }
+ }
+ return names;
+};
+
+const DASH_GLOBAL = new RE2("-", "g");
+const CA_NAME_SANITIZE = new RE2("[^a-zA-Z0-9._-]", "g");
+const CA_FINGERPRINT_PLACEHOLDER = new RE2("\\{\\{fingerprint\\}\\}", "g");
+const CA_COMMON_NAME_PLACEHOLDER = new RE2("\\{\\{commonName\\}\\}", "g");
+
+// The LoadMaster keeps intermediate/CA certs in a store separate from leaf certs and builds the
+// served chain from it.
+export const buildIntermediateIdentifier = (certPem: string, nameSchema: string): string => {
+ const fingerprint = createHash("sha256").update(certPem.trim()).digest("hex").slice(0, 24);
+
+ let commonName = "ca";
+ try {
+ const cnField = forge.pki.certificateFromPem(certPem).subject.getField("CN") as { value?: unknown } | null;
+ const cn = cnField?.value;
+ if (cn) commonName = String(cn);
+ } catch {
+ // unparseable CA falls back to the generic "ca" label
+ }
+
+ return nameSchema
+ .replace(CA_FINGERPRINT_PLACEHOLDER, fingerprint)
+ .replace(CA_COMMON_NAME_PLACEHOLDER, commonName.replace(CA_NAME_SANITIZE, "-"));
+};
+
+const kempError = (error: unknown, fallback: string): string => {
+ if (error instanceof AxiosError) {
+ if (error.response?.status === 401) return "invalid username or password";
+ if (error.response?.status === 404) return "the LoadMaster API interface is not enabled";
+ return error.message;
+ }
+ if (error instanceof Error) return error.message;
+ return fallback;
+};
+
+export const buildManagedCertNamePattern = (certificateNameSchema: string | undefined): RE2 => {
+ if (!certificateNameSchema) {
+ return new RE2("^Infisical-[0-9a-f]{32}(-[a-zA-Z0-9]*)?$");
+ }
+
+ // {{certificateId}}, {{profileId}}, and {{applicationId}} resolve to 32-char dash-stripped UUIDs;
+ // {{shortCertificateId}} resolves to a 22-char base62 string.
+ // {{commonName}} and {{applicationName}} are arbitrary, so match any run of Kemp-safe characters.
+ const pattern = buildManagedCertificateNameRegexSource(certificateNameSchema, {
+ uuid: UUID_NAME_REGEX_FRAGMENT,
+ shortUuid: SHORT_UUID_NAME_REGEX_FRAGMENT,
+ freeText: "[a-zA-Z0-9._-]*"
+ });
+
+ return new RE2(`^${pattern}$`);
+};
+
+export const kempLoadMasterPkiSyncFactory = ({
+ certificateSyncDAL,
+ certificateDAL,
+ gatewayV2Service,
+ gatewayPoolService
+}: TKempLoadMasterPkiSyncFactoryDeps) => {
+ const resolveGateway = async (pkiSync: TPkiSyncWithCredentials) => {
+ return gatewayPoolService
+ ? gatewayPoolService.resolveEffectiveGatewayId({
+ gatewayId: pkiSync.connection.gatewayId,
+ gatewayPoolId: pkiSync.connection.gatewayPoolId
+ })
+ : (pkiSync.connection.gatewayId ?? null);
+ };
+
+ const listCertificateIdentifiers = async (
+ makeRequest: TKempRequestFn,
+ baseUrl: string,
+ headers: Record<string, string>
+ ): Promise<Set<string>> => {
+ const payload = await makeRequest<string>({
+ method: "GET",
+ url: `${baseUrl}/access/listcert`,
+ headers,
+ responseType: "text"
+ });
+
+ const parsed = parseKempResponse(payload);
+ if (!parsed.ok) {
+ throw new PkiSyncError({
+ message: `Failed to list certificates on Kemp LoadMaster: ${parsed.error || "unexpected response"}`,
+ shouldRetry: true
+ });
+ }
+
+ return extractCertNames(parsed.data);
+ };
+
+ const upsertCertificate = async (
+ makeRequest: TKempRequestFn,
+ baseUrl: string,
+ headers: Record<string, string>,
+ identifier: string,
+ bundle: string,
+ exists: boolean
+ ): Promise<void> => {
+ // The LoadMaster rejects replace=1 for an identifier that does not yet exist, so replace is only
+ // set when the identifier is already present.
+ const replaceParam = exists ? "&replace=1" : "";
+ const payload = await makeRequest<string>({
+ method: "POST",
+ url: `${baseUrl}/access/addcert?cert=${encodeURIComponent(identifier)}${replaceParam}`,
+ data: bundle,
+ headers: { ...headers, "Content-Type": "application/octet-stream" },
+ responseType: "text"
+ });
+
+ const parsed = parseKempResponse(payload);
+ if (!parsed.ok) {
+ throw new PkiSyncError({ message: parsed.error || "Failed to import certificate to Kemp LoadMaster" });
+ }
+ };
+
+ const listIntermediateIdentifiers = async (
+ makeRequest: TKempRequestFn,
+ baseUrl: string,
+ headers: Record<string, string>
+ ): Promise<Set<string>> => {
+ const payload = await makeRequest<string>({
+ method: "GET",
+ url: `${baseUrl}/access/listintermediate`,
+ headers,
+ responseType: "text"
+ });
+
+ const parsed = parseKempResponse(payload);
+ if (!parsed.ok) return new Set<string>();
+
+ return extractCertNames(parsed.data);
+ };
+
+ const addIntermediateCertificate = async (
+ makeRequest: TKempRequestFn,
+ baseUrl: string,
+ headers: Record<string, string>,
+ identifier: string,
+ certPem: string
+ ): Promise<void> => {
+ const payload = await makeRequest<string>({
+ method: "POST",
+ url: `${baseUrl}/access/addintermediate?cert=${encodeURIComponent(identifier)}`,
+ data: certPem,
+ headers: { ...headers, "Content-Type": "application/octet-stream" },
+ responseType: "text"
+ });
+
+ const parsed = parseKempResponse(payload);
+ // The LoadMaster refuses to overwrite an existing intermediate ("already exists")
+ if (!parsed.ok && !(parsed.error ?? "").toLowerCase().includes("exists")) {
+ throw new PkiSyncError({ message: parsed.error || "Failed to import intermediate certificate" });
+ }
+ };
+
+ const deleteCertificate = async (
+ makeRequest: TKempRequestFn,
+ baseUrl: string,
+ headers: Record<string, string>,
+ identifier: string
+ ): Promise<void> => {
+ const payload = await makeRequest<string>({
+ method: "GET",
+ url: `${baseUrl}/access/delcert?cert=${encodeURIComponent(identifier)}`,
+ headers,
+ responseType: "text"
+ });
+
+ const parsed = parseKempResponse(payload);
+ if (!parsed.ok) {
+ throw new PkiSyncError({ message: parsed.error || "Failed to delete certificate from Kemp LoadMaster" });
+ }
+ };
+
+ const getVirtualServiceCertFiles = async (
+ makeRequest: TKempRequestFn,
+ baseUrl: string,
+ headers: Record<string, string>,
+ virtualServiceId: string
+ ): Promise<string[]> => {
+ const payload = await makeRequest<string>({
+ method: "GET",
+ url: `${baseUrl}/access/showvs?vs=${encodeURIComponent(virtualServiceId)}`,
+ headers,
+ responseType: "text"
+ });
+
+ const parsed = parseKempResponse(payload);
+ if (!parsed.ok) {
+ throw new PkiSyncError({
+ message: `Failed to read Virtual Service ${virtualServiceId} on Kemp LoadMaster: ${parsed.error || "unexpected response"}`
+ });
+ }
+
+ const certFile = (parsed.data as { CertFile?: unknown } | undefined)?.CertFile;
+ if (certFile === undefined || certFile === null || certFile === "") {
+ return [];
+ }
+ return String(certFile)
+ .split(WHITESPACE_SPLIT)
+ .map((entry) => entry.trim())
+ .filter(Boolean);
+ };
+
+ const setVirtualServiceCertFiles = async (
+ makeRequest: TKempRequestFn,
+ baseUrl: string,
+ headers: Record<string, string>,
+ virtualServiceId: string,
+ certFiles: string[]
+ ): Promise<void> => {
+ const payload = await makeRequest<string>({
+ method: "GET",
+ url: `${baseUrl}/access/modvs?vs=${encodeURIComponent(virtualServiceId)}&certfile=${encodeURIComponent(
+ certFiles.join(" ")
+ )}`,
+ headers,
+ responseType: "text"
+ });
+
+ const parsed = parseKempResponse(payload);
+ if (!parsed.ok) {
+ throw new PkiSyncError({
+ message: `Failed to bind certificates to Virtual Service ${virtualServiceId}: ${parsed.error || "unexpected response"}`
+ });
+ }
+ };
+
+ const reconcileVirtualServiceBinding = async (
+ makeRequest: TKempRequestFn,
+ baseUrl: string,
+ headers: Record<string, string>,
+ virtualServiceId: string,
+ activeIdentifiers: Set<string>,
+ managedIdentifiers: Set<string>,
+ canRemoveCertificates: boolean,
+ storedCertNames: Set<string>
+ ): Promise<void> => {
+ const current = await getVirtualServiceCertFiles(makeRequest, baseUrl, headers, virtualServiceId);
+
+ // A Virtual Service with SSL turned on but no real certificate shows a temporary self-signed
+ // placeholder that is not a stored certificate. Sending that placeholder back would make the
+ // LoadMaster reject the whole update, so we keep only certificates that exist in the store.
+ const preserved = current.filter(
+ (entry) => storedCertNames.has(entry) && (!canRemoveCertificates || !managedIdentifiers.has(entry))
+ );
+
+ const desired: string[] = [];
+ const seen = new Set<string>();
+ for (const entry of [...preserved, ...activeIdentifiers]) {
+ if (!seen.has(entry)) {
+ seen.add(entry);
+ desired.push(entry);
+ }
+ }
+
+ const unchanged = desired.length === current.length && desired.every((entry, idx) => entry === current[idx]);
+ if (unchanged) {
+ return;
+ }
+
+ await setVirtualServiceCertFiles(makeRequest, baseUrl, headers, virtualServiceId, desired);
+ };
+
+ const syncCertificates = async (
+ pkiSync: TPkiSyncWithCredentials,
+ certificateMap: TCertificateMap
+ ): Promise<{
+ uploaded: number;
+ removed?: number;
+ failedRemovals?: number;
+ skipped: number;
+ details?: {
+ failedUploads?: Array<{ name: string; error: string }>;
+ failedRemovals?: Array<{ name: string; error: string }>;
+ skippedCertificates?: Array<{ name: string; reason: string }>;
+ };
+ }> => {
+ const credentials = getKempCredentials(pkiSync);
+ const config = pkiSync.destinationConfig as TKempLoadMasterPkiSyncConfig;
+ const syncOptions = pkiSync.syncOptions as
+ | {
+ certificateNameSchema?: string;
+ canRemoveCertificates?: boolean;
+ preserveItemOnRenewal?: boolean;
+ syncCaCertificates?: boolean;
+ caCertificateNameSchema?: string;
+ }
+ | undefined;
+ const syncCaCertificates = syncOptions?.syncCaCertificates ?? true;
+ const caCertificateNameSchema = syncOptions?.caCertificateNameSchema || KEMP_LOADMASTER_DEFAULT_CA_NAME_SCHEMA;
+ const canRemoveCertificates = syncOptions?.canRemoveCertificates ?? true;
+ const preserveItemOnRenewal = syncOptions?.preserveItemOnRenewal ?? true;
+ const certificateNameSchema = syncOptions?.certificateNameSchema;
+ const { virtualServiceId } = config;
+
+ const baseUrl = getKempBaseUrl(credentials);
+ const headers = getKempAuthHeaders(credentials);
+ const effectiveGatewayId = await resolveGateway(pkiSync);
+
+ return executeKempLoadMasterOperationWithGateway(
+ { gatewayId: effectiveGatewayId, credentials },
+ gatewayV2Service,
+ async (makeRequest) => {
+ let uploaded = 0;
+ let removed = 0;
+ const failedUploads: Array<{ name: string; error: string }> = [];
+ const failedRemovals: Array<{ name: string; error: string }> = [];
+ const skippedCertificates: Array<{ name: string; reason: string }> = [];
+ const failedIntermediateIds = new Set<string>();
+
+ const existingCertNames = await listCertificateIdentifiers(makeRequest, baseUrl, headers);
+
+ const existingSyncRecords = await certificateSyncDAL.findByPkiSyncId(pkiSync.id);
+ const syncRecordsByCertId = new Map<string, TCertificateSyncs>();
+ existingSyncRecords.forEach((record: TCertificateSyncs) => {
+ if (record.certificateId) {
+ syncRecordsByCertId.set(record.certificateId, record);
+ }
+ });
+
+ const activeIdentifiers = new Set<string>();
+ const managedIdentifiers = new Set<string>();
+ existingSyncRecords.forEach((record) => {
+ if (record.externalIdentifier) {
+ managedIdentifiers.add(record.externalIdentifier);
+ }
+ });
+
+ const certificatesToUpload: Array<{
+ targetIdentifier: string;
+ cert: string;
+ privateKey: string;
+ certificateChain?: string;
+ certificateId?: string;
+ isUpdate: boolean;
+ oldCertificateIdToRemove?: string;
+ }> = [];
+
+ for (const [certName, certData] of Object.entries(certificateMap)) {
+ const { cert, privateKey, certificateChain, certificateId } = certData;
+
+ if (!cert || !privateKey) {
+ skippedCertificates.push({ name: certName, reason: "Missing certificate or private key data" });
+ // eslint-disable-next-line no-continue
+ continue;
+ }
+
+ let certificate: Awaited<ReturnType<typeof certificateDAL.findById>> | undefined;
+ if (typeof certificateId === "string") {
+ certificate = await certificateDAL.findById(certificateId);
+ if (certificate?.renewedByCertificateId) {
+ skippedCertificates.push({
+ name: certName,
+ reason: "Certificate has been renewed and replaced by a newer certificate"
+ });
+ // eslint-disable-next-line no-continue
+ continue;
+ }
+ }
+
+ let targetIdentifier = certName;
+ let isUpdate = false;
+ let oldCertificateIdToRemove: string | undefined;
+
+ if (typeof certificateId === "string") {
+ const syncRecordLookupId = certificate?.renewedFromCertificateId || certificateId;
+ const existingSyncRecord = syncRecordsByCertId.get(syncRecordLookupId);
+
+ if (
+ certificate?.renewedFromCertificateId &&
+ preserveItemOnRenewal &&
+ existingSyncRecord?.externalIdentifier
+ ) {
+ targetIdentifier = existingSyncRecord.externalIdentifier;
+ isUpdate = true;
+ oldCertificateIdToRemove = certificate.renewedFromCertificateId;
+ } else if (certificate?.renewedFromCertificateId && !preserveItemOnRenewal) {
+ if (certificateNameSchema) {
+ targetIdentifier = compileCertificateNameSchema(
+ certificateNameSchema,
+ {
+ certificateId,
+ profileId: certData.profileId,
+ applicationId: pkiSync.applicationId,
+ applicationName: pkiSync.applicationName,
+ commonName: certData.commonName
+ },
+ PkiSync.KempLoadMaster
+ );
+ } else {
+ targetIdentifier = `Infisical-${certificateId.replace(DASH_GLOBAL, "")}`;
+ }
+ } else {
+ const directSyncRecord = syncRecordsByCertId.get(certificateId);
+ if (directSyncRecord?.externalIdentifier && existingCertNames.has(directSyncRecord.externalIdentifier)) {
+ targetIdentifier = directSyncRecord.externalIdentifier;
+ isUpdate = true;
+ }
+ }
+ }
+
+ certificatesToUpload.push({
+ targetIdentifier,
+ cert,
+ privateKey,
+ certificateChain,
+ certificateId,
+ isUpdate,
+ oldCertificateIdToRemove
+ });
+ }
+
+ // Push each chain/CA cert into the LoadMaster's dedicated intermediate store
+ if (syncCaCertificates) {
+ const existingIntermediateNames = await listIntermediateIdentifiers(makeRequest, baseUrl, headers);
+ const processedIntermediates = new Set<string>();
+ for (const { certificateChain } of certificatesToUpload) {
+ for (const intermediatePem of splitPemChain(certificateChain)) {
+ const intermediateId = buildIntermediateIdentifier(intermediatePem, caCertificateNameSchema);
+ if (processedIntermediates.has(intermediateId) || existingIntermediateNames.has(intermediateId)) {
+ // eslint-disable-next-line no-continue
+ continue;
+ }
+ processedIntermediates.add(intermediateId);
+ try {
+ await addIntermediateCertificate(makeRequest, baseUrl, headers, intermediateId, intermediatePem);
+ existingIntermediateNames.add(intermediateId);
+ logger.info(
+ `Kemp LoadMaster PKI sync [syncId=${pkiSync.id}]: ensured intermediate "${intermediateId}" on ${credentials.hostname}`
+ );
+ } catch (error: unknown) {
+ failedIntermediateIds.add(intermediateId);
+ logger.error(
+ { error },
+ `Kemp LoadMaster PKI sync [syncId=${pkiSync.id}]: failed to import intermediate "${intermediateId}"`
+ );
+ }
+ }
+ }
+ }
+
+ for (const {
+ targetIdentifier,
+ cert,
+ privateKey,
+ certificateChain,
+ certificateId,
+ isUpdate,
+ oldCertificateIdToRemove
+ } of certificatesToUpload) {
+ try {
+ const bundle = buildCertificateBundle(cert, privateKey, certificateChain);
+ await upsertCertificate(
+ makeRequest,
+ baseUrl,
+ headers,
+ targetIdentifier,
+ bundle,
+ existingCertNames.has(targetIdentifier)
+ );
+
+ existingCertNames.add(targetIdentifier);
+ activeIdentifiers.add(targetIdentifier);
+ managedIdentifiers.add(targetIdentifier);
+
+ const failedChainCaNames = failedIntermediateIds.size
+ ? splitPemChain(certificateChain)
+ .map((pem) => buildIntermediateIdentifier(pem, caCertificateNameSchema))
+ .filter((id) => failedIntermediateIds.has(id))
+ : [];
+ const caWarning = failedChainCaNames.length
+ ? ` (warning: could not push CA certificate(s) to the intermediate store: ${failedChainCaNames.join(", ")})`
+ : "";
+
+ if (certificateId) {
+ const existingCertSync = await certificateSyncDAL.findByPkiSyncAndCertificate(pkiSync.id, certificateId);
+
+ if (existingCertSync) {
+ await certificateSyncDAL.updateById(existingCertSync.id, {
+ externalIdentifier: targetIdentifier,
+ syncStatus: CertificateSyncStatus.Succeeded,
+ lastSyncMessage: `${
+ isUpdate
+ ? `Updated certificate on Kemp LoadMaster as "${targetIdentifier}"`
+ : `Synced certificate to Kemp LoadMaster as "${targetIdentifier}"`
+ }${caWarning}`,
+ lastSyncedAt: new Date()
+ });
+ } else {
+ await certificateSyncDAL.addCertificates(pkiSync.id, [
+ { certificateId, externalIdentifier: targetIdentifier }
+ ]);
+ }
+
+ if (oldCertificateIdToRemove) {
+ await certificateSyncDAL.removeCertificates(pkiSync.id, [oldCertificateIdToRemove]);
+ }
+ }
+
+ uploaded += 1;
+
+ logger.info(
+ `Kemp LoadMaster PKI sync [syncId=${pkiSync.id}]: ${isUpdate ? "updated" : "uploaded"} certificate "${targetIdentifier}" on ${credentials.hostname}`
+ );
+ } catch (error: unknown) {
+ const errorMessage = kempError(error, "Unknown error");
+ failedUploads.push({ name: targetIdentifier, error: errorMessage });
+
+ if (certificateId) {
+ const syncRecord = await certificateSyncDAL.findByPkiSyncAndCertificate(pkiSync.id, certificateId);
+ if (syncRecord) {
+ await certificateSyncDAL.updateById(syncRecord.id, {
+ syncStatus: CertificateSyncStatus.Failed,
+ lastSyncMessage: `Failed to sync to Kemp LoadMaster: ${errorMessage}`.slice(0, 4096)
+ });
+ }
+ }
+
+ logger.error(
+ { error },
+ `Kemp LoadMaster PKI sync [syncId=${pkiSync.id}]: failed to upload certificate "${targetIdentifier}"`
+ );
+ }
+ }
+
+ const identifiersToRemove = new Set<string>();
+ if (canRemoveCertificates) {
+ for (const syncRecord of existingSyncRecords) {
+ if (
+ syncRecord.externalIdentifier &&
+ !activeIdentifiers.has(syncRecord.externalIdentifier) &&
+ existingCertNames.has(syncRecord.externalIdentifier)
+ ) {
+ identifiersToRemove.add(syncRecord.externalIdentifier);
+ }
+ }
+
+ if (!certificateNameSchemaHasFreeTextPlaceholder(certificateNameSchema)) {
+ const managedCertNamePattern = buildManagedCertNamePattern(certificateNameSchema);
+ for (const certName of existingCertNames) {
+ if (managedCertNamePattern.test(certName) && !activeIdentifiers.has(certName)) {
+ identifiersToRemove.add(certName);
+ }
+ }
+ }
+
+ identifiersToRemove.forEach((identifier) => managedIdentifiers.add(identifier));
+ }
+
+ // Reconcile the Virtual Service binding BEFORE deleting: the LoadMaster refuses to delete a
+ // certificate that is still bound, so removed certificates must be unbound here first.
+ let virtualServiceBindingError: string | undefined;
+ if (virtualServiceId) {
+ try {
+ await reconcileVirtualServiceBinding(
+ makeRequest,
+ baseUrl,
+ headers,
+ virtualServiceId,
+ activeIdentifiers,
+ managedIdentifiers,
+ canRemoveCertificates,
+ existingCertNames
+ );
+ } catch (error: unknown) {
+ virtualServiceBindingError = kempError(error, "Failed to bind certificates to the Virtual Service");
+ logger.error(
+ { error },
+ `Kemp LoadMaster PKI sync [syncId=${pkiSync.id}]: failed to bind certificates to Virtual Service ${virtualServiceId}`
+ );
+ }
+ }
+
+ for (const identifier of identifiersToRemove) {
+ try {
+ await deleteCertificate(makeRequest, baseUrl, headers, identifier);
+ removed += 1;
+
+ logger.info(
+ `Kemp LoadMaster PKI sync [syncId=${pkiSync.id}]: removed orphaned certificate "${identifier}" from ${credentials.hostname}`
+ );
+ } catch (error: unknown) {
+ failedRemovals.push({ name: identifier, error: kempError(error, "Unknown error") });
+ logger.error(
+ { error },
+ `Kemp LoadMaster PKI sync [syncId=${pkiSync.id}]: failed to remove certificate "${identifier}"`
+ );
+ }
+ }
+
+ // Leaves are already uploaded, so a binding failure can't block them; but it must surface as a
+ // failed sync
+ if (virtualServiceBindingError) {
+ throw new PkiSyncError({
+ message: `Failed to bind certificates to Virtual Service ${virtualServiceId}: ${virtualServiceBindingError}`,
+ shouldRetry: false
+ });
+ }
+
+ return {
+ uploaded,
+ removed: removed > 0 ? removed : undefined,
+ failedRemovals: failedRemovals.length > 0 ? failedRemovals.length : undefined,
+ skipped: skippedCertificates.length,
+ details: {
+ failedUploads: failedUploads.length > 0 ? failedUploads : undefined,
+ failedRemovals: failedRemovals.length > 0 ? failedRemovals : undefined,
+ skippedCertificates: skippedCertificates.length > 0 ? skippedCertificates : undefined
+ }
+ };
+ }
+ );
+ };
+
+ const removeCertificates = async (
+ pkiSync: TPkiSyncWithCredentials,
+ certificateNames: string[],
+ deps?: {
+ certificateSyncDAL?: Pick<TCertificateSyncDALFactory, "findByPkiSyncId">;
+ certificateMap?: TCertificateMap;
+ }
+ ): Promise<void> => {
+ if (certificateNames.length === 0) return;
+
+ const credentials = getKempCredentials(pkiSync);
+ const config = pkiSync.destinationConfig as TKempLoadMasterPkiSyncConfig;
+ const { virtualServiceId } = config;
+
+ const existingSyncRecords = await certificateSyncDAL.findByPkiSyncId(pkiSync.id);
+ const identifiersToRemove: string[] = [];
+ const certificateIdsToClean: string[] = [];
+
+ for (const certName of certificateNames) {
+ const certificateId = deps?.certificateMap?.[certName]?.certificateId;
+ if (certificateId) {
+ const syncRecord = existingSyncRecords.find((record) => record.certificateId === certificateId);
+ if (syncRecord?.externalIdentifier) {
+ identifiersToRemove.push(syncRecord.externalIdentifier);
+ certificateIdsToClean.push(certificateId);
+ }
+ }
+ }
+
+ if (identifiersToRemove.length === 0) {
+ return;
+ }
+
+ const baseUrl = getKempBaseUrl(credentials);
+ const headers = getKempAuthHeaders(credentials);
+ const effectiveGatewayId = await resolveGateway(pkiSync);
+
+ await executeKempLoadMasterOperationWithGateway(
+ { gatewayId: effectiveGatewayId, credentials },
+ gatewayV2Service,
+ async (makeRequest) => {
+ if (virtualServiceId) {
+ try {
+ const current = await getVirtualServiceCertFiles(makeRequest, baseUrl, headers, virtualServiceId);
+ const removalSet = new Set(identifiersToRemove);
+ const desired = current.filter((entry) => !removalSet.has(entry));
+ if (desired.length !== current.length) {
+ await setVirtualServiceCertFiles(makeRequest, baseUrl, headers, virtualServiceId, desired);
+ }
+ } catch (error: unknown) {
+ logger.error(
+ { error },
+ `Kemp LoadMaster PKI sync [syncId=${pkiSync.id}]: failed to unbind certificates from Virtual Service ${virtualServiceId}`
+ );
+ }
+ }
+
+ for (const identifier of identifiersToRemove) {
+ try {
+ await deleteCertificate(makeRequest, baseUrl, headers, identifier);
+ logger.info(
+ `Kemp LoadMaster PKI sync [syncId=${pkiSync.id}]: removed certificate "${identifier}" from ${credentials.hostname}`
+ );
+ } catch (error: unknown) {
+ const message = kempError(error, "Unknown error");
+ if (message.toLowerCase().includes("has been deleted") || message.toLowerCase().includes("not found")) {
+ logger.info(
+ `Kemp LoadMaster PKI sync [syncId=${pkiSync.id}]: certificate "${identifier}" already removed from ${credentials.hostname}`
+ );
+ // eslint-disable-next-line no-continue
+ continue;
+ }
+ throw new PkiSyncError({
+ message: `Failed to remove certificate "${identifier}" from Kemp LoadMaster: ${message}`,
+ shouldRetry: true
+ });
+ }
+ }
+ }
+ );
+
+ if (certificateIdsToClean.length > 0) {
+ await certificateSyncDAL.removeCertificates(pkiSync.id, certificateIdsToClean);
+ }
+ };
+
+ return {
+ syncCertificates,
+ removeCertificates
+ };
+};
diff --git a/backend/src/services/pki-sync/kemp-loadmaster/kemp-loadmaster-pki-sync-schemas.test.ts b/backend/src/services/pki-sync/kemp-loadmaster/kemp-loadmaster-pki-sync-schemas.test.ts
new file mode 100644
index 0000000000..a50edb854a
--- /dev/null
+++ b/backend/src/services/pki-sync/kemp-loadmaster/kemp-loadmaster-pki-sync-schemas.test.ts
@@ -0,0 +1,72 @@
+import {
+ KempLoadMasterPkiSyncConfigSchema,
+ KempLoadMasterPkiSyncOptionsSchema
+} from "./kemp-loadmaster-pki-sync-schemas";
+
+const parseOptions = (overrides: Record<string, unknown>) =>
+ KempLoadMasterPkiSyncOptionsSchema.safeParse({ certificateNameSchema: "Infisical-{{certificateId}}", ...overrides });
+
+describe("Kemp LoadMaster certificateNameSchema validation", () => {
+ const accepts = (certificateNameSchema: string) =>
+ KempLoadMasterPkiSyncOptionsSchema.safeParse({ certificateNameSchema }).success;
+
+ test("accepts the supported placeholders", () => {
+ expect(accepts("Infisical-{{certificateId}}")).toBe(true);
+ expect(accepts("{{commonName}}-{{certificateId}}")).toBe(true);
+ expect(accepts("{{shortCertificateId}}")).toBe(true);
+ expect(accepts("static-name")).toBe(true);
+ });
+
+ test("rejects characters the LoadMaster forbids", () => {
+ expect(accepts("*-{{certificateId}}")).toBe(false);
+ expect(accepts("cert with space")).toBe(false);
+ expect(accepts("cert/slash")).toBe(false);
+ });
+
+ test("rejects identifiers longer than 251 characters", () => {
+ expect(accepts("a".repeat(251))).toBe(true);
+ expect(accepts("a".repeat(252))).toBe(false);
+ });
+});
+
+describe("Kemp LoadMaster caCertificateNameSchema + syncCaCertificates", () => {
+ const acceptsCa = (caCertificateNameSchema: string) => parseOptions({ caCertificateNameSchema }).success;
+
+ test("applies sensible defaults when omitted", () => {
+ const result = parseOptions({});
+ expect(result.success).toBe(true);
+ if (result.success) {
+ expect(result.data.syncCaCertificates).toBe(true);
+ expect(result.data.caCertificateNameSchema).toBe("Infisical-ca-{{fingerprint}}");
+ }
+ });
+
+ test("does not force any placeholder (user names CAs freely, like the certificate schema)", () => {
+ expect(acceptsCa("Infisical-ca-{{fingerprint}}")).toBe(true);
+ expect(acceptsCa("Infisical-ca-{{commonName}}")).toBe(true);
+ expect(acceptsCa("{{commonName}}-{{fingerprint}}")).toBe(true);
+ expect(acceptsCa("static-ca-name")).toBe(true);
+ });
+
+ test("rejects forbidden characters and over-length names", () => {
+ expect(acceptsCa("ca!-{{fingerprint}}")).toBe(false);
+ expect(acceptsCa("ca space-{{fingerprint}}")).toBe(false);
+ expect(acceptsCa(`${"a".repeat(230)}-{{fingerprint}}`)).toBe(false); // 230 + 1 + 24 = 255 > 251
+ });
+});
+
+describe("Kemp LoadMaster destinationConfig (virtualServiceId)", () => {
+ const accepts = (config: Record<string, unknown>) => KempLoadMasterPkiSyncConfigSchema.safeParse(config).success;
+
+ test("accepts a numeric Virtual Service index or none at all", () => {
+ expect(accepts({})).toBe(true);
+ expect(accepts({ virtualServiceId: "1" })).toBe(true);
+ expect(accepts({ virtualServiceId: "42" })).toBe(true);
+ });
+
+ test("rejects non-numeric Virtual Service identifiers", () => {
+ expect(accepts({ virtualServiceId: "vs-ssl-prod" })).toBe(false);
+ expect(accepts({ virtualServiceId: "1.2" })).toBe(false);
+ expect(accepts({ virtualServiceId: "172.31.34.251:443" })).toBe(false);
+ });
+});
diff --git a/backend/src/services/pki-sync/kemp-loadmaster/kemp-loadmaster-pki-sync-schemas.ts b/backend/src/services/pki-sync/kemp-loadmaster/kemp-loadmaster-pki-sync-schemas.ts
new file mode 100644
index 0000000000..cad399c99c
--- /dev/null
+++ b/backend/src/services/pki-sync/kemp-loadmaster/kemp-loadmaster-pki-sync-schemas.ts
@@ -0,0 +1,105 @@
+import RE2 from "re2";
+import { z } from "zod";
+
+import { openApiHidden } from "@app/server/lib/schemas";
+import { AppConnection } from "@app/services/app-connection/app-connection-enums";
+import { buildCertificateNameSchemaTestName } from "@app/services/pki-sync/pki-sync-certificate-name-fns";
+import { PkiSync } from "@app/services/pki-sync/pki-sync-enums";
+import { PkiSyncSchema } from "@app/services/pki-sync/pki-sync-schemas";
+
+import { KEMP_LOADMASTER_DEFAULT_CA_NAME_SCHEMA, KEMP_LOADMASTER_NAMING } from "./kemp-loadmaster-pki-sync-constants";
+
+const VIRTUAL_SERVICE_ID_PATTERN = new RE2("^[0-9]+$");
+
+export const KempLoadMasterPkiSyncConfigSchema = z.object({
+ virtualServiceId: z
+ .string()
+ .trim()
+ .max(10, "Virtual Service ID cannot exceed 10 characters")
+ .refine((val) => VIRTUAL_SERVICE_ID_PATTERN.test(val), {
+ message: "Virtual Service ID must be the numeric Virtual Service index shown on the LoadMaster"
+ })
+ .optional()
+});
+
+export const KempLoadMasterPkiSyncOptionsSchema = z.object({
+ canRemoveCertificates: z.boolean().default(true),
+ includeRootCa: z.boolean().default(false),
+ preserveItemOnRenewal: z.boolean().default(true),
+ syncCaCertificates: z.boolean().default(true),
+ caCertificateNameSchema: z
+ .string()
+ .trim()
+ .default(KEMP_LOADMASTER_DEFAULT_CA_NAME_SCHEMA)
+ .refine(
+ (schema) => {
+ const testName = schema
+ .replace(new RE2("\\{\\{fingerprint\\}\\}", "g"), "0".repeat(24))
+ .replace(new RE2("\\{\\{commonName\\}\\}", "g"), "common-name");
+ const hasForbiddenChars = KEMP_LOADMASTER_NAMING.FORBIDDEN_CHARACTERS.split("").some((char) =>
+ testName.includes(char)
+ );
+ return KEMP_LOADMASTER_NAMING.NAME_PATTERN.test(testName) && !hasForbiddenChars;
+ },
+ {
+ message:
+ "CA certificate name schema must result in names 1-251 characters long containing only alphanumeric characters, hyphens (-), underscores (_), and periods (.). Available placeholders: {{fingerprint}} (recommended so each CA gets a unique name) and {{commonName}}. A schema with no placeholder can hold only one CA certificate. Defaults to Infisical-ca-{{fingerprint}}."
+ }
+ ),
+ certificateNameSchema: z
+ .string()
+ .trim()
+ .min(1, "Certificate name schema is required")
+ .refine(
+ (schema) => {
+ const testName = buildCertificateNameSchemaTestName(schema);
+
+ const hasForbiddenChars = KEMP_LOADMASTER_NAMING.FORBIDDEN_CHARACTERS.split("").some((char) =>
+ testName.includes(char)
+ );
+
+ return KEMP_LOADMASTER_NAMING.NAME_PATTERN.test(testName) && !hasForbiddenChars;
+ },
+ {
+ message:
+ "Certificate name schema must result in names that contain only alphanumeric characters, hyphens (-), underscores (_), and periods (.) and be 1-251 characters long for Kemp LoadMaster. Available placeholders: {{certificateId}}, {{shortCertificateId}}, {{profileId}}, {{applicationId}}, {{applicationName}}, {{commonName}}. A schema with no placeholder can be linked to only one certificate."
+ }
+ )
+});
+
+export const KempLoadMasterPkiSyncSchema = PkiSyncSchema.extend({
+ destination: z.literal(PkiSync.KempLoadMaster),
+ destinationConfig: KempLoadMasterPkiSyncConfigSchema,
+ syncOptions: KempLoadMasterPkiSyncOptionsSchema
+});
+
+export const CreateKempLoadMasterPkiSyncSchema = z.object({
+ name: z.string().trim().min(1).max(256),
+ description: z.string().optional(),
+ isAutoSyncEnabled: z.boolean().default(true),
+ destinationConfig: KempLoadMasterPkiSyncConfigSchema,
+ syncOptions: KempLoadMasterPkiSyncOptionsSchema,
+ subscriberId: z.string().nullish(),
+ connectionId: z.string(),
+ projectId: z.string().trim().min(1).optional().describe(openApiHidden()),
+ applicationId: z.string().uuid().optional(),
+ certificateIds: z.array(z.string().uuid()).optional()
+});
+
+export const UpdateKempLoadMasterPkiSyncSchema = z.object({
+ name: z.string().trim().min(1).max(256).optional(),
+ description: z.string().optional(),
+ isAutoSyncEnabled: z.boolean().optional(),
+ destinationConfig: KempLoadMasterPkiSyncConfigSchema.optional(),
+ syncOptions: KempLoadMasterPkiSyncOptionsSchema.optional(),
+ subscriberId: z.string().nullish(),
+ connectionId: z.string().optional()
+});
+
+export const KempLoadMasterPkiSyncListItemSchema = z.object({
+ name: z.literal("Kemp LoadMaster"),
+ connection: z.literal(AppConnection.KempLoadMaster),
+ destination: z.literal(PkiSync.KempLoadMaster),
+ canImportCertificates: z.literal(false),
+ canRemoveCertificates: z.literal(true)
+});
diff --git a/backend/src/services/pki-sync/kemp-loadmaster/kemp-loadmaster-pki-sync-types.ts b/backend/src/services/pki-sync/kemp-loadmaster/kemp-loadmaster-pki-sync-types.ts
new file mode 100644
index 0000000000..a39de980cb
--- /dev/null
+++ b/backend/src/services/pki-sync/kemp-loadmaster/kemp-loadmaster-pki-sync-types.ts
@@ -0,0 +1,22 @@
+import { z } from "zod";
+
+import { TKempLoadMasterConnection } from "@app/services/app-connection/kemp-loadmaster/kemp-loadmaster-connection-types";
+
+import {
+ CreateKempLoadMasterPkiSyncSchema,
+ KempLoadMasterPkiSyncConfigSchema,
+ KempLoadMasterPkiSyncSchema,
+ UpdateKempLoadMasterPkiSyncSchema
+} from "./kemp-loadmaster-pki-sync-schemas";
+
+export type TKempLoadMasterPkiSyncConfig = z.infer<typeof KempLoadMasterPkiSyncConfigSchema>;
+
+export type TKempLoadMasterPkiSync = z.infer<typeof KempLoadMasterPkiSyncSchema>;
+
+export type TKempLoadMasterPkiSyncInput = z.infer<typeof CreateKempLoadMasterPkiSyncSchema>;
+
+export type TKempLoadMasterPkiSyncUpdate = z.infer<typeof UpdateKempLoadMasterPkiSyncSchema>;
+
+export type TKempLoadMasterPkiSyncWithCredentials = TKempLoadMasterPkiSync & {
+ connection: TKempLoadMasterConnection;
+};
diff --git a/backend/src/services/pki-sync/pki-sync-certificate-name-fns.ts b/backend/src/services/pki-sync/pki-sync-certificate-name-fns.ts
index 5258802063..2124307577 100644
--- a/backend/src/services/pki-sync/pki-sync-certificate-name-fns.ts
+++ b/backend/src/services/pki-sync/pki-sync-certificate-name-fns.ts
@@ -41,6 +41,7 @@ const NAME_VALUE_DISALLOWED_CHARS: Partial<Record<PkiSync, RE2>> = {
[PkiSync.AwsSecretsManager]: new RE2("[^a-zA-Z0-9_-]", "g"),
[PkiSync.NetScaler]: new RE2("[^a-zA-Z0-9._-]", "g"),
[PkiSync.F5BigIp]: new RE2("[^a-zA-Z0-9._-]", "g"),
+ [PkiSync.KempLoadMaster]: new RE2("[^a-zA-Z0-9._-]", "g"),
[PkiSync.LinuxServer]: new RE2("[^a-zA-Z0-9._-]", "g"),
[PkiSync.WindowsServer]: new RE2("[^a-zA-Z0-9._-]", "g")
};
diff --git a/backend/src/services/pki-sync/pki-sync-enums.ts b/backend/src/services/pki-sync/pki-sync-enums.ts
index 6d05db17bd..421632d310 100644
--- a/backend/src/services/pki-sync/pki-sync-enums.ts
+++ b/backend/src/services/pki-sync/pki-sync-enums.ts
@@ -7,6 +7,7 @@ export enum PkiSync {
CloudflareCustomCertificate = "cloudflare-custom-certificate",
NetScaler = "netscaler",
F5BigIp = "f5-big-ip",
+ KempLoadMaster = "kemp-loadmaster",
LinuxServer = "linux-server",
WindowsServer = "windows-server"
}
diff --git a/backend/src/services/pki-sync/pki-sync-fns.ts b/backend/src/services/pki-sync/pki-sync-fns.ts
index c3bbf4d4fb..719f25df2c 100644
--- a/backend/src/services/pki-sync/pki-sync-fns.ts
+++ b/backend/src/services/pki-sync/pki-sync-fns.ts
@@ -24,6 +24,8 @@ import { CLOUDFLARE_CUSTOM_CERTIFICATE_PKI_SYNC_LIST_OPTION } from "./cloudflare
import { cloudflareCustomCertificatePkiSyncFactory } from "./cloudflare-custom-certificate/cloudflare-custom-certificate-pki-sync-fns";
import { F5_BIG_IP_PKI_SYNC_LIST_OPTION } from "./f5-big-ip/f5-big-ip-pki-sync-constants";
import { f5BigIpPkiSyncFactory } from "./f5-big-ip/f5-big-ip-pki-sync-fns";
+import { KEMP_LOADMASTER_PKI_SYNC_LIST_OPTION } from "./kemp-loadmaster/kemp-loadmaster-pki-sync-constants";
+import { kempLoadMasterPkiSyncFactory } from "./kemp-loadmaster/kemp-loadmaster-pki-sync-fns";
import { LINUX_SERVER_PKI_SYNC_LIST_OPTION } from "./linux-server/linux-server-pki-sync-constants";
import { linuxServerPkiSyncFactory } from "./linux-server/linux-server-pki-sync-fns";
import { NETSCALER_PKI_SYNC_LIST_OPTION } from "./netscaler/netscaler-pki-sync-constants";
@@ -49,6 +51,7 @@ const PKI_SYNC_LIST_OPTIONS = {
[PkiSync.CloudflareCustomCertificate]: CLOUDFLARE_CUSTOM_CERTIFICATE_PKI_SYNC_LIST_OPTION,
[PkiSync.NetScaler]: NETSCALER_PKI_SYNC_LIST_OPTION,
[PkiSync.F5BigIp]: F5_BIG_IP_PKI_SYNC_LIST_OPTION,
+ [PkiSync.KempLoadMaster]: KEMP_LOADMASTER_PKI_SYNC_LIST_OPTION,
[PkiSync.LinuxServer]: LINUX_SERVER_PKI_SYNC_LIST_OPTION,
[PkiSync.WindowsServer]: WINDOWS_SERVER_PKI_SYNC_LIST_OPTION
};
@@ -166,6 +169,11 @@ export const PkiSyncFns = {
case PkiSync.F5BigIp: {
throw new Error("F5 BIG-IP does not support importing certificates into Infisical");
}
+ case PkiSync.KempLoadMaster: {
+ throw new Error(
+ "Kemp LoadMaster does not support importing certificates into Infisical (private keys cannot be extracted)"
+ );
+ }
case PkiSync.LinuxServer: {
throw new Error("Linux Server does not support importing certificates into Infisical");
}
@@ -264,6 +272,16 @@ export const PkiSyncFns = {
});
return f5BigIpPkiSync.syncCertificates(pkiSync, certificateMap);
}
+ case PkiSync.KempLoadMaster: {
+ checkPkiSyncDestination(pkiSync, PkiSync.KempLoadMaster as PkiSync);
+ const kempLoadMasterPkiSync = kempLoadMasterPkiSyncFactory({
+ certificateDAL: dependencies.certificateDAL,
+ certificateSyncDAL: dependencies.certificateSyncDAL,
+ gatewayV2Service: dependencies.gatewayV2Service,
+ gatewayPoolService: dependencies.gatewayPoolService
+ });
+ return kempLoadMasterPkiSync.syncCertificates(pkiSync, certificateMap);
+ }
case PkiSync.LinuxServer: {
checkPkiSyncDestination(pkiSync, PkiSync.LinuxServer as PkiSync);
const linuxServerPkiSync = linuxServerPkiSyncFactory({
@@ -407,6 +425,20 @@ export const PkiSyncFns = {
});
break;
}
+ case PkiSync.KempLoadMaster: {
+ checkPkiSyncDestination(pkiSync, PkiSync.KempLoadMaster as PkiSync);
+ const kempLoadMasterPkiSync = kempLoadMasterPkiSyncFactory({
+ certificateDAL: dependencies.certificateDAL,
+ certificateSyncDAL: dependencies.certificateSyncDAL,
+ gatewayV2Service: dependencies.gatewayV2Service,
+ gatewayPoolService: dependencies.gatewayPoolService
+ });
+ await kempLoadMasterPkiSync.removeCertificates(pkiSync, certificateNames, {
+ certificateSyncDAL: dependencies.certificateSyncDAL,
+ certificateMap: dependencies.certificateMap
+ });
+ break;
+ }
case PkiSync.LinuxServer: {
checkPkiSyncDestination(pkiSync, PkiSync.LinuxServer as PkiSync);
const linuxServerPkiSync = linuxServerPkiSyncFactory({
diff --git a/backend/src/services/pki-sync/pki-sync-maps.ts b/backend/src/services/pki-sync/pki-sync-maps.ts
index 9c09b8729d..97817a6397 100644
--- a/backend/src/services/pki-sync/pki-sync-maps.ts
+++ b/backend/src/services/pki-sync/pki-sync-maps.ts
@@ -11,6 +11,7 @@ export const PKI_SYNC_NAME_MAP: Record<PkiSync, string> = {
[PkiSync.CloudflareCustomCertificate]: "Cloudflare Custom SSL Certificate",
[PkiSync.NetScaler]: "NetScaler",
[PkiSync.F5BigIp]: "F5 BIG-IP",
+ [PkiSync.KempLoadMaster]: "Kemp LoadMaster",
[PkiSync.LinuxServer]: "Linux Server",
[PkiSync.WindowsServer]: "Windows Server"
};
@@ -24,6 +25,7 @@ export const PKI_SYNC_CONNECTION_MAP: Record<PkiSync, AppConnection> = {
[PkiSync.CloudflareCustomCertificate]: AppConnection.Cloudflare,
[PkiSync.NetScaler]: AppConnection.NetScaler,
[PkiSync.F5BigIp]: AppConnection.F5BigIp,
+ [PkiSync.KempLoadMaster]: AppConnection.KempLoadMaster,
[PkiSync.LinuxServer]: AppConnection.SSH,
[PkiSync.WindowsServer]: AppConnection.WinRM
};
diff --git a/docs/docs.json b/docs/docs.json
index d04a709da5..fa86ab0ab2 100644
--- a/docs/docs.json
+++ b/docs/docs.json
@@ -145,6 +145,7 @@
"integrations/app-connections/hasura-cloud",
"integrations/app-connections/heroku",
"integrations/app-connections/humanitec",
+ "integrations/app-connections/kemp-loadmaster",
"integrations/app-connections/external-infisical",
"integrations/app-connections/laravel-forge",
"integrations/app-connections/ldap",
@@ -949,6 +950,7 @@
"documentation/platform/pki/applications/certificate-syncs/cloudflare-custom-certificate",
"documentation/platform/pki/applications/certificate-syncs/f5-big-ip",
"documentation/platform/pki/applications/certificate-syncs/netscaler",
+ "documentation/platform/pki/applications/certificate-syncs/kemp-loadmaster",
"documentation/platform/pki/applications/certificate-syncs/linux-server",
"documentation/platform/pki/applications/certificate-syncs/windows-server"
]
diff --git a/docs/documentation/platform/pki/applications/certificate-syncs/kemp-loadmaster.mdx b/docs/documentation/platform/pki/applications/certificate-syncs/kemp-loadmaster.mdx
new file mode 100644
index 0000000000..114551135c
--- /dev/null
+++ b/docs/documentation/platform/pki/applications/certificate-syncs/kemp-loadmaster.mdx
@@ -0,0 +1,189 @@
+---
+title: "Kemp LoadMaster"
+sidebarTitle: "Kemp LoadMaster"
+description: "Deploy certificates to Progress Kemp LoadMaster load balancers."
+---
+
+Deploy certificates to Progress Kemp LoadMaster load balancers via the RESTful API. Certificates can be automatically bound to a Virtual Service for seamless load balancer integration.
+
+<Info>
+ Certificate Syncs are configured per Application. First select which certificates to sync, then configure the Kemp LoadMaster destination.
+</Info>
+
+## Prerequisites
+
+- A [Kemp LoadMaster Connection](/integrations/app-connections/kemp-loadmaster) with API access
+- The LoadMaster must be reachable over HTTPS from Infisical, either directly or through an [Infisical Gateway](/documentation/platform/gateways/overview)
+- The **API Interface** must be enabled on the LoadMaster (Certificates & Security > Remote Access > Enable API Interface)
+- A user account with permission to manage SSL certificates and, if you bind to a Virtual Service, to modify Virtual Services
+
+## Create a Kemp LoadMaster Sync
+
+<Tabs>
+ <Tab title="Infisical UI">
+ 1. In your Application, go to the **Certificate Syncs** tab and click **Create Sync**.
+
+ 2. Select the **Kemp LoadMaster** option.
+
+ 3. Configure the **Destination**:
+ - **Kemp LoadMaster Connection**: The connection to authenticate with.
+ - **Virtual Service** (Optional): Select the Virtual Service to bind the certificate to from the list fetched from the LoadMaster (shown as name and VIP:port). Leave unset to only import the certificate without binding.
+
+ 4. Configure the **Sync Options**:
+ - **Enable Removal of Expired/Revoked Certificates**: Remove certificates from the destination if they are no longer active.
+ - **Preserve Certificate on Renewal**: Reuse the existing certificate identifier when a certificate renews, preserving the name and any Virtual Service binding.
+ - **Sync Certificate Authorities**: When enabled, each certificate's chain (intermediate CA certificates) is uploaded into the LoadMaster's Intermediate Certs store so it can build the complete chain it presents to clients. When disabled, only the leaf certificates are managed.
+ - **CA Certificate Name Schema**: Shown when Sync Certificate Authorities is enabled. Controls how CA certificates are named in the Intermediate Certs store using the `{{fingerprint}}` and `{{commonName}}` placeholders. Defaults to `Infisical-ca-{{fingerprint}}`.
+ - **Certificate Name Schema**: Customize certificate identifiers using placeholders such as `{{certificateId}}`, `{{commonName}}`, `{{profileId}}`, and `{{applicationId}}`. Must include `{{certificateId}}` or `{{shortCertificateId}}`. Defaults to `Infisical-{{certificateId}}`. See [Certificate Name Schema](/documentation/platform/pki/applications/certificate-syncs/overview#certificate-name-schema) for the full placeholder reference.
+ - **Auto-Sync Enabled**: Automatically sync certificates when changes occur.
+
+ 5. Configure the **Details**:
+ - **Name**: The name of your sync (slug-friendly).
+ - **Description**: Optional description.
+
+ 6. Select which certificates should be synced.
+
+ 7. Review and click **Create Sync**.
+ </Tab>
+ <Tab title="API">
+ To create a **Kemp LoadMaster Certificate Sync**, make an API request to the [Create Kemp LoadMaster PKI Sync](/api-reference/endpoints/pki/syncs/kemp-loadmaster/create) endpoint.
+
+ ### Sample request
+
+ <Note>
+ You can optionally specify `certificateIds` during sync creation to immediately add certificates to the sync.
+ If not provided, you can add certificates later using the certificate management endpoints.
+ </Note>
+
+ ```bash Request
+ curl --request POST \
+ --url https://app.infisical.com/api/v1/cert-manager/syncs/kemp-loadmaster \
+ --header 'Authorization: Bearer <access-token>' \
+ --header 'Content-Type: application/json' \
+ --data '{
+ "name": "my-kemp-cert-sync",
+ "applicationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
+ "description": "an example certificate sync",
+ "connectionId": "550e8400-e29b-41d4-a716-446655440000",
+ "destination": "kemp-loadmaster",
+ "isAutoSyncEnabled": true,
+ "certificateIds": [
+ "550e8400-e29b-41d4-a716-446655440000"
+ ],
+ "syncOptions": {
+ "canRemoveCertificates": true,
+ "preserveItemOnRenewal": true,
+ "certificateNameSchema": "Infisical-{{certificateId}}"
+ },
+ "destinationConfig": {
+ "virtualServiceId": "1"
+ }
+ }'
+ ```
+
+ ### Sample response
+
+ ```json Response
+ {
+ "pkiSync": {
+ "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
+ "name": "my-kemp-cert-sync",
+ "description": "an example certificate sync",
+ "destination": "kemp-loadmaster",
+ "isAutoSyncEnabled": true,
+ "destinationConfig": {
+ "virtualServiceId": "1"
+ },
+ "syncOptions": {
+ "canRemoveCertificates": true,
+ "preserveItemOnRenewal": true,
+ "certificateNameSchema": "Infisical-{{certificateId}}"
+ },
+ "applicationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
+ "connectionId": "550e8400-e29b-41d4-a716-446655440000",
+ "createdAt": "2026-03-31T00:00:00.000Z",
+ "updatedAt": "2026-03-31T00:00:00.000Z"
+ }
+ }
+ ```
+ </Tab>
+</Tabs>
+
+<Note>
+ The LoadMaster certificate identifier is limited to 251 characters and may contain letters, numbers, hyphens, underscores, and periods. Full UUID placeholders (`{{certificateId}}`, `{{profileId}}`, `{{applicationId}}`) each resolve to 32 characters and `{{shortCertificateId}}` resolves to 22, so a schema has room to combine several.
+</Note>
+
+## Certificate Management
+
+The Kemp LoadMaster Certificate Sync provides:
+
+- **Automatic Deployment**: Import certificates from Infisical into the LoadMaster certificate store with customizable naming.
+- **Certificate Updates**: Replace certificates on the LoadMaster when renewals occur.
+- **Virtual Service Binding**: Optionally bind certificates to a Virtual Service, alongside any certificates the LoadMaster already serves there.
+- **Expiration Handling**: Optionally remove expired or revoked certificates from the LoadMaster (if enabled).
+
+<Note>
+ Kemp LoadMaster Certificate Syncs support both automatic and manual synchronization modes. When auto-sync is enabled, certificates are automatically deployed as they are issued or renewed.
+</Note>
+
+## How It Works
+
+When syncing certificates, Infisical performs the following steps on the LoadMaster via the RESTful API:
+
+1. Lists the existing certificate identifiers on the LoadMaster.
+2. When **Sync Certificate Authorities** is enabled, uploads each certificate's chain (intermediate CA certificates) into the LoadMaster's dedicated intermediate certificate store, which is how the LoadMaster builds the complete chain it presents to clients. The chain is also included in the leaf import as a fallback.
+3. For each certificate, imports a PEM bundle (certificate, chain, and private key) under its identifier, replacing the entry if the identifier already exists.
+4. If a Virtual Service is configured, reconciles its bound certificate list so the managed certificates are bound while any certificates the sync does not manage are left in place.
+5. If removal is enabled, unbinds certificates that are no longer active in Infisical from the Virtual Service and then deletes them from the certificate store.
+
+## Certificate Renewal Behavior
+
+When a certificate is renewed in Infisical, the behavior depends on the **Preserve Certificate on Renewal** option:
+
+- **Preserve enabled (default)**: The existing certificate identifier is reused and its content replaced with the renewed certificate. The identifier and any Virtual Service binding are preserved. This is ideal for production environments.
+- **Preserve disabled**: A new certificate identifier is created for the renewed certificate. The original certificate remains on the LoadMaster until it is revoked or removed.
+
+## Removing Certificates
+
+When certificate removal is enabled and a certificate is no longer active in Infisical:
+
+1. If a Virtual Service is configured, the certificate is removed from that Virtual Service's bound certificate list.
+2. The certificate is deleted from the LoadMaster certificate store.
+
+## Manual Certificate Sync
+
+You can manually trigger certificate synchronization to the LoadMaster using the sync certificates functionality. This is useful for:
+
+- Initial setup when you have existing certificates to deploy
+- One-time sync of specific certificates
+- Testing certificate sync configurations
+- Force sync after making changes
+
+To manually sync certificates, use the [Sync Certificates](/api-reference/endpoints/pki/syncs/kemp-loadmaster/sync-certificates) API endpoint or the manual sync option in the Infisical UI.
+
+## FAQ
+
+<Accordion title="Can I import certificates from the LoadMaster back into Infisical?">
+ The LoadMaster does not support importing certificates back into Infisical, because private keys cannot be extracted from the appliance.
+</Accordion>
+
+<Accordion title="What happens to other certificates already bound to my Virtual Service?">
+ Certificates that this sync does not manage are left in place. Infisical reads the Virtual Service's current certificate list, keeps the certificates it does not manage, and ensures its own managed certificates are bound. This supports serving multiple certificates on one Virtual Service through SNI.
+</Accordion>
+
+## What's Next?
+
+<CardGroup cols={2}>
+ <Card title="NetScaler" icon="server" href="/documentation/platform/pki/applications/certificate-syncs/netscaler">
+ Deploy certificates to Citrix NetScaler appliances.
+ </Card>
+ <Card title="Auto-Renewal" icon="arrows-spin" href="/documentation/platform/pki/applications/certificates#server-driven-renewal">
+ Enable automatic certificate renewal and syncing.
+ </Card>
+ <Card title="Alerting" icon="bell" href="/documentation/platform/pki/applications/alerting/overview">
+ Get notified about certificate lifecycle events.
+ </Card>
+ <Card title="Other Sync Destinations" icon="arrows-rotate" href="/documentation/platform/pki/applications/certificate-syncs/overview">
+ View all supported sync destinations.
+ </Card>
+</CardGroup>
diff --git a/docs/documentation/platform/pki/applications/certificate-syncs/overview.mdx b/docs/documentation/platform/pki/applications/certificate-syncs/overview.mdx
index 516a49d3ca..a9e7f0c03d 100644
--- a/docs/documentation/platform/pki/applications/certificate-syncs/overview.mdx
+++ b/docs/documentation/platform/pki/applications/certificate-syncs/overview.mdx
@@ -80,6 +80,9 @@ flowchart LR
<Card title="NetScaler" icon="server" href="/documentation/platform/pki/applications/certificate-syncs/netscaler">
Deploy certificates to Citrix NetScaler ADC.
</Card>
+ <Card title="Kemp LoadMaster" icon="scale-balanced" href="/documentation/platform/pki/applications/certificate-syncs/kemp-loadmaster">
+ Deploy certificates to Progress Kemp LoadMaster.
+ </Card>
<Card title="Linux Server" icon="linux" href="/documentation/platform/pki/applications/certificate-syncs/linux-server">
Deploy certificates to Linux servers over SSH.
</Card>
diff --git a/docs/integrations/app-connections/kemp-loadmaster.mdx b/docs/integrations/app-connections/kemp-loadmaster.mdx
new file mode 100644
index 0000000000..6ad2c6ae16
--- /dev/null
+++ b/docs/integrations/app-connections/kemp-loadmaster.mdx
@@ -0,0 +1,98 @@
+---
+title: "Kemp LoadMaster Connection"
+description: "Learn how to configure a Kemp LoadMaster Connection for Infisical."
+---
+
+Infisical supports connecting to Progress Kemp LoadMaster load balancers using basic authentication credentials for managing SSL certificates via the RESTful API.
+
+## Setup
+
+<Tabs>
+ <Tab title="Infisical UI">
+ <Steps>
+ <Step title="Enable the LoadMaster API Interface">
+ On the LoadMaster, go to **Certificates & Security > Remote Access** and enable the **API Interface** checkbox. The RESTful API is disabled by default, and certificate management requires it to be enabled.
+ </Step>
+ <Step title="Gather Kemp LoadMaster Credentials">
+ You will need the following from your LoadMaster:
+
+ - **Hostname**: The management IP address or FQDN of your LoadMaster (for example `192.168.1.100` or `lm.example.com`).
+ - **Port**: The HTTPS management port (default `8443`).
+ - **Username**: A user with permission to manage SSL certificates.
+ - **Password**: The password for the user account.
+
+ <Note>
+ The user account must have permission to manage SSL certificates and, if you bind certificates to a Virtual Service, to modify Virtual Services.
+ </Note>
+ </Step>
+ <Step title="Navigate to App Connections">
+ In the Infisical dashboard, navigate to **Organization Settings > App Connections** and click **Add Connection**.
+ </Step>
+ <Step title="Select Kemp LoadMaster">
+ Select the **Kemp LoadMaster** option from the list of available connections.
+ </Step>
+ <Step title="Fill in Connection Details">
+ Fill in the **Configuration** tab:
+
+ - **Hostname**: The management IP or FQDN of the LoadMaster.
+ - **Username**: The LoadMaster management username.
+ - **Password**: The password for the management user.
+ - **Port** (Optional): HTTPS port for the management interface (default `8443`).
+
+ Configure the **SSL** tab:
+
+ - **SSL Certificate** (Optional): A CA certificate in PEM format to verify the LoadMaster management interface's TLS certificate.
+ - **Reject Unauthorized**: When enabled, Infisical will only connect if the LoadMaster has a valid, trusted TLS certificate. Disable this for self-signed certificates or provide a CA certificate.
+
+ Optionally select a **Gateway** to route the connection through an Infisical Gateway for private network access.
+
+ Click **Connect to Kemp LoadMaster** to validate and save your connection.
+ </Step>
+ <Step title="Connection Created">
+ Your Kemp LoadMaster Connection is now available for use with certificate syncs.
+ </Step>
+ </Steps>
+ </Tab>
+ <Tab title="API">
+ To create a Kemp LoadMaster Connection, make an API request to the [Create App Connection](/api-reference/endpoints/app-connections/kemp-loadmaster/create) endpoint.
+
+ ### Sample request
+
+ ```bash Request
+ curl --request POST \
+ --url https://app.infisical.com/api/v1/app-connections/kemp-loadmaster \
+ --header 'Authorization: Bearer <access-token>' \
+ --header 'Content-Type: application/json' \
+ --data '{
+ "name": "my-kemp-connection",
+ "method": "basic-auth",
+ "credentials": {
+ "hostname": "lm.example.com",
+ "port": 8443,
+ "username": "bal",
+ "password": "your-password",
+ "sslRejectUnauthorized": false
+ }
+ }'
+ ```
+
+ ### Sample response
+
+ ```json Response
+ {
+ "appConnection": {
+ "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
+ "name": "my-kemp-connection",
+ "app": "kemp-loadmaster",
+ "method": "basic-auth",
+ "credentials": {
+ "hostname": "lm.example.com",
+ "port": 8443,
+ "username": "bal",
+ "sslRejectUnauthorized": false
+ }
+ }
+ }
+ ```
+ </Tab>
+</Tabs>
diff --git a/frontend/public/images/integrations/Kemp LoadMaster.png b/frontend/public/images/integrations/Kemp LoadMaster.png
new file mode 100644
index 0000000000..f09f90356b
Binary files /dev/null and b/frontend/public/images/integrations/Kemp LoadMaster.png differ
diff --git a/frontend/src/components/pki-syncs/forms/CreatePkiSyncForm.tsx b/frontend/src/components/pki-syncs/forms/CreatePkiSyncForm.tsx
index d6f7eb9770..3db4510acd 100644
--- a/frontend/src/components/pki-syncs/forms/CreatePkiSyncForm.tsx
+++ b/frontend/src/components/pki-syncs/forms/CreatePkiSyncForm.tsx
@@ -17,6 +17,7 @@ import {
usePkiSyncOption
} from "@app/hooks/api/pkiSyncs";
+import { KEMP_DEFAULT_CA_NAME_SCHEMA } from "./schemas/kemp-loadmaster-pki-sync-destination-schema";
import { PkiSyncFormSchema, TPkiSyncForm } from "./schemas/pki-sync-schema";
import { PkiSyncCertificatesFields } from "./PkiSyncCertificatesFields";
import { PkiSyncDestinationFields } from "./PkiSyncDestinationFields";
@@ -110,6 +111,10 @@ export const CreatePkiSyncForm = ({
: PkiSyncExportFormat.Pem,
includePrivateKey: true
}),
+ ...(destination === PkiSync.KempLoadMaster && {
+ syncCaCertificates: true,
+ caCertificateNameSchema: KEMP_DEFAULT_CA_NAME_SCHEMA
+ }),
...((destination === PkiSync.Chef || destination === PkiSync.AwsSecretsManager) && {
fieldMappings: {
certificate: "certificate",
diff --git a/frontend/src/components/pki-syncs/forms/KempLoadMasterPkiSyncFields.tsx b/frontend/src/components/pki-syncs/forms/KempLoadMasterPkiSyncFields.tsx
new file mode 100644
index 0000000000..07179ce93c
--- /dev/null
+++ b/frontend/src/components/pki-syncs/forms/KempLoadMasterPkiSyncFields.tsx
@@ -0,0 +1,60 @@
+import { Controller, useFormContext, useWatch } from "react-hook-form";
+
+import { FilterableSelect, FormControl } from "@app/components/v2";
+import { PkiSync, TKempVirtualService, useListKempVirtualServices } from "@app/hooks/api/pkiSyncs";
+
+import { TPkiSyncForm } from "./schemas/pki-sync-schema";
+import { PkiSyncConnectionField } from "./PkiSyncConnectionField";
+
+const getVirtualServiceLabel = (vs: TKempVirtualService) =>
+ vs.name ? `${vs.name} (${vs.address}:${vs.port})` : `${vs.address}:${vs.port}`;
+
+export const KempLoadMasterPkiSyncFields = () => {
+ const { control, setValue } = useFormContext<
+ TPkiSyncForm & { destination: PkiSync.KempLoadMaster }
+ >();
+
+ const connectionId = useWatch({ control, name: "connection.id" });
+
+ const { data: virtualServices = [], isLoading: isLoadingVirtualServices } =
+ useListKempVirtualServices({ connectionId }, { enabled: Boolean(connectionId) });
+
+ return (
+ <>
+ <PkiSyncConnectionField
+ onChange={() => {
+ setValue("destinationConfig.virtualServiceId", undefined);
+ }}
+ />
+ <Controller
+ name="destinationConfig.virtualServiceId"
+ control={control}
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ isError={Boolean(error)}
+ errorText={error?.message}
+ label="Virtual Service"
+ isOptional
+ tooltipText="The Virtual Service to bind the certificate to. Leave unset to only import the certificate without binding it to a Virtual Service."
+ >
+ <FilterableSelect
+ isDisabled={!connectionId}
+ isLoading={Boolean(connectionId) && isLoadingVirtualServices}
+ isClearable
+ options={virtualServices}
+ value={virtualServices.find((vs) => vs.id === value) ?? null}
+ onChange={(option) => onChange((option as TKempVirtualService | null)?.id)}
+ getOptionLabel={(option) => getVirtualServiceLabel(option as TKempVirtualService)}
+ getOptionValue={(option) => (option as TKempVirtualService).id}
+ placeholder={
+ connectionId
+ ? "Leave unset to import certificate only"
+ : "Select a connection first"
+ }
+ />
+ </FormControl>
+ )}
+ />
+ </>
+ );
+};
diff --git a/frontend/src/components/pki-syncs/forms/PkiSyncDestinationFields.tsx b/frontend/src/components/pki-syncs/forms/PkiSyncDestinationFields.tsx
index af1024f1e5..eeb8acfda0 100644
--- a/frontend/src/components/pki-syncs/forms/PkiSyncDestinationFields.tsx
+++ b/frontend/src/components/pki-syncs/forms/PkiSyncDestinationFields.tsx
@@ -10,6 +10,7 @@ import { AzureKeyVaultPkiSyncFields } from "./AzureKeyVaultPkiSyncFields";
import { ChefPkiSyncFields } from "./ChefPkiSyncFields";
import { CloudflareCustomCertificatePkiSyncFields } from "./CloudflareCustomCertificatePkiSyncFields";
import { F5BigIpPkiSyncFields } from "./F5BigIpPkiSyncFields";
+import { KempLoadMasterPkiSyncFields } from "./KempLoadMasterPkiSyncFields";
import { LinuxServerPkiSyncFields } from "./LinuxServerPkiSyncFields";
import { NetScalerPkiSyncFields } from "./NetScalerPkiSyncFields";
import { WindowsServerPkiSyncFields } from "./WindowsServerPkiSyncFields";
@@ -36,6 +37,8 @@ export const PkiSyncDestinationFields = () => {
return <NetScalerPkiSyncFields />;
case PkiSync.F5BigIp:
return <F5BigIpPkiSyncFields />;
+ case PkiSync.KempLoadMaster:
+ return <KempLoadMasterPkiSyncFields />;
case PkiSync.LinuxServer:
return <LinuxServerPkiSyncFields />;
case PkiSync.WindowsServer:
diff --git a/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/PkiSyncOptionsFields.tsx b/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/PkiSyncOptionsFields.tsx
index 02bfd3f187..26a76e6ce7 100644
--- a/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/PkiSyncOptionsFields.tsx
+++ b/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/PkiSyncOptionsFields.tsx
@@ -20,6 +20,7 @@ import {
WindowsFileAccess
} from "@app/hooks/api/pkiSyncs";
+import { KEMP_DEFAULT_CA_NAME_SCHEMA } from "../schemas/kemp-loadmaster-pki-sync-destination-schema";
import { TPkiSyncForm } from "../schemas/pki-sync-schema";
type Props = {
@@ -436,6 +437,149 @@ export const PkiSyncOptionsFields = ({ destination, isUpdate }: Props) => {
/>
)}
+ {currentDestination === PkiSync.KempLoadMaster && (
+ <Controller
+ control={control}
+ name="syncOptions.preserveItemOnRenewal"
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl isError={Boolean(error)} errorText={error?.message}>
+ <Switch
+ className="bg-mineshaft-400/80 shadow-inner data-[state=checked]:bg-green/80"
+ id="preserve-item-on-renewal"
+ thumbClassName="bg-mineshaft-800"
+ onCheckedChange={onChange}
+ isChecked={value}
+ >
+ <p>
+ Preserve Certificate on Renewal{" "}
+ <Tooltip
+ className="max-w-md"
+ content={
+ <>
+ <p>
+ <strong>Only applies to certificate renewals:</strong> controls what
+ happens on the LoadMaster when Infisical renews a certificate.
+ </p>
+ <p className="mt-4">
+ When on, the renewed certificate replaces the existing one under the same
+ identifier, so any Virtual Service binding keeps working without extra
+ setup.
+ </p>
+ <p className="mt-4">
+ When off, the renewed certificate is imported under a new identifier and
+ the original stays on the LoadMaster.
+ </p>
+ </>
+ }
+ >
+ <FontAwesomeIcon icon={faQuestionCircle} size="sm" className="ml-1" />
+ </Tooltip>
+ </p>
+ </Switch>
+ </FormControl>
+ )}
+ />
+ )}
+
+ {currentDestination === PkiSync.KempLoadMaster && (
+ <Controller
+ control={control}
+ name="syncOptions.syncCaCertificates"
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl isError={Boolean(error)} errorText={error?.message}>
+ <Switch
+ className="bg-mineshaft-400/80 shadow-inner data-[state=checked]:bg-green/80"
+ id="sync-ca-certificates"
+ thumbClassName="bg-mineshaft-800"
+ onCheckedChange={onChange}
+ isChecked={value}
+ >
+ <p>
+ Sync Certificate Authorities{" "}
+ <Tooltip
+ className="max-w-md"
+ content={
+ <>
+ <p>
+ When on, each certificate&apos;s chain (intermediate CA certificates) is
+ uploaded into the LoadMaster&apos;s dedicated Intermediate Certs store so
+ it can build the complete chain it presents to clients.
+ </p>
+ <p className="mt-4">
+ When off, only the leaf certificates are managed and no CA certificates
+ are pushed to the LoadMaster.
+ </p>
+ </>
+ }
+ >
+ <FontAwesomeIcon icon={faQuestionCircle} size="sm" className="ml-1" />
+ </Tooltip>
+ </p>
+ </Switch>
+ </FormControl>
+ )}
+ />
+ )}
+
+ {currentDestination === PkiSync.KempLoadMaster && watch("syncOptions.syncCaCertificates") && (
+ <Controller
+ control={control}
+ name="syncOptions.caCertificateNameSchema"
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ tooltipClassName="max-w-md"
+ tooltipText={
+ <div className="flex flex-col gap-3">
+ <span>
+ When Certificate Authorities are synced, this schema names each CA
+ (intermediate) certificate in the LoadMaster&apos;s Intermediate Certs store.
+ </span>
+
+ <div className="flex flex-col">
+ <span>Available placeholders:</span>
+ <ul className="list-disc pl-4 text-sm">
+ <li>
+ <code>{"{{fingerprint}}"}</code> - A hash of the CA certificate. Include it
+ so each distinct CA gets a unique name and is never duplicated.
+ </li>
+ <li>
+ <code>{"{{commonName}}"}</code> - The CA certificate&apos;s common name
+ </li>
+ </ul>
+ <span className="mt-1 text-xs text-bunker-300">
+ A placeholder is optional. A schema with no placeholder resolves to a fixed
+ name and can hold only one CA certificate. When placeholders resolve, any
+ characters the destination doesn&apos;t support are replaced with hyphens.
+ </span>
+ </div>
+ {syncOption?.forbiddenCharacters && syncOption.forbiddenCharacters.length > 0 && (
+ <div className="flex flex-col">
+ <span className="text-yellow">
+ Character restrictions for {syncOption.name}:
+ </span>
+ <div className="text-xs text-bunker-300">
+ The following characters are not allowed:{" "}
+ {syncOption.forbiddenCharacters.split("").join(" ")}
+ </div>
+ </div>
+ )}
+ </div>
+ }
+ isError={Boolean(error)}
+ errorText={error?.message}
+ label="CA Certificate Name Schema"
+ helperText="Controls how CA (intermediate) certificates are named in the LoadMaster's Intermediate Certs store."
+ >
+ <Input
+ value={value ?? ""}
+ onChange={(e) => onChange(e.target.value)}
+ placeholder={KEMP_DEFAULT_CA_NAME_SCHEMA}
+ />
+ </FormControl>
+ )}
+ />
+ )}
+
{(currentDestination === PkiSync.LinuxServer ||
currentDestination === PkiSync.WindowsServer) && (
<>
diff --git a/frontend/src/components/pki-syncs/forms/schemas/kemp-loadmaster-pki-sync-destination-schema.ts b/frontend/src/components/pki-syncs/forms/schemas/kemp-loadmaster-pki-sync-destination-schema.ts
new file mode 100644
index 0000000000..6895143cc7
--- /dev/null
+++ b/frontend/src/components/pki-syncs/forms/schemas/kemp-loadmaster-pki-sync-destination-schema.ts
@@ -0,0 +1,112 @@
+import { z } from "zod";
+
+import { PkiSync } from "@app/hooks/api/pkiSyncs";
+
+import { BasePkiSyncSchema } from "./base-pki-sync-schema";
+
+export const KEMP_DEFAULT_CA_NAME_SCHEMA = "Infisical-ca-{{fingerprint}}";
+
+const KempLoadMasterSyncOptionsSchema = z.object({
+ canRemoveCertificates: z.boolean().default(true),
+ includeRootCa: z.boolean().default(false),
+ preserveItemOnRenewal: z.boolean().default(true),
+ syncCaCertificates: z.boolean().default(true),
+ caCertificateNameSchema: z
+ .string()
+ .trim()
+ .default(KEMP_DEFAULT_CA_NAME_SCHEMA)
+ .refine(
+ (val) => {
+ const compiled = val
+ .replace(/\{\{fingerprint\}\}/g, "0".repeat(24))
+ .replace(/\{\{commonName\}\}/g, "common-name");
+ return /^[a-zA-Z0-9_\-.]{1,251}$/.test(compiled);
+ },
+ {
+ message:
+ "CA certificate name schema must result in names 1-251 characters long containing only alphanumeric characters, hyphens (-), underscores (_), and periods (.). Available placeholders: {{fingerprint}} (recommended so each CA gets a unique name) and {{commonName}}. A schema with no placeholder can hold only one CA certificate. Defaults to Infisical-ca-{{fingerprint}}."
+ }
+ ),
+ certificateNameSchema: z
+ .string()
+ .trim()
+ .min(1, "Certificate name schema is required")
+ .refine(
+ (val) => {
+ const allowedOptionalPlaceholders = [
+ "{{profileId}}",
+ "{{applicationId}}",
+ "{{applicationName}}",
+ "{{commonName}}"
+ ];
+
+ const allowedPlaceholdersRegexPart = [
+ "{{certificateId}}",
+ "{{shortCertificateId}}",
+ ...allowedOptionalPlaceholders
+ ]
+ .map((p) => p.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&"))
+ .join("|");
+
+ const allowedContentRegex = new RegExp(
+ `^([a-zA-Z0-9_\\-.]|${allowedPlaceholdersRegexPart})*$`
+ );
+ const contentIsValid = allowedContentRegex.test(val);
+
+ const compiledLength = val
+ .replace(/\{\{shortCertificateId\}\}/g, "0".repeat(22))
+ .replace(/\{\{certificateId\}\}/g, "0".repeat(32))
+ .replace(/\{\{profileId\}\}/g, "0".repeat(32))
+ .replace(/\{\{applicationId\}\}/g, "0".repeat(32))
+ .replace(/\{\{applicationName\}\}/g, "application-name")
+ .replace(/\{\{commonName\}\}/g, "common-name").length;
+ const lengthIsValid = compiledLength <= 251;
+
+ const certificateIdIsPresent =
+ val.includes("{{certificateId}}") || val.includes("{{shortCertificateId}}");
+ return contentIsValid && certificateIdIsPresent && lengthIsValid;
+ },
+ {
+ message:
+ "Certificate name schema must include the {{certificateId}} or {{shortCertificateId}} placeholder and compile to at most 251 characters for Kemp LoadMaster ({{certificateId}}, {{profileId}}, and {{applicationId}} count as 32 characters each; {{shortCertificateId}} counts as 22). It can also include {{profileId}}, {{applicationId}}, {{applicationName}}, and {{commonName}} placeholders. Only alphanumeric characters (a-z, A-Z, 0-9), hyphens (-), underscores (_), and periods (.) are allowed besides the placeholders."
+ }
+ )
+});
+
+export const KempLoadMasterPkiSyncDestinationSchema = BasePkiSyncSchema(
+ KempLoadMasterSyncOptionsSchema
+).merge(
+ z.object({
+ destination: z.literal(PkiSync.KempLoadMaster),
+ destinationConfig: z.object({
+ virtualServiceId: z
+ .string()
+ .trim()
+ .regex(
+ /^[0-9]+$/,
+ "Virtual Service ID must be the numeric Virtual Service index shown on the LoadMaster"
+ )
+ .max(10, "Virtual Service ID cannot exceed 10 characters")
+ .optional()
+ })
+ })
+);
+
+export const UpdateKempLoadMasterPkiSyncDestinationSchema =
+ KempLoadMasterPkiSyncDestinationSchema.partial().merge(
+ z.object({
+ name: z
+ .string()
+ .trim()
+ .min(1, "Name is required")
+ .max(255, "Name must be less than 255 characters"),
+ destination: z.literal(PkiSync.KempLoadMaster),
+ connection: z.object({
+ id: z.string().uuid("Invalid connection ID format"),
+ name: z
+ .string()
+ .min(1, "Connection name is required")
+ .max(255, "Connection name must be less than 255 characters")
+ })
+ })
+ );
diff --git a/frontend/src/components/pki-syncs/forms/schemas/pki-sync-schema.ts b/frontend/src/components/pki-syncs/forms/schemas/pki-sync-schema.ts
index 127ab9197a..cf430148b6 100644
--- a/frontend/src/components/pki-syncs/forms/schemas/pki-sync-schema.ts
+++ b/frontend/src/components/pki-syncs/forms/schemas/pki-sync-schema.ts
@@ -30,6 +30,10 @@ import {
F5BigIpPkiSyncDestinationSchema,
UpdateF5BigIpPkiSyncDestinationSchema
} from "./f5-big-ip-pki-sync-destination-schema";
+import {
+ KempLoadMasterPkiSyncDestinationSchema,
+ UpdateKempLoadMasterPkiSyncDestinationSchema
+} from "./kemp-loadmaster-pki-sync-destination-schema";
import {
LinuxServerPkiSyncDestinationSchema,
UpdateLinuxServerPkiSyncDestinationSchema
@@ -52,6 +56,7 @@ const PkiSyncUnionSchema = z.discriminatedUnion("destination", [
CloudflareCustomCertificatePkiSyncDestinationSchema,
NetScalerPkiSyncDestinationSchema,
F5BigIpPkiSyncDestinationSchema,
+ KempLoadMasterPkiSyncDestinationSchema,
LinuxServerPkiSyncDestinationSchema,
WindowsServerPkiSyncDestinationSchema
]);
@@ -65,6 +70,7 @@ const UpdatePkiSyncUnionSchema = z.discriminatedUnion("destination", [
UpdateCloudflareCustomCertificatePkiSyncDestinationSchema,
UpdateNetScalerPkiSyncDestinationSchema,
UpdateF5BigIpPkiSyncDestinationSchema,
+ UpdateKempLoadMasterPkiSyncDestinationSchema,
UpdateLinuxServerPkiSyncDestinationSchema,
UpdateWindowsServerPkiSyncDestinationSchema
]);
diff --git a/frontend/src/helpers/appConnections.ts b/frontend/src/helpers/appConnections.ts
index b11bb9febe..cf40ab4b37 100644
--- a/frontend/src/helpers/appConnections.ts
+++ b/frontend/src/helpers/appConnections.ts
@@ -71,6 +71,7 @@ import { FireworksConnectionMethod } from "@app/hooks/api/appConnections/types/f
import { GoDaddyConnectionMethod } from "@app/hooks/api/appConnections/types/godaddy-connection";
import { HasuraCloudConnectionMethod } from "@app/hooks/api/appConnections/types/hasura-cloud-connection";
import { HerokuConnectionMethod } from "@app/hooks/api/appConnections/types/heroku-connection";
+import { KempLoadMasterConnectionMethod } from "@app/hooks/api/appConnections/types/kemp-loadmaster-connection";
import { LaravelForgeConnectionMethod } from "@app/hooks/api/appConnections/types/laravel-forge-connection";
import { LiteLLMConnectionMethod } from "@app/hooks/api/appConnections/types/litellm-connection";
import { NetlifyConnectionMethod } from "@app/hooks/api/appConnections/types/netlify-connection";
@@ -485,6 +486,12 @@ export const APP_CONNECTION_MAP: Record<
category: "NETWORKING",
description: "Manage a Citrix NetScaler appliance."
},
+ [AppConnection.KempLoadMaster]: {
+ name: "Kemp LoadMaster",
+ image: "Kemp LoadMaster.png",
+ category: "NETWORKING",
+ description: "Manage a Progress Kemp LoadMaster load balancer."
+ },
[AppConnection.Anthropic]: {
name: "Anthropic",
image: "Anthropic.png",
@@ -733,6 +740,8 @@ export const getAppConnectionMethodDetails = (method: TAppConnection["method"])
return { name: "Machine Identity - Universal Auth", icon: faKey };
case NetScalerConnectionMethod.BasicAuth:
return { name: "Basic Auth", icon: faLock };
+ case KempLoadMasterConnectionMethod.BasicAuth:
+ return { name: "Basic Auth", icon: faLock };
case OVHConnectionMethod.Certificate:
return { name: "Certificate", icon: faCertificate };
case F5BigIpConnectionMethod.BasicAuth:
diff --git a/frontend/src/helpers/pkiSyncs.ts b/frontend/src/helpers/pkiSyncs.ts
index feff1d6264..02b1b4f8fc 100644
--- a/frontend/src/helpers/pkiSyncs.ts
+++ b/frontend/src/helpers/pkiSyncs.ts
@@ -40,6 +40,10 @@ export const PKI_SYNC_MAP: Record<
name: "F5 BIG-IP",
image: "F5 BIG-IP.png"
},
+ [PkiSync.KempLoadMaster]: {
+ name: "Kemp LoadMaster",
+ image: "Kemp LoadMaster.png"
+ },
[PkiSync.LinuxServer]: {
name: "Linux Server",
image: "SSH.png"
@@ -59,6 +63,7 @@ export const PKI_SYNC_CONNECTION_MAP: Record<PkiSync, AppConnection> = {
[PkiSync.CloudflareCustomCertificate]: AppConnection.Cloudflare,
[PkiSync.NetScaler]: AppConnection.NetScaler,
[PkiSync.F5BigIp]: AppConnection.F5BigIp,
+ [PkiSync.KempLoadMaster]: AppConnection.KempLoadMaster,
[PkiSync.LinuxServer]: AppConnection.SSH,
[PkiSync.WindowsServer]: AppConnection.WinRM
};
diff --git a/frontend/src/hooks/api/appConnections/enums.ts b/frontend/src/hooks/api/appConnections/enums.ts
index 963b67f21e..fab51a208e 100644
--- a/frontend/src/hooks/api/appConnections/enums.ts
+++ b/frontend/src/hooks/api/appConnections/enums.ts
@@ -59,6 +59,7 @@ export enum AppConnection {
ExternalInfisical = "external-infisical",
Doppler = "doppler",
NetScaler = "netscaler",
+ KempLoadMaster = "kemp-loadmaster",
Anthropic = "anthropic",
OVH = "ovh",
Devin = "devin",
diff --git a/frontend/src/hooks/api/appConnections/types/app-options.ts b/frontend/src/hooks/api/appConnections/types/app-options.ts
index 00a90ce405..d43260b819 100644
--- a/frontend/src/hooks/api/appConnections/types/app-options.ts
+++ b/frontend/src/hooks/api/appConnections/types/app-options.ts
@@ -263,6 +263,10 @@ export type TNetScalerConnectionOption = TAppConnectionOptionBase & {
app: AppConnection.NetScaler;
};
+export type TKempLoadMasterConnectionOption = TAppConnectionOptionBase & {
+ app: AppConnection.KempLoadMaster;
+};
+
export type TAnthropicConnectionOption = TAppConnectionOptionBase & {
app: AppConnection.Anthropic;
};
@@ -391,6 +395,7 @@ export type TAppConnectionOption =
| TExternalInfisicalConnectionOption
| TDopplerConnectionOption
| TNetScalerConnectionOption
+ | TKempLoadMasterConnectionOption
| TAnthropicConnectionOption
| TOvhConnectionOption
| TDevinConnectionOption
@@ -472,6 +477,7 @@ export type TAppConnectionOptionMap = {
[AppConnection.ExternalInfisical]: TExternalInfisicalConnectionOption;
[AppConnection.Doppler]: TDopplerConnectionOption;
[AppConnection.NetScaler]: TNetScalerConnectionOption;
+ [AppConnection.KempLoadMaster]: TKempLoadMasterConnectionOption;
[AppConnection.Anthropic]: TAnthropicConnectionOption;
[AppConnection.OVH]: TOvhConnectionOption;
[AppConnection.Devin]: TDevinConnectionOption;
diff --git a/frontend/src/hooks/api/appConnections/types/index.ts b/frontend/src/hooks/api/appConnections/types/index.ts
index 0b8a8f4f66..7df597d9e3 100644
--- a/frontend/src/hooks/api/appConnections/types/index.ts
+++ b/frontend/src/hooks/api/appConnections/types/index.ts
@@ -41,6 +41,7 @@ import { THasuraCloudConnection } from "./hasura-cloud-connection";
import { THCVaultConnection } from "./hc-vault-connection";
import { THerokuConnection } from "./heroku-connection";
import { THumanitecConnection } from "./humanitec-connection";
+import { TKempLoadMasterConnection } from "./kemp-loadmaster-connection";
import { TLaravelForgeConnection } from "./laravel-forge-connection";
import { TLdapConnection } from "./ldap-connection";
import { TLiteLLMConnection } from "./litellm-connection";
@@ -118,6 +119,7 @@ export * from "./hasura-cloud-connection";
export * from "./hc-vault-connection";
export * from "./heroku-connection";
export * from "./humanitec-connection";
+export * from "./kemp-loadmaster-connection";
export * from "./laravel-forge-connection";
export * from "./ldap-connection";
export * from "./litellm-connection";
@@ -219,6 +221,7 @@ export type TAppConnection =
| TVenafiTppConnection
| TExternalInfisicalConnection
| TNetScalerConnection
+ | TKempLoadMasterConnection
| TDopplerConnection
| TOvhConnection
| TDevinConnection
diff --git a/frontend/src/hooks/api/appConnections/types/kemp-loadmaster-connection.ts b/frontend/src/hooks/api/appConnections/types/kemp-loadmaster-connection.ts
new file mode 100644
index 0000000000..2c821a239c
--- /dev/null
+++ b/frontend/src/hooks/api/appConnections/types/kemp-loadmaster-connection.ts
@@ -0,0 +1,20 @@
+import { AppConnection } from "@app/hooks/api/appConnections/enums";
+import { TRootAppConnection } from "@app/hooks/api/appConnections/types/root-connection";
+
+export enum KempLoadMasterConnectionMethod {
+ BasicAuth = "basic-auth"
+}
+
+export type TKempLoadMasterConnection = TRootAppConnection & {
+ app: AppConnection.KempLoadMaster;
+} & {
+ method: KempLoadMasterConnectionMethod.BasicAuth;
+ credentials: {
+ hostname: string;
+ port?: number;
+ username: string;
+ password: string;
+ sslRejectUnauthorized?: boolean;
+ sslCertificate?: string;
+ };
+};
diff --git a/frontend/src/hooks/api/pkiSyncs/enums.ts b/frontend/src/hooks/api/pkiSyncs/enums.ts
index ff8203bb9c..52a6cc06cf 100644
--- a/frontend/src/hooks/api/pkiSyncs/enums.ts
+++ b/frontend/src/hooks/api/pkiSyncs/enums.ts
@@ -7,6 +7,7 @@ export enum PkiSync {
CloudflareCustomCertificate = "cloudflare-custom-certificate",
NetScaler = "netscaler",
F5BigIp = "f5-big-ip",
+ KempLoadMaster = "kemp-loadmaster",
LinuxServer = "linux-server",
WindowsServer = "windows-server"
}
diff --git a/frontend/src/hooks/api/pkiSyncs/queries.tsx b/frontend/src/hooks/api/pkiSyncs/queries.tsx
index 48493671cb..5b77f11eaf 100644
--- a/frontend/src/hooks/api/pkiSyncs/queries.tsx
+++ b/frontend/src/hooks/api/pkiSyncs/queries.tsx
@@ -5,6 +5,7 @@ import { PkiSync, TPkiSyncOption } from "@app/hooks/api/pkiSyncs";
import {
TAwsListener,
TAwsLoadBalancer,
+ TKempVirtualService,
TListPkiSyncOptions,
TListPkiSyncs,
TPkiSync,
@@ -29,7 +30,9 @@ export const pkiSyncKeys = {
awsLoadBalancers: (connectionId: string, region: string) =>
[...pkiSyncKeys.all, "aws-load-balancers", connectionId, region] as const,
awsListeners: (connectionId: string, region: string, loadBalancerArn: string) =>
- [...pkiSyncKeys.all, "aws-listeners", connectionId, region, loadBalancerArn] as const
+ [...pkiSyncKeys.all, "aws-listeners", connectionId, region, loadBalancerArn] as const,
+ kempVirtualServices: (connectionId: string) =>
+ [...pkiSyncKeys.all, "kemp-virtual-services", connectionId] as const
};
export const usePkiSyncOptions = (
@@ -230,3 +233,31 @@ export const useListAwsListeners = (
...options
});
};
+
+export const useListKempVirtualServices = (
+ { connectionId }: { connectionId: string },
+ options?: Omit<
+ UseQueryOptions<
+ TKempVirtualService[],
+ unknown,
+ TKempVirtualService[],
+ ReturnType<typeof pkiSyncKeys.kempVirtualServices>
+ >,
+ "queryKey" | "queryFn"
+ >
+) => {
+ return useQuery({
+ queryKey: pkiSyncKeys.kempVirtualServices(connectionId),
+ queryFn: async () => {
+ const { data } = await apiRequest.get<{ virtualServices: TKempVirtualService[] }>(
+ "/api/v1/cert-manager/syncs/kemp-loadmaster/virtual-services",
+ {
+ params: { connectionId }
+ }
+ );
+ return data.virtualServices;
+ },
+ enabled: !!connectionId,
+ ...options
+ });
+};
diff --git a/frontend/src/hooks/api/pkiSyncs/types/index.ts b/frontend/src/hooks/api/pkiSyncs/types/index.ts
index a2082896f1..e68194da31 100644
--- a/frontend/src/hooks/api/pkiSyncs/types/index.ts
+++ b/frontend/src/hooks/api/pkiSyncs/types/index.ts
@@ -7,6 +7,7 @@ import { TAzureKeyVaultPkiSync } from "./azure-key-vault-sync";
import { TChefPkiSync } from "./chef-sync";
import { TCloudflareCustomCertificatePkiSync } from "./cloudflare-custom-certificate-sync";
import { TF5BigIpPkiSync } from "./f5-big-ip-sync";
+import { TKempLoadMasterPkiSync } from "./kemp-loadmaster-sync";
import { TLinuxServerPkiSync } from "./linux-server-sync";
import { TNetScalerPkiSync } from "./netscaler-sync";
import { TWindowsServerPkiSync } from "./windows-server-sync";
@@ -33,6 +34,7 @@ export type TPkiSync =
| TCloudflareCustomCertificatePkiSync
| TNetScalerPkiSync
| TF5BigIpPkiSync
+ | TKempLoadMasterPkiSync
| TLinuxServerPkiSync
| TWindowsServerPkiSync;
@@ -55,6 +57,8 @@ type TCreatePkiSyncDTOBase = {
updateExistingCertificates?: boolean;
preserveSecretOnRenewal?: boolean;
includeRootCa?: boolean;
+ syncCaCertificates?: boolean;
+ caCertificateNameSchema?: string;
exportFormat?: PkiSyncExportFormat;
includePrivateKey?: boolean;
fieldMappings?: {
@@ -88,6 +92,7 @@ export type TCreatePkiSyncDTO = TCreatePkiSyncDTOBase & {
}>;
zoneId?: string;
vserverName?: string;
+ virtualServiceId?: string;
partition?: string;
profileType?: string;
profileName?: string;
@@ -134,6 +139,7 @@ export * from "./chef-sync";
export * from "./cloudflare-custom-certificate-sync";
export * from "./common";
export * from "./f5-big-ip-sync";
+export * from "./kemp-loadmaster-sync";
export * from "./linux-server-sync";
export * from "./netscaler-sync";
export * from "./windows-server-sync";
diff --git a/frontend/src/hooks/api/pkiSyncs/types/kemp-loadmaster-sync.ts b/frontend/src/hooks/api/pkiSyncs/types/kemp-loadmaster-sync.ts
new file mode 100644
index 0000000000..4b55696f1d
--- /dev/null
+++ b/frontend/src/hooks/api/pkiSyncs/types/kemp-loadmaster-sync.ts
@@ -0,0 +1,24 @@
+import { AppConnection } from "@app/hooks/api/appConnections/enums";
+
+import { PkiSync } from "../enums";
+import { TRootPkiSync } from "./common";
+
+export type TKempVirtualService = {
+ id: string;
+ name: string;
+ address: string;
+ port: number;
+ protocol: string;
+};
+
+export type TKempLoadMasterPkiSync = TRootPkiSync & {
+ destination: PkiSync.KempLoadMaster;
+ destinationConfig: {
+ virtualServiceId?: string;
+ };
+ connection: {
+ app: AppConnection.KempLoadMaster;
+ name: string;
+ id: string;
+ };
+};
diff --git a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection.tsx b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection.tsx
index c24e1f2aee..f350d02d77 100644
--- a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection.tsx
+++ b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection.tsx
@@ -14,6 +14,7 @@ import {
AzureKeyVaultPkiSyncDestinationSection,
ChefPkiSyncDestinationSection,
F5BigIpPkiSyncDestinationSection,
+ KempLoadMasterPkiSyncDestinationSection,
LinuxServerPkiSyncDestinationSection,
NetScalerPkiSyncDestinationSection,
WindowsServerPkiSyncDestinationSection
@@ -59,6 +60,9 @@ export const PkiSyncDestinationSection = ({ pkiSync, onEditDestination }: Props)
case PkiSync.F5BigIp:
DestinationComponents = <F5BigIpPkiSyncDestinationSection pkiSync={pkiSync} />;
break;
+ case PkiSync.KempLoadMaster:
+ DestinationComponents = <KempLoadMasterPkiSyncDestinationSection pkiSync={pkiSync} />;
+ break;
case PkiSync.LinuxServer:
DestinationComponents = <LinuxServerPkiSyncDestinationSection pkiSync={pkiSync} />;
break;
diff --git a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/KempLoadMasterPkiSyncDestinationSection.tsx b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/KempLoadMasterPkiSyncDestinationSection.tsx
new file mode 100644
index 0000000000..66f408fd69
--- /dev/null
+++ b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/KempLoadMasterPkiSyncDestinationSection.tsx
@@ -0,0 +1,25 @@
+/* eslint-disable jsx-a11y/label-has-associated-control */
+import { TKempLoadMasterPkiSync } from "@app/hooks/api/pkiSyncs/types/kemp-loadmaster-sync";
+
+const GenericFieldLabel = ({ label, children }: { label: string; children: React.ReactNode }) => (
+ <div className="mb-4">
+ <p className="text-sm font-medium text-mineshaft-300">{label}</p>
+ <div className="text-sm text-mineshaft-300">{children}</div>
+ </div>
+);
+
+type Props = {
+ pkiSync: TKempLoadMasterPkiSync;
+};
+
+export const KempLoadMasterPkiSyncDestinationSection = ({ pkiSync }: Props) => {
+ if (!pkiSync.destinationConfig.virtualServiceId) {
+ return null;
+ }
+
+ return (
+ <GenericFieldLabel label="Virtual Service">
+ {pkiSync.destinationConfig.virtualServiceId}
+ </GenericFieldLabel>
+ );
+};
diff --git a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/index.ts b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/index.ts
index 435fde4d0d..a767aa1786 100644
--- a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/index.ts
+++ b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/index.ts
@@ -4,6 +4,7 @@ export { AwsSecretsManagerPkiSyncDestinationSection } from "./AwsSecretsManagerP
export { AzureKeyVaultPkiSyncDestinationSection } from "./AzureKeyVaultPkiSyncDestinationSection";
export { ChefPkiSyncDestinationSection } from "./ChefPkiSyncDestinationSection";
export { F5BigIpPkiSyncDestinationSection } from "./F5BigIpPkiSyncDestinationSection";
+export { KempLoadMasterPkiSyncDestinationSection } from "./KempLoadMasterPkiSyncDestinationSection";
export { LinuxServerPkiSyncDestinationSection } from "./LinuxServerPkiSyncDestinationSection";
export { NetScalerPkiSyncDestinationSection } from "./NetScalerPkiSyncDestinationSection";
export { WindowsServerPkiSyncDestinationSection } from "./WindowsServerPkiSyncDestinationSection";
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx
index 648766e265..9a3b3a8c55 100644
--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx
@@ -56,6 +56,7 @@ import { HasuraCloudConnectionForm } from "./HasuraCloudConnectionForm";
import { HCVaultConnectionForm } from "./HCVaultConnectionForm";
import { HerokuConnectionForm } from "./HerokuAppConnectionForm";
import { HumanitecConnectionForm } from "./HumanitecConnectionForm";
+import { KempLoadMasterConnectionForm } from "./KempLoadMasterConnectionForm";
import { LaravelForgeConnectionForm } from "./LaravelForgeConnectionForm";
import { LdapConnectionForm } from "./LdapConnectionForm";
import { LiteLLMConnectionForm } from "./LiteLLMConnectionForm";
@@ -329,6 +330,8 @@ const CreateForm = ({ app, onComplete, projectId }: CreateFormProps) => {
return <DopplerConnectionForm onSubmit={onSubmit} />;
case AppConnection.NetScaler:
return <NetScalerConnectionForm onSubmit={onSubmit} />;
+ case AppConnection.KempLoadMaster:
+ return <KempLoadMasterConnectionForm onSubmit={onSubmit} />;
case AppConnection.OVH:
return <OVHConnectionForm onSubmit={onSubmit} />;
case AppConnection.Ona:
@@ -592,6 +595,8 @@ const UpdateForm = ({ appConnection, onComplete }: UpdateFormProps) => {
return <DopplerConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
case AppConnection.NetScaler:
return <NetScalerConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
+ case AppConnection.KempLoadMaster:
+ return <KempLoadMasterConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
case AppConnection.OVH:
return <OVHConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
case AppConnection.Ona:
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/KempLoadMasterConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/KempLoadMasterConnectionForm.tsx
new file mode 100644
index 0000000000..b8b055a213
--- /dev/null
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/KempLoadMasterConnectionForm.tsx
@@ -0,0 +1,326 @@
+import { useState } from "react";
+import { Controller, FormProvider, useForm } from "react-hook-form";
+import { zodResolver } from "@hookform/resolvers/zod";
+import { Info } from "lucide-react";
+import { z } from "zod";
+
+import { OrgPermissionCan } from "@app/components/permissions";
+import {
+ Field,
+ FieldContent,
+ FieldDescription,
+ FieldError,
+ FieldLabel,
+ Input,
+ Label,
+ SecretInput,
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+ Switch,
+ Tabs,
+ TabsContent,
+ TabsList,
+ TabsTrigger,
+ TextArea,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger
+} from "@app/components/v3";
+import { GatewayPicker } from "@app/components/v3/platform/GatewayPicker";
+import { OrgPermissionSubjects } from "@app/context";
+import { OrgGatewayPermissionActions } from "@app/context/OrgPermissionContext/types";
+import { APP_CONNECTION_MAP, getAppConnectionMethodDetails } from "@app/helpers/appConnections";
+import { useScopeVariant } from "@app/hooks";
+import {
+ KempLoadMasterConnectionMethod,
+ TKempLoadMasterConnection
+} from "@app/hooks/api/appConnections";
+import { AppConnection } from "@app/hooks/api/appConnections/enums";
+
+import { AppConnectionFormFooter } from "./AppConnectionFormFooter";
+import {
+ genericAppConnectionFieldsSchema,
+ GenericAppConnectionsFields
+} from "./GenericAppConnectionFields";
+
+type Props = {
+ appConnection?: TKempLoadMasterConnection;
+ onSubmit: (formData: FormData) => Promise<void>;
+};
+
+const rootSchema = genericAppConnectionFieldsSchema.extend({
+ app: z.literal(AppConnection.KempLoadMaster)
+});
+
+const formSchema = z.discriminatedUnion("method", [
+ rootSchema.extend({
+ method: z.literal(KempLoadMasterConnectionMethod.BasicAuth),
+ credentials: z.object({
+ hostname: z
+ .string()
+ .trim()
+ .min(1, "Hostname is required")
+ .max(512, "Hostname cannot exceed 512 characters"),
+ port: z
+ .union([z.coerce.number().int().min(1).max(65535), z.literal("")])
+ .optional()
+ .transform((val) => (val === "" ? undefined : val)),
+ username: z
+ .string()
+ .trim()
+ .min(1, "Username is required")
+ .max(256, "Username cannot exceed 256 characters"),
+ password: z
+ .string()
+ .trim()
+ .min(1, "Password is required")
+ .max(512, "Password cannot exceed 512 characters"),
+ sslRejectUnauthorized: z.boolean(),
+ sslCertificate: z
+ .string()
+ .trim()
+ .transform((value) => value || undefined)
+ .optional()
+ })
+ })
+]);
+
+type FormData = z.infer<typeof formSchema>;
+
+export const KempLoadMasterConnectionForm = ({ appConnection, onSubmit }: Props) => {
+ const isUpdate = Boolean(appConnection);
+ const [selectedTab, setSelectedTab] = useState("configuration");
+
+ const form = useForm<FormData>({
+ resolver: zodResolver(formSchema),
+ defaultValues: appConnection ?? {
+ app: AppConnection.KempLoadMaster,
+ method: KempLoadMasterConnectionMethod.BasicAuth,
+ gatewayId: null,
+ gatewayPoolId: null,
+ credentials: {
+ sslRejectUnauthorized: false,
+ sslCertificate: undefined
+ }
+ }
+ });
+
+ const { handleSubmit, control, setValue, watch } = form;
+ const scopeVariant = useScopeVariant();
+
+ const gatewayId = watch("gatewayId");
+ const gatewayPoolId = watch("gatewayPoolId");
+
+ return (
+ <FormProvider {...form}>
+ <form onSubmit={handleSubmit(onSubmit)}>
+ {!isUpdate && <GenericAppConnectionsFields />}
+ <OrgPermissionCan
+ I={OrgGatewayPermissionActions.AttachGateways}
+ a={OrgPermissionSubjects.Gateway}
+ >
+ {(isAllowed) => (
+ <Field className="mb-4">
+ <FieldLabel>Gateway</FieldLabel>
+ {isAllowed ? (
+ <GatewayPicker
+ isDisabled={!isAllowed}
+ value={{ gatewayId: gatewayId ?? null, gatewayPoolId: gatewayPoolId ?? null }}
+ onChange={({ gatewayId: newGwId, gatewayPoolId: newPoolId }) => {
+ setValue("gatewayId", newGwId, { shouldDirty: true });
+ setValue("gatewayPoolId", newPoolId, { shouldDirty: true });
+ }}
+ />
+ ) : (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <div>
+ <GatewayPicker
+ isDisabled={!isAllowed}
+ value={{
+ gatewayId: gatewayId ?? null,
+ gatewayPoolId: gatewayPoolId ?? null
+ }}
+ onChange={({ gatewayId: newGwId, gatewayPoolId: newPoolId }) => {
+ setValue("gatewayId", newGwId, { shouldDirty: true });
+ setValue("gatewayPoolId", newPoolId, { shouldDirty: true });
+ }}
+ />
+ </div>
+ </TooltipTrigger>
+ <TooltipContent>
+ Restricted access. You don&apos;t have permission to attach gateways to
+ resources.
+ </TooltipContent>
+ </Tooltip>
+ )}
+ </Field>
+ )}
+ </OrgPermissionCan>
+ <Controller
+ name="method"
+ control={control}
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <Field className="mb-4">
+ <FieldLabel>
+ Method
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Info />
+ </TooltipTrigger>
+ <TooltipContent className="max-w-sm">
+ {`The method you would like to use to connect with ${
+ APP_CONNECTION_MAP[AppConnection.KempLoadMaster].name
+ }. This field cannot be changed after creation.`}
+ </TooltipContent>
+ </Tooltip>
+ </FieldLabel>
+ <Select disabled={isUpdate} value={value} onValueChange={(val) => onChange(val)}>
+ <SelectTrigger className="w-full" isError={Boolean(error)}>
+ <SelectValue placeholder="Select a method..." />
+ </SelectTrigger>
+ <SelectContent position="popper">
+ {Object.values(KempLoadMasterConnectionMethod).map((method) => {
+ return (
+ <SelectItem value={method} key={method}>
+ {getAppConnectionMethodDetails(method).name}
+ </SelectItem>
+ );
+ })}
+ </SelectContent>
+ </Select>
+ <FieldError errors={[error]} />
+ </Field>
+ )}
+ />
+ <Tabs value={selectedTab} onValueChange={setSelectedTab} className="mb-4">
+ <TabsList variant={scopeVariant}>
+ <TabsTrigger value="configuration">Configuration</TabsTrigger>
+ <TabsTrigger value="ssl">SSL</TabsTrigger>
+ </TabsList>
+ <TabsContent value="configuration">
+ <Controller
+ name="credentials.hostname"
+ control={control}
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <Field className="mb-4">
+ <FieldLabel htmlFor="credentials-hostname">Hostname</FieldLabel>
+ <Input
+ id="credentials-hostname"
+ value={value}
+ onChange={(e) => onChange(e.target.value)}
+ placeholder="e.g. lm.example.com"
+ isError={Boolean(error?.message)}
+ />
+ <FieldError errors={[error]} />
+ </Field>
+ )}
+ />
+ <div className="grid grid-cols-2 gap-2">
+ <Controller
+ name="credentials.username"
+ control={control}
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <Field className="mb-4">
+ <FieldLabel htmlFor="credentials-username">Username</FieldLabel>
+ <Input
+ id="credentials-username"
+ value={value}
+ onChange={(e) => onChange(e.target.value)}
+ placeholder="bal"
+ isError={Boolean(error?.message)}
+ />
+ <FieldError errors={[error]} />
+ </Field>
+ )}
+ />
+ <Controller
+ name="credentials.password"
+ control={control}
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <Field className="mb-4">
+ <FieldLabel>Password</FieldLabel>
+ <SecretInput value={value} onChange={(e) => onChange(e.target.value)} />
+ <FieldError errors={[error]} />
+ </Field>
+ )}
+ />
+ </div>
+ <Controller
+ name="credentials.port"
+ control={control}
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <Field className="mb-4">
+ <FieldLabel htmlFor="credentials-port">
+ Port <span className="text-muted">(optional)</span>
+ </FieldLabel>
+ <Input
+ id="credentials-port"
+ type="number"
+ value={value ?? ""}
+ onChange={(e) => onChange(e.target.value ? Number(e.target.value) : undefined)}
+ placeholder="8443"
+ isError={Boolean(error?.message)}
+ />
+ <FieldError errors={[error]} />
+ </Field>
+ )}
+ />
+ </TabsContent>
+ <TabsContent value="ssl">
+ <Controller
+ name="credentials.sslCertificate"
+ control={control}
+ render={({ field, fieldState: { error } }) => (
+ <Field className="mb-4">
+ <FieldLabel htmlFor="ssl-certificate">
+ SSL Certificate <span className="text-muted">(optional)</span>
+ </FieldLabel>
+ <TextArea
+ id="ssl-certificate"
+ className="h-[3.6rem] resize-none!"
+ {...field}
+ placeholder="-----BEGIN CERTIFICATE----- ... -----END CERTIFICATE-----"
+ isError={Boolean(error?.message)}
+ />
+ <FieldError errors={[error]} />
+ </Field>
+ )}
+ />
+ <Controller
+ name="credentials.sslRejectUnauthorized"
+ control={control}
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <Field>
+ <Field orientation="horizontal">
+ <FieldContent>
+ <Label htmlFor="ssl-reject-unauthorized">Reject Unauthorized</Label>
+ <FieldDescription>
+ If enabled, Infisical will only connect to the LoadMaster if it has a valid,
+ trusted SSL certificate. Disable this for self-signed certificates or
+ provide a CA certificate above.
+ </FieldDescription>
+ </FieldContent>
+ <Switch
+ id="ssl-reject-unauthorized"
+ variant={scopeVariant}
+ checked={value}
+ onCheckedChange={onChange}
+ />
+ </Field>
+ <FieldError errors={[error]} />
+ </Field>
+ )}
+ />
+ </TabsContent>
+ </Tabs>
+ <AppConnectionFormFooter
+ submitLabel={isUpdate ? "Update Credentials" : "Connect to Kemp LoadMaster"}
+ />
+ </form>
+ </FormProvider>
+ );
+};