Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
feat(kmip): remove machine identities from KMIP server registration
bernie-g545b595ab6a9
diff --git a/backend/src/@types/fastify.d.ts b/backend/src/@types/fastify.d.tsindex d57f51c23d..6417f5e34a 100644--- a/backend/src/@types/fastify.d.ts+++ b/backend/src/@types/fastify.d.ts@@ -30,6 +30,7 @@ import { TInsightsServiceFactory } from "@app/ee/services/insights/insights-servimport { TKmipClientDALFactory } from "@app/ee/services/kmip/kmip-client-dal";import { TKmipOperationServiceFactory } from "@app/ee/services/kmip/kmip-operation-service";import { TKmipServiceFactory } from "@app/ee/services/kmip/kmip-service";+import { TKmipServerServiceFactory } from "@app/ee/services/kmip-server/kmip-server-service";import { TLdapConfigServiceFactory } from "@app/ee/services/ldap-config/ldap-config-service";import { TLicenseServiceFactory } from "@app/ee/services/license/license-service";import { TOidcConfigServiceFactory } from "@app/ee/services/oidc/oidc-config-service";@@ -381,6 +382,7 @@ declare module "fastify" {secretSync: TSecretSyncServiceFactory;kmip: TKmipServiceFactory;kmipOperation: TKmipOperationServiceFactory;+ kmipServer: TKmipServerServiceFactory;gateway: TGatewayServiceFactory;secretRotationV2: TSecretRotationV2ServiceFactory;microsoftTeams: TMicrosoftTeamsServiceFactory;diff --git a/backend/src/@types/knex.d.ts b/backend/src/@types/knex.d.tsindex c9e2f265ed..d5bbe5f5a3 100644--- a/backend/src/@types/knex.d.ts+++ b/backend/src/@types/knex.d.ts@@ -281,6 +281,9 @@ import {TKmipOrgServerCertificates,TKmipOrgServerCertificatesInsert,TKmipOrgServerCertificatesUpdate,+ TKmipServers,+ TKmipServersInsert,+ TKmipServersUpdate,TKmsKeys,TKmsKeysInsert,TKmsKeysUpdate,@@ -1517,6 +1520,7 @@ declare module "knex/types/tables" {TKmipClientCertificatesInsert,TKmipClientCertificatesUpdate>;+ [TableName.KmipServer]: KnexOriginal.CompositeTableType<TKmipServers, TKmipServersInsert, TKmipServersUpdate>;[TableName.Gateway]: KnexOriginal.CompositeTableType<TGateways, TGatewaysInsert, TGatewaysUpdate>;[TableName.ProjectGateway]: KnexOriginal.CompositeTableType<TProjectGateways,diff --git a/backend/src/db/migrations/20260603120000_kmip-server-resource-auth.ts b/backend/src/db/migrations/20260603120000_kmip-server-resource-auth.tsnew file mode 100644index 0000000000..3c9d7f02ee--- /dev/null+++ b/backend/src/db/migrations/20260603120000_kmip-server-resource-auth.ts@@ -0,0 +1,61 @@+import { Knex } from "knex";++import { TableName } from "../schemas";+import { createOnUpdateTrigger, dropOnUpdateTrigger } from "../utils";++export async function up(knex: Knex): Promise<void> {+ // 1. kmip_servers — first-class org resource representing an enrolled KMIP server,+ // mirroring the relays table. Unlike gateways/relays there is no identityId column:+ // KMIP servers are always created via enrollment (token/AWS), never machine-identity.+ // The legacy machine-identity registration path does not create rows here.+ if (!(await knex.schema.hasTable(TableName.KmipServer))) {+ await knex.schema.createTable(TableName.KmipServer, (t) => {+ t.uuid("id", { primaryKey: true }).defaultTo(knex.fn.uuid());+ t.timestamps(true, true, true);++ t.uuid("orgId").notNullable();+ t.foreign("orgId").references("id").inTable(TableName.Organization).onDelete("CASCADE");++ t.string("name").notNullable();+ t.datetime("heartbeat");+ t.integer("tokenVersion").notNullable().defaultTo(0);++ t.unique(["orgId", "name"]);+ });++ await createOnUpdateTrigger(knex, TableName.KmipServer);+ }++ // 2. Add kmipServerId FK to resource_auth_methods — same nullable-FK-per-resource-type+ // pattern used for gatewayId/relayId (see 20260430143000_resource-auth-methods.ts).+ if (await knex.schema.hasTable(TableName.ResourceAuthMethod)) {+ const hasKmipServerId = await knex.schema.hasColumn(TableName.ResourceAuthMethod, "kmipServerId");+ if (!hasKmipServerId) {+ await knex.schema.alterTable(TableName.ResourceAuthMethod, (t) => {+ t.uuid("kmipServerId").nullable();+ t.foreign("kmipServerId").references("id").inTable(TableName.KmipServer).onDelete("CASCADE");+ });++ await knex.schema.raw(`+ CREATE UNIQUE INDEX one_method_per_kmip_server+ ON ${TableName.ResourceAuthMethod} ("kmipServerId")+ WHERE "kmipServerId" IS NOT NULL+ `);+ }+ }+}++export async function down(knex: Knex): Promise<void> {+ if (await knex.schema.hasTable(TableName.ResourceAuthMethod)) {+ const hasKmipServerId = await knex.schema.hasColumn(TableName.ResourceAuthMethod, "kmipServerId");+ if (hasKmipServerId) {+ await knex.schema.raw(`DROP INDEX IF EXISTS one_method_per_kmip_server`);+ await knex.schema.alterTable(TableName.ResourceAuthMethod, (t) => {+ t.dropColumn("kmipServerId");+ });+ }+ }++ await dropOnUpdateTrigger(knex, TableName.KmipServer);+ await knex.schema.dropTableIfExists(TableName.KmipServer);+}diff --git a/backend/src/db/schemas/index.ts b/backend/src/db/schemas/index.tsindex b8847a802b..2cfb912576 100644--- a/backend/src/db/schemas/index.ts+++ b/backend/src/db/schemas/index.ts@@ -101,6 +101,7 @@ export * from "./kmip-client-certificates";export * from "./kmip-clients";export * from "./kmip-org-configs";export * from "./kmip-org-server-certificates";+export * from "./kmip-servers";export * from "./kms-key-versions";export * from "./kms-keys";export * from "./kms-root-config";diff --git a/backend/src/db/schemas/kmip-servers.ts b/backend/src/db/schemas/kmip-servers.tsnew file mode 100644index 0000000000..8c020ad771--- /dev/null+++ b/backend/src/db/schemas/kmip-servers.ts@@ -0,0 +1,22 @@+// Code generated by automation script, DO NOT EDIT.+// Automated by pulling database and generating zod schema+// To update. Just run npm run generate:schema+// Written by akhilmhdh.++import { z } from "zod";++import { TImmutableDBKeys } from "./models";++export const KmipServersSchema = z.object({+ id: z.string().uuid(),+ createdAt: z.date(),+ updatedAt: z.date(),+ orgId: z.string().uuid(),+ name: z.string(),+ heartbeat: z.date().nullable().optional(),+ tokenVersion: z.number().default(0)+});++export type TKmipServers = z.infer<typeof KmipServersSchema>;+export type TKmipServersInsert = Omit<z.input<typeof KmipServersSchema>, TImmutableDBKeys>;+export type TKmipServersUpdate = Partial<Omit<z.input<typeof KmipServersSchema>, TImmutableDBKeys>>;diff --git a/backend/src/db/schemas/models.ts b/backend/src/db/schemas/models.tsindex 4161c1d5b0..d600224105 100644--- a/backend/src/db/schemas/models.ts+++ b/backend/src/db/schemas/models.ts@@ -186,6 +186,7 @@ export enum TableName {KmipOrgConfig = "kmip_org_configs",KmipOrgServerCertificates = "kmip_org_server_certificates",KmipClientCertificates = "kmip_client_certificates",+ KmipServer = "kmip_servers",SecretRotationV2 = "secret_rotations_v2",SecretRotationV2SecretMapping = "secret_rotation_v2_secret_mappings",MicrosoftTeamsIntegrations = "microsoft_teams_integrations",diff --git a/backend/src/db/schemas/resource-auth-methods.ts b/backend/src/db/schemas/resource-auth-methods.tsindex 187956282a..8a66b21df2 100644--- a/backend/src/db/schemas/resource-auth-methods.ts+++ b/backend/src/db/schemas/resource-auth-methods.ts@@ -13,7 +13,8 @@ export const ResourceAuthMethodsSchema = z.object({method: z.string(),createdAt: z.date(),updatedAt: z.date(),- relayId: z.string().uuid().nullable().optional()+ relayId: z.string().uuid().nullable().optional(),+ kmipServerId: z.string().uuid().nullable().optional()});export type TResourceAuthMethods = z.infer<typeof ResourceAuthMethodsSchema>;diff --git a/backend/src/ee/routes/v1/index.ts b/backend/src/ee/routes/v1/index.tsindex e01b59e78e..4e78cf002d 100644--- a/backend/src/ee/routes/v1/index.ts+++ b/backend/src/ee/routes/v1/index.ts@@ -27,6 +27,7 @@ import { registerIdentityProjectAdditionalPrivilegeRouter } from "./identity-proimport { registerIdentityTemplateRouter } from "./identity-template-router";import { registerInsightsRouter } from "./insights-router";import { registerKmipRouter } from "./kmip-router";+import { registerKmipServerRouter } from "./kmip-server-router";import { registerKmipSpecRouter } from "./kmip-spec-router";import { registerLdapRouter } from "./ldap-router";import { registerLicenseRouter } from "./license-router";@@ -214,6 +215,8 @@ export const registerV1EERoutes = async (server: FastifyZodProvider) => {{ prefix: "/kmip" });+ await server.register(registerKmipServerRouter, { prefix: "/kmip-servers" });+await server.register(async (pamRouter) => {await pamRouter.register(registerPamFolderRouter, { prefix: "/folders" });diff --git a/backend/src/ee/routes/v1/kmip-router.ts b/backend/src/ee/routes/v1/kmip-router.tsindex 78d82a3850..6dc44aeb70 100644--- a/backend/src/ee/routes/v1/kmip-router.ts+++ b/backend/src/ee/routes/v1/kmip-router.ts@@ -352,8 +352,10 @@ export const registerKmipRouter = async (server: FastifyZodProvider) => {})}},- onRequest: verifyAuth([AuthMode.IDENTITY_ACCESS_TOKEN]),+ onRequest: verifyAuth([AuthMode.IDENTITY_ACCESS_TOKEN, AuthMode.KMIP_SERVER_ACCESS_TOKEN]),handler: async (req) => {+ const { hostnamesOrIps } = req.body;+const configs = await server.services.kmip.registerServer({actor: req.permission.type,actorId: req.permission.id,@@ -369,7 +371,7 @@ export const registerKmipRouter = async (server: FastifyZodProvider) => {type: EventType.REGISTER_KMIP_SERVER,metadata: {serverCertificateSerialNumber: configs.serverCertificateSerialNumber,- hostnamesOrIps: req.body.hostnamesOrIps,+ hostnamesOrIps,commonName: req.body.commonName ?? "kmip-server",keyAlgorithm: req.body.keyAlgorithm,ttl: req.body.ttldiff --git a/backend/src/ee/routes/v1/kmip-server-router.ts b/backend/src/ee/routes/v1/kmip-server-router.tsnew file mode 100644index 0000000000..29b2eda554--- /dev/null+++ b/backend/src/ee/routes/v1/kmip-server-router.ts@@ -0,0 +1,462 @@+import z from "zod";++import { KmipServersSchema } from "@app/db/schemas";+import { EventType, UserAgentType } from "@app/ee/services/audit-log/audit-log-types";+import { validateAccountIds, validatePrincipalArns } from "@app/ee/services/resource-auth-method/aws-auth-validators";+import { ResourceAuthMethodType } from "@app/ee/services/resource-auth-method/resource-auth-method-fns";+import { UnauthorizedError } from "@app/lib/errors";+import { readLimit, writeLimit } from "@app/server/config/rateLimiter";+import { slugSchema } from "@app/server/lib/schemas";+import { verifyAuth } from "@app/server/plugins/auth/verify-auth";+import { ActorType, AuthMode } from "@app/services/auth/auth-type";++const loginRateLimit = { windowMs: 60 * 1000, max: 10 };++const SanitizedKmipServerSchema = KmipServersSchema.pick({+ id: true,+ name: true,+ createdAt: true,+ updatedAt: true,+ heartbeat: true+}).extend({+ canRevoke: z.boolean()+});++const AwsAuthMethodConfigSchema = z.object({+ id: z.string().uuid(),+ stsEndpoint: z.string(),+ allowedPrincipalArns: z.string(),+ allowedAccountIds: z.string(),+ createdAt: z.date(),+ updatedAt: z.date()+});++const TokenAuthMethodConfigSchema = z.object({});++const IdentityAuthMethodConfigSchema = z.object({+ identityId: z.string(),+ identityName: z.string().nullable()+});++const AuthMethodViewSchema = z.discriminatedUnion("method", [+ z.object({ method: z.literal(ResourceAuthMethodType.Aws), config: AwsAuthMethodConfigSchema }),+ z.object({ method: z.literal(ResourceAuthMethodType.Token), config: TokenAuthMethodConfigSchema }),+ z.object({ method: z.literal(ResourceAuthMethodType.Identity), config: IdentityAuthMethodConfigSchema })+]);++const KmipServerWithAuthMethodSchema = SanitizedKmipServerSchema.extend({+ authMethod: AuthMethodViewSchema+});++const AwsAuthMethodInputSchema = z+ .object({+ method: z.literal(ResourceAuthMethodType.Aws),+ stsEndpoint: z.string().trim().min(1).default("https://sts.amazonaws.com/"),+ allowedPrincipalArns: validatePrincipalArns,+ allowedAccountIds: validateAccountIds+ })+ .refine((data) => data.allowedPrincipalArns.trim().length > 0 || data.allowedAccountIds.trim().length > 0, {+ message: "At least one of allowedPrincipalArns or allowedAccountIds must be set",+ path: ["allowedPrincipalArns"]+ });++const TokenAuthMethodInputSchema = z.object({+ method: z.literal(ResourceAuthMethodType.Token)+});++const SettableAuthMethodInputSchema = z.union([AwsAuthMethodInputSchema, TokenAuthMethodInputSchema]);++export const registerKmipServerRouter = async (server: FastifyZodProvider) => {+ // ─── POST / (Create KMIP server) ──────────────────────────────────────────+ server.route({+ method: "POST",+ url: "/",+ config: { rateLimit: writeLimit },+ schema: {+ description: "Create a new KMIP server with an initial auth method.",+ body: z.object({+ name: slugSchema({ min: 1, max: 32, field: "name" }),+ authMethod: SettableAuthMethodInputSchema+ }),+ response: {+ 200: KmipServerWithAuthMethodSchema+ }+ },+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),+ handler: async (req) => {+ const { authMethod: authMethodInput, name } = req.body;+ const authMethodArg =+ authMethodInput.method === ResourceAuthMethodType.Aws+ ? {+ method: "aws" as const,+ config: {+ stsEndpoint: authMethodInput.stsEndpoint,+ allowedPrincipalArns: authMethodInput.allowedPrincipalArns,+ allowedAccountIds: authMethodInput.allowedAccountIds+ }+ }+ : { method: "token" as const };++ const kmipServer = await server.services.kmipServer.createKmipServer({+ name,+ authMethod: authMethodArg,+ actor: {+ type: req.permission.type,+ id: req.permission.id,+ orgId: req.permission.orgId,+ authMethod: req.permission.authMethod+ }+ });++ const view = await server.services.resourceAuthMethod.loadView({ type: "kmip", id: kmipServer.id });+ if (!view) throw new UnauthorizedError({ message: "Auth method missing after create" });++ await server.services.auditLog.createAuditLog({+ ...req.auditLogInfo,+ orgId: req.permission.orgId,+ event: {+ type: EventType.KMIP_SERVER_CREATE,+ metadata: { kmipServerId: kmipServer.id, name: kmipServer.name }+ }+ });++ const canRevoke = await server.services.resourceAuthMethod.canRevoke(kmipServer, "kmip");++ return { ...kmipServer, canRevoke, authMethod: view };+ }+ });++ // ─── GET /:kmipServerId ───────────────────────────────────────────────────+ server.route({+ method: "GET",+ url: "/:kmipServerId",+ config: { rateLimit: readLimit },+ schema: {+ params: z.object({ kmipServerId: z.string().uuid() }),+ response: {+ 200: KmipServerWithAuthMethodSchema+ }+ },+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),+ handler: async (req) => {+ const kmipServer = await server.services.kmipServer.getOrgKmipServer({+ kmipServerId: req.params.kmipServerId,+ orgId: req.permission.orgId+ });++ const view = await server.services.resourceAuthMethod.getByKmipServerId({+ resource: { type: "kmip", id: req.params.kmipServerId },+ actor: req.permission+ });++ const canRevoke = await server.services.resourceAuthMethod.canRevoke(kmipServer, "kmip");++ return { ...kmipServer, canRevoke, authMethod: view };+ }+ });++ // ─── GET / (List KMIP servers) ────────────────────────────────────────────+ server.route({+ method: "GET",+ url: "/",+ config: { rateLimit: readLimit },+ schema: {+ response: {+ 200: z.array(SanitizedKmipServerSchema.omit({ canRevoke: true }))+ }+ },+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),+ handler: async (req) => {+ return server.services.kmipServer.listKmipServers({ actor: req.permission });+ }+ });++ // ─── PATCH /:kmipServerId ─────────────────────────────────────────────────+ server.route({+ method: "PATCH",+ url: "/:kmipServerId",+ config: { rateLimit: writeLimit },+ schema: {+ params: z.object({ kmipServerId: z.string().uuid() }),+ body: z.object({+ authMethod: SettableAuthMethodInputSchema.optional()+ }),+ response: {+ 200: KmipServerWithAuthMethodSchema+ }+ },+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),+ handler: async (req) => {+ const kmipServer = await server.services.kmipServer.getOrgKmipServer({+ kmipServerId: req.params.kmipServerId,+ orgId: req.permission.orgId+ });++ if (req.body.authMethod) {+ const authMethodInput = req.body.authMethod;+ const authMethodArg =+ authMethodInput.method === ResourceAuthMethodType.Aws+ ? {+ method: "aws" as const,+ stsEndpoint: authMethodInput.stsEndpoint,+ allowedPrincipalArns: authMethodInput.allowedPrincipalArns,+ allowedAccountIds: authMethodInput.allowedAccountIds+ }+ : { method: "token" as const };++ const view = await server.services.resourceAuthMethod.setMethod({+ resource: { type: "kmip", id: req.params.kmipServerId },+ authMethod: authMethodArg,+ actor: req.permission+ });++ await server.services.auditLog.createAuditLog({+ ...req.auditLogInfo,+ orgId: req.permission.orgId,+ event: {+ type: EventType.RESOURCE_AUTH_METHOD_UPDATE,+ metadata: {+ resourceType: "kmip",+ resourceId: req.params.kmipServerId,+ method: view.method as "aws" | "token",+ methodConfigId: "config" in view && "id" in view.config ? view.config.id : req.params.kmipServerId+ }+ }+ });++ const canRevoke = await server.services.resourceAuthMethod.canRevoke(kmipServer, "kmip");+ return { ...kmipServer, canRevoke, authMethod: view };+ }++ const view = await server.services.resourceAuthMethod.getByKmipServerId({+ resource: { type: "kmip", id: req.params.kmipServerId },+ actor: req.permission+ });+ const canRevoke = await server.services.resourceAuthMethod.canRevoke(kmipServer, "kmip");+ return { ...kmipServer, canRevoke, authMethod: view };+ }+ });++ // ─── POST /:kmipServerId/token-auth/generate-enrollment-token ─────────────+ server.route({+ method: "POST",+ url: "/:kmipServerId/token-auth/generate-enrollment-token",+ config: { rateLimit: writeLimit },+ schema: {+ params: z.object({ kmipServerId: z.string().uuid() }),+ response: {+ 200: z.object({ token: z.string(), expiresAt: z.date() })+ }+ },+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),+ handler: async (req) => {+ const result = await server.services.resourceAuthMethod.mintToken({+ resource: { type: "kmip", id: req.params.kmipServerId },+ actor: req.permission+ });++ await server.services.auditLog.createAuditLog({+ ...req.auditLogInfo,+ orgId: req.permission.orgId,+ event: {+ type: EventType.KMIP_SERVER_ENROLLMENT_TOKEN_CREATE,+ metadata: { tokenId: result.id, name: result.resourceName }+ }+ });++ return { token: result.token, expiresAt: result.expiresAt };+ }+ });++ // ─── POST /:kmipServerId/revoke ───────────────────────────────────────────+ server.route({+ method: "POST",+ url: "/:kmipServerId/revoke",+ config: { rateLimit: writeLimit },+ schema: {+ params: z.object({ kmipServerId: z.string().uuid() }),+ response: {+ 200: z.object({ method: z.string(), deletedTokenCount: z.number() })+ }+ },+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),+ handler: async (req) => {+ const result = await server.services.resourceAuthMethod.revokeAccess({+ resource: { type: "kmip", id: req.params.kmipServerId },+ actor: req.permission+ });++ await server.services.auditLog.createAuditLog({+ ...req.auditLogInfo,+ orgId: req.permission.orgId,+ event: {+ type: EventType.RESOURCE_AUTH_METHOD_REVOKE,+ metadata: {+ resourceType: "kmip",+ resourceId: req.params.kmipServerId,+ method: result.method,+ resourceName: result.resourceName,+ deletedTokenCount: result.deletedTokenCount+ }+ }+ });++ return { method: result.method, deletedTokenCount: result.deletedTokenCount };+ }+ });++ // ─── DELETE /:kmipServerId ────────────────────────────────────────────────+ server.route({+ method: "DELETE",+ url: "/:kmipServerId",+ config: { rateLimit: writeLimit },+ schema: {+ params: z.object({ kmipServerId: z.string().uuid() }),+ response: {+ 200: SanitizedKmipServerSchema.omit({ canRevoke: true })+ }+ },+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),+ handler: async (req) => {+ const kmipServer = await server.services.kmipServer.deleteKmipServer({+ kmipServerId: req.params.kmipServerId,+ actor: req.permission+ });++ await server.services.auditLog.createAuditLog({+ ...req.auditLogInfo,+ orgId: req.permission.orgId,+ event: {+ type: EventType.KMIP_SERVER_DELETE,+ metadata: { kmipServerId: kmipServer.id, name: kmipServer.name }+ }+ });++ return kmipServer;+ }+ });++ // ─── POST /login ──────────────────────────────────────────────────────────+ server.route({+ method: "POST",+ url: "/login",+ config: { rateLimit: loginRateLimit },+ schema: {+ body: z.discriminatedUnion("method", [+ z.object({+ method: z.literal(ResourceAuthMethodType.Aws),+ kmipServerId: z.string().uuid(),+ iamHttpRequestMethod: z.string().default("POST"),+ iamRequestBody: z.string(),+ iamRequestHeaders: z.string()+ }),+ z.object({+ method: z.literal(ResourceAuthMethodType.Token),+ token: z.string().min(1)+ })+ ]),+ response: {+ 200: z.object({+ accessToken: z.string(),+ kmipServerId: z.string(),+ tokenType: z.literal("Bearer")+ })+ }+ },+ handler: async (req) => {+ if (req.body.method === ResourceAuthMethodType.Aws) {+ try {+ const result = await server.services.resourceAuthMethod.loginWithAws({+ resource: { type: "kmip", id: req.body.kmipServerId },+ iamHttpRequestMethod: req.body.iamHttpRequestMethod,+ iamRequestBody: req.body.iamRequestBody,+ iamRequestHeaders: req.body.iamRequestHeaders+ });++ await server.services.auditLog+ .createAuditLog({+ orgId: result.orgId,+ actor: { type: ActorType.KMIP_SERVER, metadata: { kmipServerId: result.resourceId } },+ event: {+ type: EventType.RESOURCE_AUTH_METHOD_LOGIN,+ metadata: {+ resourceType: "kmip",+ resourceId: result.resourceId,+ method: "aws",+ methodConfigId: result.config.id,+ principalArn: result.principalArn,+ accountId: result.accountId+ }+ },+ ipAddress: req.ip,+ userAgent: req.headers["user-agent"] ?? "",+ userAgentType: UserAgentType.OTHER+ })+ .catch(() => {});++ return {+ accessToken: result.accessToken,+ kmipServerId: result.resourceId,+ tokenType: "Bearer" as const+ };+ } catch (error) {+ if (error instanceof UnauthorizedError && error.detail?.resourceId) {+ await server.services.auditLog+ .createAuditLog({+ orgId: error.detail.orgId as string,+ actor: { type: ActorType.KMIP_SERVER, metadata: { kmipServerId: error.detail.resourceId as string } },+ event: {+ type: EventType.RESOURCE_AUTH_METHOD_LOGIN_FAILED,+ metadata: {+ resourceType: "kmip",+ resourceId: error.detail.resourceId as string,+ method: "aws",+ reasonCode: error.detail.reasonCode as string,+ message: error.message,+ principalArn: error.detail.principalArn as string | undefined,+ accountId: error.detail.accountId as string | undefined+ }+ },+ ipAddress: req.ip,+ userAgent: req.headers["user-agent"] ?? "",+ userAgentType: UserAgentType.OTHER+ })+ .catch(() => {});+ }+ throw error;+ }+ }++ const result = await server.services.resourceAuthMethod.loginWithToken({+ token: req.body.token,+ expectedResourceType: "kmip"+ });++ await server.services.auditLog+ .createAuditLog({+ orgId: result.orgId,+ actor: { type: ActorType.KMIP_SERVER, metadata: { kmipServerId: result.resourceId } },+ event: {+ type: EventType.RESOURCE_AUTH_METHOD_LOGIN,+ metadata: {+ resourceType: "kmip",+ resourceId: result.resourceId,+ method: "token",+ methodConfigId: result.resourceId,+ enrollmentTokenId: result.enrollmentTokenId+ }+ },+ ipAddress: req.ip,+ userAgent: req.headers["user-agent"] ?? "",+ userAgentType: UserAgentType.CLI+ })+ .catch(() => {});++ return {+ accessToken: result.accessToken,+ kmipServerId: result.resourceId,+ tokenType: "Bearer" as const+ };+ }+ });+};diff --git a/backend/src/ee/routes/v1/kmip-spec-router.ts b/backend/src/ee/routes/v1/kmip-spec-router.tsindex b74ca0e578..5e54fcbb9f 100644--- a/backend/src/ee/routes/v1/kmip-spec-router.ts+++ b/backend/src/ee/routes/v1/kmip-spec-router.ts@@ -80,7 +80,7 @@ export const registerKmipSpecRouter = async (server: FastifyZodProvider) => {200: KmsKeysSchema}},- onRequest: verifyAuth([AuthMode.IDENTITY_ACCESS_TOKEN]),+ onRequest: verifyAuth([AuthMode.IDENTITY_ACCESS_TOKEN, AuthMode.KMIP_SERVER_ACCESS_TOKEN]),handler: async (req) => {const object = await server.services.kmipOperation.create({...req.kmipUser,@@ -133,7 +133,7 @@ export const registerKmipSpecRouter = async (server: FastifyZodProvider) => {})}},- onRequest: verifyAuth([AuthMode.IDENTITY_ACCESS_TOKEN]),+ onRequest: verifyAuth([AuthMode.IDENTITY_ACCESS_TOKEN, AuthMode.KMIP_SERVER_ACCESS_TOKEN]),handler: async (req) => {const object = await server.services.kmipOperation.get({...req.kmipUser,@@ -187,7 +187,7 @@ export const registerKmipSpecRouter = async (server: FastifyZodProvider) => {})}},- onRequest: verifyAuth([AuthMode.IDENTITY_ACCESS_TOKEN]),+ onRequest: verifyAuth([AuthMode.IDENTITY_ACCESS_TOKEN, AuthMode.KMIP_SERVER_ACCESS_TOKEN]),handler: async (req) => {const object = await server.services.kmipOperation.getAttributes({...req.kmipUser,@@ -236,7 +236,7 @@ export const registerKmipSpecRouter = async (server: FastifyZodProvider) => {})}},- onRequest: verifyAuth([AuthMode.IDENTITY_ACCESS_TOKEN]),+ onRequest: verifyAuth([AuthMode.IDENTITY_ACCESS_TOKEN, AuthMode.KMIP_SERVER_ACCESS_TOKEN]),handler: async (req) => {const object = await server.services.kmipOperation.destroy({...req.kmipUser,@@ -286,7 +286,7 @@ export const registerKmipSpecRouter = async (server: FastifyZodProvider) => {})}},- onRequest: verifyAuth([AuthMode.IDENTITY_ACCESS_TOKEN]),+ onRequest: verifyAuth([AuthMode.IDENTITY_ACCESS_TOKEN, AuthMode.KMIP_SERVER_ACCESS_TOKEN]),handler: async (req) => {const object = await server.services.kmipOperation.activate({...req.kmipUser,@@ -336,7 +336,7 @@ export const registerKmipSpecRouter = async (server: FastifyZodProvider) => {})}},- onRequest: verifyAuth([AuthMode.IDENTITY_ACCESS_TOKEN]),+ onRequest: verifyAuth([AuthMode.IDENTITY_ACCESS_TOKEN, AuthMode.KMIP_SERVER_ACCESS_TOKEN]),handler: async (req) => {const object = await server.services.kmipOperation.revoke({...req.kmipUser,@@ -392,7 +392,7 @@ export const registerKmipSpecRouter = async (server: FastifyZodProvider) => {})}},- onRequest: verifyAuth([AuthMode.IDENTITY_ACCESS_TOKEN]),+ onRequest: verifyAuth([AuthMode.IDENTITY_ACCESS_TOKEN, AuthMode.KMIP_SERVER_ACCESS_TOKEN]),handler: async (req) => {const objects = await server.services.kmipOperation.locate({...req.kmipUser,@@ -445,7 +445,7 @@ export const registerKmipSpecRouter = async (server: FastifyZodProvider) => {})}},- onRequest: verifyAuth([AuthMode.IDENTITY_ACCESS_TOKEN]),+ onRequest: verifyAuth([AuthMode.IDENTITY_ACCESS_TOKEN, AuthMode.KMIP_SERVER_ACCESS_TOKEN]),handler: async (req) => {const object = await server.services.kmipOperation.register({...req.kmipUser,diff --git a/backend/src/ee/services/audit-log/audit-log-types.ts b/backend/src/ee/services/audit-log/audit-log-types.tsindex ae8fe769b7..2d130ebc3d 100644--- a/backend/src/ee/services/audit-log/audit-log-types.ts+++ b/backend/src/ee/services/audit-log/audit-log-types.ts@@ -94,7 +94,8 @@ export type TCreateAuditLogDTO = {| EstAccountActor| ScepAccountActor| GatewayActor- | RelayActor;+ | RelayActor+ | KmipServerActor;orgId?: string;projectId?: string;} & BaseAuthData;@@ -866,6 +867,10 @@ export enum EventType {RELAY_DELETE = "relay-delete",RELAY_ENROLLMENT_TOKEN_CREATE = "relay-enrollment-token-create",+ KMIP_SERVER_CREATE = "kmip-server-create",+ KMIP_SERVER_DELETE = "kmip-server-delete",+ KMIP_SERVER_ENROLLMENT_TOKEN_CREATE = "kmip-server-enrollment-token-create",+// Gateway PoolsGATEWAY_POOL_CREATE = "gateway-pool-create",GATEWAY_POOL_UPDATE = "gateway-pool-update",@@ -894,7 +899,8 @@ export const ACTOR_TYPE_TO_METADATA_ID_KEY: Partial<Record<ActorType, string>> =[ActorType.EST_ACCOUNT]: "profileId",[ActorType.SCEP_ACCOUNT]: "profileId",[ActorType.GATEWAY]: "gatewayId",- [ActorType.RELAY]: "relayId"+ [ActorType.RELAY]: "relayId",+ [ActorType.KMIP_SERVER]: "kmipServerId"};export const filterableSecretEvents: EventType[] = [@@ -966,6 +972,10 @@ interface RelayActorMetadata {relayId: string;}+interface KmipServerActorMetadata {+ kmipServerId: string;+}+export interface UserActor {type: ActorType.USER;metadata: UserActorMetadata;@@ -1030,6 +1040,11 @@ export interface RelayActor {metadata: RelayActorMetadata;}+export interface KmipServerActor {+ type: ActorType.KMIP_SERVER;+ metadata: KmipServerActorMetadata;+}+export type Actor =| UserActor| ServiceActor@@ -1042,7 +1057,8 @@ export type Actor =| EstAccountActor| ScepAccountActor| GatewayActor- | RelayActor;+ | RelayActor+ | KmipServerActor;interface GetSecretsEvent {type: EventType.GET_SECRETS;@@ -6976,7 +6992,7 @@ interface GatewayEnrollEvent {}type ResourceAuthMethodKind = "aws" | "token";-type ResourceAuthMethodResourceType = "gateway" | "relay";+type ResourceAuthMethodResourceType = "gateway" | "relay" | "kmip";interface ResourceAuthMethodLoginEvent {type: EventType.RESOURCE_AUTH_METHOD_LOGIN;@@ -7061,6 +7077,30 @@ interface RelayEnrollmentTokenCreateEvent {};}+interface KmipServerCreateEvent {+ type: EventType.KMIP_SERVER_CREATE;+ metadata: {+ kmipServerId: string;+ name: string;+ };+}++interface KmipServerDeleteEvent {+ type: EventType.KMIP_SERVER_DELETE;+ metadata: {+ kmipServerId: string;+ name: string;+ };+}++interface KmipServerEnrollmentTokenCreateEvent {+ type: EventType.KMIP_SERVER_ENROLLMENT_TOKEN_CREATE;+ metadata: {+ tokenId: string;+ name: string;+ };+}+interface GatewayPoolCreateEvent {type: EventType.GATEWAY_POOL_CREATE;metadata: {@@ -7778,6 +7818,9 @@ export type Event =| RelayUpdateEvent| RelayDeleteEvent| RelayEnrollmentTokenCreateEvent+ | KmipServerCreateEvent+ | KmipServerDeleteEvent+ | KmipServerEnrollmentTokenCreateEvent| GatewayPoolCreateEvent| GatewayPoolUpdateEvent| GatewayPoolDeleteEventdiff --git a/backend/src/ee/services/kmip-server/kmip-server-dal.ts b/backend/src/ee/services/kmip-server/kmip-server-dal.tsnew file mode 100644index 0000000000..c57cc26456--- /dev/null+++ b/backend/src/ee/services/kmip-server/kmip-server-dal.ts@@ -0,0 +1,9 @@+import { TDbClient } from "@app/db";+import { TableName } from "@app/db/schemas";+import { ormify } from "@app/lib/knex";++export type TKmipServerDALFactory = ReturnType<typeof kmipServerDALFactory>;++export const kmipServerDALFactory = (db: TDbClient) => {+ return ormify(db, TableName.KmipServer);+};diff --git a/backend/src/ee/services/kmip-server/kmip-server-service.ts b/backend/src/ee/services/kmip-server/kmip-server-service.tsnew file mode 100644index 0000000000..074f2e4a9f--- /dev/null+++ b/backend/src/ee/services/kmip-server/kmip-server-service.ts@@ -0,0 +1,100 @@+import { ForbiddenError } from "@casl/ability";++import { OrganizationActionScope } from "@app/db/schemas";+import { DatabaseErrorCode } from "@app/lib/error-codes";+import { BadRequestError, DatabaseError, NotFoundError } from "@app/lib/errors";+import { ActorAuthMethod, ActorType } from "@app/services/auth/auth-type";++import { OrgPermissionKmipServerActions, OrgPermissionSubjects } from "../permission/org-permission";+import { TPermissionServiceFactory } from "../permission/permission-service-types";+import { TResourceAuthMethodServiceFactory } from "../resource-auth-method/resource-auth-method-service";+import { TKmipServerDALFactory } from "./kmip-server-dal";++export type TKmipServerServiceFactory = ReturnType<typeof kmipServerServiceFactory>;++type TActor = {+ type: ActorType;+ id: string;+ orgId: string;+ authMethod: ActorAuthMethod;+};++export const kmipServerServiceFactory = ({+ kmipServerDAL,+ permissionService,+ resourceAuthMethodService+}: {+ kmipServerDAL: TKmipServerDALFactory;+ permissionService: Pick<TPermissionServiceFactory, "getOrgPermission">;+ resourceAuthMethodService: Pick<TResourceAuthMethodServiceFactory, "initAtCreate">;+}) => {+ const $checkPermission = async (actor: TActor, action: OrgPermissionKmipServerActions) => {+ const { permission } = await permissionService.getOrgPermission({+ scope: OrganizationActionScope.Any,+ actor: actor.type,+ actorId: actor.id,+ orgId: actor.orgId,+ actorAuthMethod: actor.authMethod,+ actorOrgId: actor.orgId+ });+ ForbiddenError.from(permission).throwUnlessCan(action, OrgPermissionSubjects.KmipServer);+ };++ const createKmipServer = async ({+ name,+ authMethod,+ actor+ }: {+ name: string;+ authMethod:+ | { method: "aws"; config: { stsEndpoint: string; allowedPrincipalArns: string; allowedAccountIds: string } }+ | { method: "token" };+ actor: TActor;+ }) => {+ await $checkPermission(actor, OrgPermissionKmipServerActions.CreateKmipServers);++ try {+ return await kmipServerDAL.transaction(async (tx) => {+ const created = await kmipServerDAL.create({ name, orgId: actor.orgId }, tx);+ await resourceAuthMethodService.initAtCreate({ resource: { type: "kmip", id: created.id }, authMethod }, tx);+ return created;+ });+ } catch (err) {+ if (err instanceof DatabaseError && (err.error as { code: string })?.code === DatabaseErrorCode.UniqueViolation) {+ throw new BadRequestError({ message: `A KMIP server named "${name}" already exists` });+ }+ throw err;+ }+ };++ const getOrgKmipServer = async ({ kmipServerId, orgId }: { kmipServerId: string; orgId: string }) => {+ const kmipServer = await kmipServerDAL.findOne({ id: kmipServerId, orgId });+ if (!kmipServer) {+ throw new NotFoundError({ message: `KMIP server ${kmipServerId} not found` });+ }+ return kmipServer;+ };++ const listKmipServers = async ({ actor }: { actor: TActor }) => {+ await $checkPermission(actor, OrgPermissionKmipServerActions.ListKmipServers);+ return kmipServerDAL.find({ orgId: actor.orgId });+ };++ const deleteKmipServer = async ({ kmipServerId, actor }: { kmipServerId: string; actor: TActor }) => {+ await $checkPermission(actor, OrgPermissionKmipServerActions.DeleteKmipServers);++ const kmipServer = await kmipServerDAL.findOne({ id: kmipServerId, orgId: actor.orgId });+ if (!kmipServer) {+ throw new NotFoundError({ message: `KMIP server ${kmipServerId} not found` });+ }++ return kmipServerDAL.deleteById(kmipServerId);+ };++ return {+ createKmipServer,+ getOrgKmipServer,+ listKmipServers,+ deleteKmipServer+ };+};diff --git a/backend/src/ee/services/kmip/kmip-operation-service.ts b/backend/src/ee/services/kmip/kmip-operation-service.tsindex d635c1942b..4b4042f6d9 100644--- a/backend/src/ee/services/kmip/kmip-operation-service.ts+++ b/backend/src/ee/services/kmip/kmip-operation-service.ts@@ -3,6 +3,7 @@ import { ForbiddenError } from "@casl/ability";import { OrganizationActionScope } from "@app/db/schemas";import { BadRequestError, ForbiddenRequestError, NotFoundError } from "@app/lib/errors";import { KmipOperationType, recordKmipOperationMetric } from "@app/lib/telemetry/metrics";+import { ActorAuthMethod, ActorType } from "@app/services/auth/auth-type";import { TKmsKeyDALFactory } from "@app/services/kms/kms-key-dal";import { TKmsServiceFactory } from "@app/services/kms/kms-service";import { KmsKeyUsage } from "@app/services/kms/kms-types";@@ -36,15 +37,22 @@ export const kmipOperationServiceFactory = ({kmipClientDAL,permissionService}: TKmipOperationServiceFactoryDep) => {- const create = async ({- projectId,- clientId,- algorithm,+ // KMIP servers authenticate via their enrollment-based access token, which is itself the+ // authorization — no org-level permission needed. The legacy machine-identity path still+ // requires the (deprecated) KMIP proxy permission.+ const $authorizeProxyAccess = async ({actor,actorId,actorAuthMethod,actorOrgId- }: TKmipCreateDTO) => {+ }: {+ actor: ActorType;+ actorId: string;+ actorAuthMethod: ActorAuthMethod;+ actorOrgId: string;+ }) => {+ if (actor === ActorType.KMIP_SERVER) return;+const { permission } = await permissionService.getOrgPermission({scope: OrganizationActionScope.Any,actor,@@ -53,8 +61,19 @@ export const kmipOperationServiceFactory = ({actorAuthMethod,actorOrgId});-ForbiddenError.from(permission).throwUnlessCan(OrgPermissionKmipActions.Proxy, OrgPermissionSubjects.Kmip);+ };++ const create = async ({+ projectId,+ clientId,+ algorithm,+ actor,+ actorId,+ actorAuthMethod,+ actorOrgId+ }: TKmipCreateDTO) => {+ await $authorizeProxyAccess({ actor, actorId, actorAuthMethod, actorOrgId });const kmipClient = await kmipClientDAL.findOne({id: clientId,@@ -87,16 +106,7 @@ export const kmipOperationServiceFactory = ({};const destroy = async ({ projectId, id, clientId, actor, actorId, actorOrgId, actorAuthMethod }: TKmipDestroyDTO) => {- const { permission } = await permissionService.getOrgPermission({- scope: OrganizationActionScope.Any,- actor,- actorId,- orgId: actorOrgId,- actorAuthMethod,- actorOrgId- });-- ForbiddenError.from(permission).throwUnlessCan(OrgPermissionKmipActions.Proxy, OrgPermissionSubjects.Kmip);+ await $authorizeProxyAccess({ actor, actorId, actorAuthMethod, actorOrgId });const kmipClient = await kmipClientDAL.findOne({id: clientId,@@ -150,16 +160,7 @@ export const kmipOperationServiceFactory = ({};const get = async ({ projectId, id, clientId, actor, actorId, actorAuthMethod, actorOrgId }: TKmipGetDTO) => {- const { permission } = await permissionService.getOrgPermission({- scope: OrganizationActionScope.Any,- actor,- actorId,- orgId: actorOrgId,- actorAuthMethod,- actorOrgId- });-- ForbiddenError.from(permission).throwUnlessCan(OrgPermissionKmipActions.Proxy, OrgPermissionSubjects.Kmip);+ await $authorizeProxyAccess({ actor, actorId, actorAuthMethod, actorOrgId });const kmipClient = await kmipClientDAL.findOne({id: clientId,@@ -218,16 +219,7 @@ export const kmipOperationServiceFactory = ({};const activate = async ({ projectId, id, clientId, actor, actorId, actorAuthMethod, actorOrgId }: TKmipGetDTO) => {- const { permission } = await permissionService.getOrgPermission({- scope: OrganizationActionScope.Any,- actor,- actorId,- orgId: actorOrgId,- actorAuthMethod,- actorOrgId- });-- ForbiddenError.from(permission).throwUnlessCan(OrgPermissionKmipActions.Proxy, OrgPermissionSubjects.Kmip);+ await $authorizeProxyAccess({ actor, actorId, actorAuthMethod, actorOrgId });const kmipClient = await kmipClientDAL.findOne({id: clientId,@@ -265,16 +257,7 @@ export const kmipOperationServiceFactory = ({};const revoke = async ({ projectId, id, clientId, actor, actorId, actorAuthMethod, actorOrgId }: TKmipRevokeDTO) => {- const { permission } = await permissionService.getOrgPermission({- scope: OrganizationActionScope.Any,- actor,- actorId,- orgId: actorOrgId,- actorAuthMethod,- actorOrgId- });-- ForbiddenError.from(permission).throwUnlessCan(OrgPermissionKmipActions.Proxy, OrgPermissionSubjects.Kmip);+ await $authorizeProxyAccess({ actor, actorId, actorAuthMethod, actorOrgId });const kmipClient = await kmipClientDAL.findOne({id: clientId,@@ -336,16 +319,7 @@ export const kmipOperationServiceFactory = ({actorAuthMethod,actorOrgId}: TKmipGetAttributesDTO) => {- const { permission } = await permissionService.getOrgPermission({- scope: OrganizationActionScope.Any,- actor,- actorId,- orgId: actorOrgId,- actorAuthMethod,- actorOrgId- });-- ForbiddenError.from(permission).throwUnlessCan(OrgPermissionKmipActions.Proxy, OrgPermissionSubjects.Kmip);+ await $authorizeProxyAccess({ actor, actorId, actorAuthMethod, actorOrgId });const kmipClient = await kmipClientDAL.findOne({id: clientId,@@ -399,16 +373,7 @@ export const kmipOperationServiceFactory = ({};const locate = async ({ projectId, clientId, actor, actorId, actorAuthMethod, actorOrgId }: TKmipLocateDTO) => {- const { permission } = await permissionService.getOrgPermission({- scope: OrganizationActionScope.Any,- actor,- actorId,- orgId: actorOrgId,- actorAuthMethod,- actorOrgId- });-- ForbiddenError.from(permission).throwUnlessCan(OrgPermissionKmipActions.Proxy, OrgPermissionSubjects.Kmip);+ await $authorizeProxyAccess({ actor, actorId, actorAuthMethod, actorOrgId });const kmipClient = await kmipClientDAL.findOne({id: clientId,@@ -445,16 +410,7 @@ export const kmipOperationServiceFactory = ({actorOrgId,kmipMetadata}: TKmipRegisterDTO) => {- const { permission } = await permissionService.getOrgPermission({- scope: OrganizationActionScope.Any,- actor,- actorId,- orgId: actorOrgId,- actorAuthMethod,- actorOrgId- });-- ForbiddenError.from(permission).throwUnlessCan(OrgPermissionKmipActions.Proxy, OrgPermissionSubjects.Kmip);+ await $authorizeProxyAccess({ actor, actorId, actorAuthMethod, actorOrgId });const kmipClient = await kmipClientDAL.findOne({id: clientId,diff --git a/backend/src/ee/services/kmip/kmip-service.ts b/backend/src/ee/services/kmip/kmip-service.tsindex 43a439fe2f..26407ec2fb 100644--- a/backend/src/ee/services/kmip/kmip-service.ts+++ b/backend/src/ee/services/kmip/kmip-service.ts@@ -8,6 +8,7 @@ import { BadRequestError, NotFoundError } from "@app/lib/errors";import { isValidIp } from "@app/lib/ip";import { ms } from "@app/lib/ms";import { isFQDN } from "@app/lib/validator/validate-url";+import { ActorType } from "@app/services/auth/auth-type";import { constructPemChainFromCerts } from "@app/services/certificate/certificate-fns";import { CertExtendedKeyUsage, CertKeyAlgorithm, CertKeyUsage } from "@app/services/certificate/certificate-types";import {@@ -725,16 +726,21 @@ export const kmipServiceFactory = ({keyAlgorithm,hostnamesOrIps}: TRegisterServerDTO) => {- const { permission } = await permissionService.getOrgPermission({- scope: OrganizationActionScope.Any,- actor,- actorId,- orgId: actorOrgId,- actorAuthMethod,- actorOrgId- });+ // KMIP servers authenticate via their enrollment-based access token, which is itself the+ // authorization — no org-level permission needed. The legacy machine-identity path still+ // requires the (deprecated) KMIP proxy permission.+ if (actor !== ActorType.KMIP_SERVER) {+ const { permission } = await permissionService.getOrgPermission({+ scope: OrganizationActionScope.Any,+ actor,+ actorId,+ orgId: actorOrgId,+ actorAuthMethod,+ actorOrgId+ });- ForbiddenError.from(permission).throwUnlessCan(OrgPermissionKmipActions.Proxy, OrgPermissionSubjects.Kmip);+ ForbiddenError.from(permission).throwUnlessCan(OrgPermissionKmipActions.Proxy, OrgPermissionSubjects.Kmip);+ }const plan = await licenseService.getPlan(actorOrgId);if (!plan.kmip)diff --git a/backend/src/ee/services/permission/org-permission.ts b/backend/src/ee/services/permission/org-permission.tsindex 1f84baceb3..2ef54da8c4 100644--- a/backend/src/ee/services/permission/org-permission.ts+++ b/backend/src/ee/services/permission/org-permission.ts@@ -91,6 +91,14 @@ export enum OrgPermissionRelayActions {RevokeRelayAccess = "revoke-relay-access"}+export enum OrgPermissionKmipServerActions {+ CreateKmipServers = "create-kmip-servers",+ ListKmipServers = "list-kmip-servers",+ EditKmipServers = "edit-kmip-servers",+ DeleteKmipServers = "delete-kmip-servers",+ RevokeKmipServerAccess = "revoke-kmip-server-access"+}+export enum OrgPermissionIdentityActions {Read = "read",Create = "create",@@ -165,6 +173,7 @@ export enum OrgPermissionSubjects {ProjectTemplates = "project-templates",AppConnections = "app-connections",Kmip = "kmip",+ KmipServer = "kmip-server",Gateway = "gateway",GatewayPool = "gateway-pool",Relay = "relay",@@ -202,6 +211,7 @@ export type OrgPermissionSet =| [OrgPermissionGatewayActions, OrgPermissionSubjects.Gateway]| [OrgPermissionGatewayPoolActions, OrgPermissionSubjects.GatewayPool]| [OrgPermissionRelayActions, OrgPermissionSubjects.Relay]+ | [OrgPermissionKmipServerActions, OrgPermissionSubjects.KmipServer]| [OrgPermissionAppConnectionActions,(@@ -375,6 +385,12 @@ export const OrgPermissionSchema = z.discriminatedUnion("subject", ["Describe what action an entity can take.")}),+ z.object({+ subject: z.literal(OrgPermissionSubjects.KmipServer).describe("The entity this permission pertains to."),+ action: CASL_ACTION_SCHEMA_NATIVE_ENUM(OrgPermissionKmipServerActions).describe(+ "Describe what action an entity can take."+ )+ }),z.object({subject: z.literal(OrgPermissionSubjects.EmailDomains).describe("The entity this permission pertains to."),action: CASL_ACTION_SCHEMA_NATIVE_ENUM(OrgPermissionEmailDomainActions).describe(@@ -521,6 +537,12 @@ const buildAdminPermission = () => {can(OrgPermissionRelayActions.DeleteRelays, OrgPermissionSubjects.Relay);can(OrgPermissionRelayActions.RevokeRelayAccess, OrgPermissionSubjects.Relay);+ can(OrgPermissionKmipServerActions.ListKmipServers, OrgPermissionSubjects.KmipServer);+ can(OrgPermissionKmipServerActions.CreateKmipServers, OrgPermissionSubjects.KmipServer);+ can(OrgPermissionKmipServerActions.EditKmipServers, OrgPermissionSubjects.KmipServer);+ can(OrgPermissionKmipServerActions.DeleteKmipServers, OrgPermissionSubjects.KmipServer);+ can(OrgPermissionKmipServerActions.RevokeKmipServerAccess, OrgPermissionSubjects.KmipServer);+can(OrgPermissionAdminConsoleAction.AccessAllProjects, OrgPermissionSubjects.AdminConsole);// the proxy assignment is temporary in order to prevent "more privilege" error during role assignment to MI@@ -600,6 +622,10 @@ const buildMemberPermission = () => {can(OrgPermissionRelayActions.CreateRelays, OrgPermissionSubjects.Relay);can(OrgPermissionRelayActions.EditRelays, OrgPermissionSubjects.Relay);+ can(OrgPermissionKmipServerActions.ListKmipServers, OrgPermissionSubjects.KmipServer);+ can(OrgPermissionKmipServerActions.CreateKmipServers, OrgPermissionSubjects.KmipServer);+ can(OrgPermissionKmipServerActions.EditKmipServers, OrgPermissionSubjects.KmipServer);+can(OrgPermissionMachineIdentityAuthTemplateActions.ListTemplates, OrgPermissionSubjects.MachineIdentityAuthTemplate);can(OrgPermissionMachineIdentityAuthTemplateActions.UnlinkTemplates,diff --git a/backend/src/ee/services/resource-auth-method/resource-auth-method-fns.ts b/backend/src/ee/services/resource-auth-method/resource-auth-method-fns.tsindex a235c0403a..3b448a381d 100644--- a/backend/src/ee/services/resource-auth-method/resource-auth-method-fns.ts+++ b/backend/src/ee/services/resource-auth-method/resource-auth-method-fns.ts@@ -56,10 +56,38 @@ export const mintRelayJwt = ({);};-export type ResourceRef = { type: "gateway"; id: string } | { type: "relay"; id: string };+export const mintKmipServerJwt = ({+ kmipServerId,+ orgId,+ tokenVersion,+ accessTokenTTL+}: {+ kmipServerId: string;+ orgId: string;+ tokenVersion: number;+ accessTokenTTL: number;+}) => {+ const appCfg = getConfig();+ return crypto.jwt().sign(+ {+ kmipServerId,+ orgId,+ authTokenType: AuthTokenType.KMIP_SERVER_ACCESS_TOKEN,+ tokenVersion+ },+ appCfg.AUTH_SECRET,+ accessTokenTTL === 0 ? undefined : { expiresIn: accessTokenTTL }+ );+};++export type ResourceRef =+ | { type: "gateway"; id: string }+ | { type: "relay"; id: string }+ | { type: "kmip"; id: string };export const RESOURCE_TYPE_GATEWAY = "gateway" as const;export const RESOURCE_TYPE_RELAY = "relay" as const;+export const RESOURCE_TYPE_KMIP = "kmip" as const;export const assertGatewayResource = (resource: { type: string }, methodName: string) => {if (resource.type !== RESOURCE_TYPE_GATEWAY) {@@ -77,6 +105,14 @@ export const assertRelayResource = (resource: { type: string }, methodName: stri}};+export const assertKmipServerResource = (resource: { type: string }, methodName: string) => {+ if (resource.type !== RESOURCE_TYPE_KMIP) {+ throw new BadRequestError({+ message: `Resource type "${resource.type}" not supported for ${methodName} auth`+ });+ }+};+// All auth method values surfaced anywhere in the system.//// - 'aws' / 'token' — stored in resource_auth_methods.method, settable via the API.diff --git a/backend/src/ee/services/resource-auth-method/resource-auth-method-service.ts b/backend/src/ee/services/resource-auth-method/resource-auth-method-service.tsindex 161be990de..b1554c7094 100644--- a/backend/src/ee/services/resource-auth-method/resource-auth-method-service.ts+++ b/backend/src/ee/services/resource-auth-method/resource-auth-method-service.ts@@ -7,8 +7,10 @@ import { BadRequestError, NotFoundError, UnauthorizedError } from "@app/lib/erroimport { TIdentityDALFactory } from "@app/services/identity/identity-dal";import { TGatewayV2DALFactory } from "../gateway-v2/gateway-v2-dal";+import { TKmipServerDALFactory } from "../kmip-server/kmip-server-dal";import {OrgPermissionGatewayActions,+ OrgPermissionKmipServerActions,OrgPermissionRelayActions,OrgPermissionSubjects} from "../permission/org-permission";@@ -19,10 +21,13 @@ import { validateAllowlists, verifyStsAndExtractCaller } from "./aws-auth-fns";import { TResourceAuthMethodDALFactory } from "./resource-auth-method-dal";import {assertGatewayResource,+ assertKmipServerResource,assertRelayResource,mintGatewayJwt,+ mintKmipServerJwt,mintRelayJwt,RESOURCE_TYPE_GATEWAY,+ RESOURCE_TYPE_KMIP,RESOURCE_TYPE_RELAY,ResourceAuthMethodType,type ResourceRef@@ -54,6 +59,7 @@ type TResourceAuthMethodServiceFactoryDep = {resourceTokenAuthDAL: TResourceTokenAuthDALFactory;gatewayV2DAL: Pick<TGatewayV2DALFactory, "findById" | "updateById">;relayDAL: Pick<TRelayDALFactory, "findById" | "updateById">;+ kmipServerDAL: Pick<TKmipServerDALFactory, "findById" | "updateById">;identityDAL: Pick<TIdentityDALFactory, "findById">;permissionService: Pick<TPermissionServiceFactory, "getOrgPermission">;};@@ -73,15 +79,86 @@ const RELAY_PERMISSION_MAP = {revoke: OrgPermissionRelayActions.RevokeRelayAccess} as const;+const KMIP_SERVER_PERMISSION_MAP = {+ list: OrgPermissionKmipServerActions.ListKmipServers,+ edit: OrgPermissionKmipServerActions.EditKmipServers,+ revoke: OrgPermissionKmipServerActions.RevokeKmipServerAccess+} as const;++const RESOURCE_LABEL: Record<ResourceRef["type"], string> = {+ [RESOURCE_TYPE_GATEWAY]: "Gateway",+ [RESOURCE_TYPE_RELAY]: "Relay",+ [RESOURCE_TYPE_KMIP]: "KMIP server"+};++type TBasicResource = { id: string; name: string; orgId: string | null; identityId: string | null };+export const resourceAuthMethodServiceFactory = ({resourceAuthMethodDAL,resourceAwsAuthDAL,resourceTokenAuthDAL,gatewayV2DAL,relayDAL,+ kmipServerDAL,identityDAL,permissionService}: TResourceAuthMethodServiceFactoryDep) => {+ // Registry rows carry the resource FK in a per-type column (gatewayId/relayId/kmipServerId).+ const $registryFilter = (resource: ResourceRef) => {+ if (resource.type === RESOURCE_TYPE_GATEWAY) return { gatewayId: resource.id };+ if (resource.type === RESOURCE_TYPE_RELAY) return { relayId: resource.id };+ return { kmipServerId: resource.id };+ };++ // Loads the minimal resource shape the auth-method flows need. KMIP servers have no+ // identityId column — they're always enrollment-based, never machine-identity — so it's+ // reported as null, which keeps them out of the legacy "identity" auth-method path.+ const $loadResource = async (resource: ResourceRef, tx?: Knex): Promise<TBasicResource | null> => {+ if (resource.type === RESOURCE_TYPE_GATEWAY) {+ const gateway = await gatewayV2DAL.findById(resource.id, tx);+ return gateway+ ? { id: gateway.id, name: gateway.name, orgId: gateway.orgId, identityId: gateway.identityId ?? null }+ : null;+ }+ if (resource.type === RESOURCE_TYPE_RELAY) {+ const relay = await relayDAL.findById(resource.id, tx);+ return relay+ ? { id: relay.id, name: relay.name, orgId: relay.orgId ?? null, identityId: relay.identityId ?? null }+ : null;+ }+ const kmipServer = await kmipServerDAL.findById(resource.id, tx);+ return kmipServer ? { id: kmipServer.id, name: kmipServer.name, orgId: kmipServer.orgId, identityId: null } : null;+ };++ // Bumps tokenVersion (invalidating outstanding JWTs) and clears heartbeat. Gateways+ // additionally clear heartbeatTTL; relays and KMIP servers don't carry that column.+ const $bumpTokenVersion = async (resource: ResourceRef, tx?: Knex): Promise<number> => {+ if (resource.type === RESOURCE_TYPE_GATEWAY) {+ const refreshed = await gatewayV2DAL.updateById(+ resource.id,+ { $incr: { tokenVersion: 1 }, heartbeat: null, heartbeatTTL: null },+ tx+ );+ return refreshed.tokenVersion;+ }+ if (resource.type === RESOURCE_TYPE_RELAY) {+ const refreshed = await relayDAL.updateById(resource.id, { $incr: { tokenVersion: 1 }, heartbeat: null }, tx);+ return refreshed.tokenVersion;+ }+ const refreshed = await kmipServerDAL.updateById(resource.id, { $incr: { tokenVersion: 1 }, heartbeat: null }, tx);+ return refreshed.tokenVersion;+ };++ const $mintJwt = (resource: ResourceRef, orgId: string, tokenVersion: number): string => {+ if (resource.type === RESOURCE_TYPE_GATEWAY) {+ return mintGatewayJwt({ gatewayId: resource.id, orgId, tokenVersion, accessTokenTTL: 0 });+ }+ if (resource.type === RESOURCE_TYPE_RELAY) {+ return mintRelayJwt({ relayId: resource.id, orgId, tokenVersion, accessTokenTTL: 0 });+ }+ return mintKmipServerJwt({ kmipServerId: resource.id, orgId, tokenVersion, accessTokenTTL: 0 });+ };+const $checkPermission = async (actor: TSetAuthMethodDTO["actor"],intent: "list" | "edit" | "revoke",@@ -97,47 +174,34 @@ export const resourceAuthMethodServiceFactory = ({});if (resourceType === RESOURCE_TYPE_GATEWAY) {ForbiddenError.from(permission).throwUnlessCan(GATEWAY_PERMISSION_MAP[intent], OrgPermissionSubjects.Gateway);- } else {+ } else if (resourceType === RESOURCE_TYPE_RELAY) {ForbiddenError.from(permission).throwUnlessCan(RELAY_PERMISSION_MAP[intent], OrgPermissionSubjects.Relay);+ } else {+ ForbiddenError.from(permission).throwUnlessCan(+ KMIP_SERVER_PERMISSION_MAP[intent],+ OrgPermissionSubjects.KmipServer+ );}};const $loadAuthMethodView = async (resource: ResourceRef): Promise<TAuthMethodView | null> => {+ const loaded = await $loadResource(resource);+ if (!loaded) return null;+// Identity is checked first — it's the authoritative legacy-state signal// and overrides any registry row.- if (resource.type === RESOURCE_TYPE_GATEWAY) {- const gateway = await gatewayV2DAL.findById(resource.id);- if (!gateway) return null;-- if (gateway.identityId) {- const identity = await identityDAL.findById(gateway.identityId);- return {- method: ResourceAuthMethodType.Identity,- config: {- identityId: gateway.identityId,- identityName: identity?.name ?? null- }- };- }- } else {- const relay = await relayDAL.findById(resource.id);- if (!relay) return null;-- if (relay.identityId) {- const identity = await identityDAL.findById(relay.identityId);- return {- method: ResourceAuthMethodType.Identity,- config: {- identityId: relay.identityId,- identityName: identity?.name ?? null- }- };- }+ if (loaded.identityId) {+ const identity = await identityDAL.findById(loaded.identityId);+ return {+ method: ResourceAuthMethodType.Identity,+ config: {+ identityId: loaded.identityId,+ identityName: identity?.name ?? null+ }+ };}- const registryFilter =- resource.type === RESOURCE_TYPE_GATEWAY ? { gatewayId: resource.id } : { relayId: resource.id };- const registry = await resourceAuthMethodDAL.findOne(registryFilter);+ const registry = await resourceAuthMethodDAL.findOne($registryFilter(resource));if (!registry) return null;if (registry.method === ResourceAuthMethodType.Aws) {@@ -172,8 +236,8 @@ export const resourceAuthMethodServiceFactory = ({assertGatewayResource(resource, "auth-method");await $checkPermission(actor, "list", RESOURCE_TYPE_GATEWAY);- const gateway = await gatewayV2DAL.findById(resource.id);- if (!gateway || gateway.orgId !== actor.orgId) {+ const loaded = await $loadResource(resource);+ if (!loaded || loaded.orgId !== actor.orgId) {throw new NotFoundError({ message: `Gateway ${resource.id} not found` });}@@ -188,8 +252,8 @@ export const resourceAuthMethodServiceFactory = ({assertRelayResource(resource, "auth-method");await $checkPermission(actor, "list", RESOURCE_TYPE_RELAY);- const relay = await relayDAL.findById(resource.id);- if (!relay || relay.orgId !== actor.orgId) {+ const loaded = await $loadResource(resource);+ if (!loaded || loaded.orgId !== actor.orgId) {throw new NotFoundError({ message: `Relay ${resource.id} not found` });}@@ -200,6 +264,22 @@ export const resourceAuthMethodServiceFactory = ({return view;};+ const getByKmipServerId = async ({ resource, actor }: TGetAuthMethodDTO) => {+ assertKmipServerResource(resource, "auth-method");+ await $checkPermission(actor, "list", RESOURCE_TYPE_KMIP);++ const loaded = await $loadResource(resource);+ if (!loaded || loaded.orgId !== actor.orgId) {+ throw new NotFoundError({ message: `KMIP server ${resource.id} not found` });+ }++ const view = await $loadAuthMethodView(resource);+ if (!view) {+ throw new NotFoundError({ message: "KMIP server has no auth method configured" });+ }+ return view;+ };+const loadView = async (resource: ResourceRef): Promise<TAuthMethodView | null> => $loadAuthMethodView(resource);// Revoke is meaningful when there's something to invalidate: an active JWT@@ -210,9 +290,7 @@ export const resourceAuthMethodServiceFactory = ({) => {if (resourceInfo.identityId) return false;if (resourceInfo.tokenVersion > 0) return true;- const registryFilter =- resourceType === RESOURCE_TYPE_GATEWAY ? { gatewayId: resourceInfo.id } : { relayId: resourceInfo.id };- const registry = await resourceAuthMethodDAL.findOne(registryFilter);+ const registry = await resourceAuthMethodDAL.findOne($registryFilter({ type: resourceType, id: resourceInfo.id }));if (!registry || registry.method !== ResourceAuthMethodType.Token) return false;const pending = await resourceTokenAuthDAL.findOne({ authMethodId: registry.id });return Boolean(pending);@@ -230,12 +308,10 @@ export const resourceAuthMethodServiceFactory = ({},tx: Knex) => {- const registryRow =- resource.type === RESOURCE_TYPE_GATEWAY- ? { gatewayId: resource.id, method: authMethod.method }- : { relayId: resource.id, method: authMethod.method };-- const registry = await resourceAuthMethodDAL.create(registryRow, tx);+ const registry = await resourceAuthMethodDAL.create(+ { ...$registryFilter(resource), method: authMethod.method },+ tx+ );if (authMethod.method === ResourceAuthMethodType.Aws) {await resourceAwsAuthDAL.create({@@ -254,31 +330,19 @@ export const resourceAuthMethodServiceFactory = ({const setMethod = async ({ resource, authMethod, actor }: TSetAuthMethodDTO): Promise<TAuthMethodView> => {await $checkPermission(actor, "edit", resource.type);- const resourceLabel = resource.type === RESOURCE_TYPE_GATEWAY ? "Gateway" : "Relay";- let identityId: string | null | undefined;-- if (resource.type === RESOURCE_TYPE_GATEWAY) {- const gateway = await gatewayV2DAL.findById(resource.id);- if (!gateway || gateway.orgId !== actor.orgId) {- throw new NotFoundError({ message: `${resourceLabel} ${resource.id} not found` });- }- identityId = gateway.identityId;- } else {- const relay = await relayDAL.findById(resource.id);- if (!relay || relay.orgId !== actor.orgId) {- throw new NotFoundError({ message: `${resourceLabel} ${resource.id} not found` });- }- identityId = relay.identityId;+ const resourceLabel = RESOURCE_LABEL[resource.type];+ const loaded = await $loadResource(resource);+ if (!loaded || loaded.orgId !== actor.orgId) {+ throw new NotFoundError({ message: `${resourceLabel} ${resource.id} not found` });}- if (identityId) {+ if (loaded.identityId) {throw new BadRequestError({message: `This ${resourceLabel.toLowerCase()} is using legacy machine identity auth. Create a new ${resourceLabel.toLowerCase()} with the desired auth method instead of migrating this one.`});}- const registryFilter =- resource.type === RESOURCE_TYPE_GATEWAY ? { gatewayId: resource.id } : { relayId: resource.id };+ const registryFilter = $registryFilter(resource);const current = await resourceAuthMethodDAL.findOne(registryFilter);const previousMethod = current?.method ?? null;@@ -288,11 +352,7 @@ export const resourceAuthMethodServiceFactory = ({if (current) {registryRow = await resourceAuthMethodDAL.updateById(current.id, { method: authMethod.method }, tx);} else {- const createPayload =- resource.type === RESOURCE_TYPE_GATEWAY- ? { gatewayId: resource.id, method: authMethod.method }- : { relayId: resource.id, method: authMethod.method };- registryRow = await resourceAuthMethodDAL.create(createPayload, tx);+ registryRow = await resourceAuthMethodDAL.create({ ...registryFilter, method: authMethod.method }, tx);}// 2. Drop the previous method's config artifacts.@@ -350,29 +410,13 @@ export const resourceAuthMethodServiceFactory = ({const mintToken = async ({ resource, actor }: TMintTokenDTO) => {await $checkPermission(actor, "edit", resource.type);- const resourceLabel = resource.type === RESOURCE_TYPE_GATEWAY ? "Gateway" : "Relay";- let resourceName: string;- let resourceOrgId: string;-- if (resource.type === RESOURCE_TYPE_GATEWAY) {- const gateway = await gatewayV2DAL.findById(resource.id);- if (!gateway || gateway.orgId !== actor.orgId) {- throw new NotFoundError({ message: `${resourceLabel} ${resource.id} not found` });- }- resourceName = gateway.name;- resourceOrgId = gateway.orgId;- } else {- const relay = await relayDAL.findById(resource.id);- if (!relay || relay.orgId !== actor.orgId) {- throw new NotFoundError({ message: `${resourceLabel} ${resource.id} not found` });- }- resourceName = relay.name;- resourceOrgId = relay.orgId!;+ const resourceLabel = RESOURCE_LABEL[resource.type];+ const loaded = await $loadResource(resource);+ if (!loaded || loaded.orgId !== actor.orgId) {+ throw new NotFoundError({ message: `${resourceLabel} ${resource.id} not found` });}- const registryFilter =- resource.type === RESOURCE_TYPE_GATEWAY ? { gatewayId: resource.id } : { relayId: resource.id };- const registry = await resourceAuthMethodDAL.findOne(registryFilter);+ const registry = await resourceAuthMethodDAL.findOne($registryFilter(resource));if (!registry || registry.method !== ResourceAuthMethodType.Token) {throw new BadRequestError({message: `${resourceLabel} is not configured for token authentication (current method: ${registry?.method ?? "none"})`@@ -398,44 +442,25 @@ export const resourceAuthMethodServiceFactory = ({return {...record,token: generated.plainToken,- resourceName,- orgId: resourceOrgId+ resourceName: loaded.name,+ orgId: loaded.orgId};};const revokeAccess = async ({ resource, actor }: TRevokeTokenDTO) => {await $checkPermission(actor, "revoke", resource.type);- const resourceLabel = resource.type === RESOURCE_TYPE_GATEWAY ? "Gateway" : "Relay";- let resourceName: string;- let resourceOrgId: string;- let identityId: string | null | undefined;-- if (resource.type === RESOURCE_TYPE_GATEWAY) {- const gateway = await gatewayV2DAL.findById(resource.id);- if (!gateway || gateway.orgId !== actor.orgId) {- throw new NotFoundError({ message: `${resourceLabel} ${resource.id} not found` });- }- resourceName = gateway.name;- resourceOrgId = gateway.orgId;- identityId = gateway.identityId;- } else {- const relay = await relayDAL.findById(resource.id);- if (!relay || relay.orgId !== actor.orgId) {- throw new NotFoundError({ message: `${resourceLabel} ${resource.id} not found` });- }- resourceName = relay.name;- resourceOrgId = relay.orgId!;- identityId = relay.identityId;+ const resourceLabel = RESOURCE_LABEL[resource.type];+ const loaded = await $loadResource(resource);+ if (!loaded || loaded.orgId !== actor.orgId) {+ throw new NotFoundError({ message: `${resourceLabel} ${resource.id} not found` });}- const registryFilter =- resource.type === RESOURCE_TYPE_GATEWAY ? { gatewayId: resource.id } : { relayId: resource.id };- const registry = await resourceAuthMethodDAL.findOne(registryFilter);+ const registry = await resourceAuthMethodDAL.findOne($registryFilter(resource));if (!registry) {throw new NotFoundError({ message: `${resourceLabel} has no auth method configured` });}- if (identityId) {+ if (loaded.identityId) {throw new BadRequestError({message: `Identity-bound ${resourceLabel.toLowerCase()}s cannot be revoked directly. Create a new ${resourceLabel.toLowerCase()} with AWS or Token auth instead.`});@@ -450,21 +475,13 @@ export const resourceAuthMethodServiceFactory = ({await resourceTokenAuthDAL.delete({ authMethodId: registry.id }, tx);}}- if (resource.type === RESOURCE_TYPE_GATEWAY) {- await gatewayV2DAL.updateById(- resource.id,- { $incr: { tokenVersion: 1 }, heartbeat: null, heartbeatTTL: null },- tx- );- } else {- await relayDAL.updateById(resource.id, { $incr: { tokenVersion: 1 }, heartbeat: null }, tx);- }+ await $bumpTokenVersion(resource, tx);return { deletedTokenCount };});return {- resourceName,- orgId: resourceOrgId,+ resourceName: loaded.name,+ orgId: loaded.orgId,method: registry.method as "aws" | "token",deletedTokenCount: result.deletedTokenCount};@@ -476,29 +493,15 @@ export const resourceAuthMethodServiceFactory = ({iamRequestBody,iamRequestHeaders}: TLoginWithAwsDTO) => {- const resourceLabel = resource.type === RESOURCE_TYPE_GATEWAY ? "Gateway" : "Relay";- let resourceName: string;- let resourceOrgId: string;-- if (resource.type === RESOURCE_TYPE_GATEWAY) {- const gateway = await gatewayV2DAL.findById(resource.id);- if (!gateway) {- throw new UnauthorizedError({ message: `Invalid ${resourceLabel.toLowerCase()} credentials` });- }- resourceName = gateway.name;- resourceOrgId = gateway.orgId;- } else {- const relay = await relayDAL.findById(resource.id);- if (!relay || !relay.orgId) {- throw new UnauthorizedError({ message: `Invalid ${resourceLabel.toLowerCase()} credentials` });- }- resourceName = relay.name;- resourceOrgId = relay.orgId;+ const resourceLabel = RESOURCE_LABEL[resource.type];+ const loaded = await $loadResource(resource);+ if (!loaded || !loaded.orgId) {+ throw new UnauthorizedError({ message: `Invalid ${resourceLabel.toLowerCase()} credentials` });}+ const resourceName = loaded.name;+ const resourceOrgId = loaded.orgId;- const registryFilter =- resource.type === RESOURCE_TYPE_GATEWAY ? { gatewayId: resource.id } : { relayId: resource.id };- const registry = await resourceAuthMethodDAL.findOne(registryFilter);+ const registry = await resourceAuthMethodDAL.findOne($registryFilter(resource));if (!registry || registry.method !== ResourceAuthMethodType.Aws) {throw new UnauthorizedError({message: `${resourceLabel} is not configured for AWS authentication`,@@ -532,36 +535,9 @@ export const resourceAuthMethodServiceFactory = ({errorContext});- let refreshedTokenVersion: number;- if (resource.type === RESOURCE_TYPE_GATEWAY) {- const refreshed = await gatewayV2DAL.updateById(resource.id, {- $incr: { tokenVersion: 1 },- heartbeat: null,- heartbeatTTL: null- });- refreshedTokenVersion = refreshed.tokenVersion;- } else {- const refreshed = await relayDAL.updateById(resource.id, {- $incr: { tokenVersion: 1 },- heartbeat: null- });- refreshedTokenVersion = refreshed.tokenVersion;- }-- const accessToken =- resource.type === RESOURCE_TYPE_GATEWAY- ? mintGatewayJwt({- gatewayId: resource.id,- orgId: resourceOrgId,- tokenVersion: refreshedTokenVersion,- accessTokenTTL: 0- })- : mintRelayJwt({- relayId: resource.id,- orgId: resourceOrgId,- tokenVersion: refreshedTokenVersion,- accessTokenTTL: 0- });+ const refreshedTokenVersion = await $bumpTokenVersion(resource);++ const accessToken = $mintJwt(resource, resourceOrgId, refreshedTokenVersion);return {accessToken,@@ -592,77 +568,50 @@ export const resourceAuthMethodServiceFactory = ({throw new BadRequestError({ message: "Enrollment token is not linked to a resource" });}- // Determine resource type from which FK is set on the registry row.- const isGateway = Boolean(registry.gatewayId);- const isRelay = Boolean(registry.relayId);- if (!isGateway && !isRelay) {+ // Determine resource type from which FK is set on the registry row — exactly one must be set.+ const linkedResourceId = registry.gatewayId ?? registry.relayId ?? registry.kmipServerId;+ if (!linkedResourceId) {throw new BadRequestError({ message: "Enrollment token is not linked to a resource" });}- const actualResourceType = isGateway ? RESOURCE_TYPE_GATEWAY : RESOURCE_TYPE_RELAY;+ let actualResourceType: ResourceRef["type"];+ if (registry.gatewayId) actualResourceType = RESOURCE_TYPE_GATEWAY;+ else if (registry.relayId) actualResourceType = RESOURCE_TYPE_RELAY;+ else actualResourceType = RESOURCE_TYPE_KMIP;+if (actualResourceType !== expectedResourceType) {throw new BadRequestError({message: `Enrollment token belongs to a ${actualResourceType}, not a ${expectedResourceType}`});}- const linkedResourceId = (isGateway ? registry.gatewayId : registry.relayId)!;-- if (isGateway) {- const gateway = await resourceTokenAuthDAL.transaction(async (tx) => {- const deleted = await resourceTokenAuthDAL.delete({ id: tokenRecord.id }, tx);- if (deleted.length === 0) {- throw new BadRequestError({ message: "Enrollment token has already been used" });- }- const existing = await gatewayV2DAL.findById(linkedResourceId, tx);- if (!existing) throw new NotFoundError({ message: `Gateway ${linkedResourceId} not found` });- return gatewayV2DAL.updateById(- existing.id,- { $incr: { tokenVersion: 1 }, heartbeat: null, heartbeatTTL: null },- tx- );- });+ const linkedResource: ResourceRef = { type: actualResourceType, id: linkedResourceId };- const accessToken = mintGatewayJwt({- gatewayId: gateway.id,- orgId: gateway.orgId,- tokenVersion: gateway.tokenVersion,- accessTokenTTL: 0- });-- return {- accessToken,- resourceType: "gateway" as const,- resourceId: gateway.id,- resourceName: gateway.name,- orgId: gateway.orgId,- enrollmentTokenId: tokenRecord.id- };- }-- const relay = await resourceTokenAuthDAL.transaction(async (tx) => {+ const result = await resourceTokenAuthDAL.transaction(async (tx) => {const deleted = await resourceTokenAuthDAL.delete({ id: tokenRecord.id }, tx);if (deleted.length === 0) {throw new BadRequestError({ message: "Enrollment token has already been used" });}- const existing = await relayDAL.findById(linkedResourceId, tx);- if (!existing) throw new NotFoundError({ message: `Relay ${linkedResourceId} not found` });- return relayDAL.updateById(existing.id, { $incr: { tokenVersion: 1 }, heartbeat: null }, tx);+ const existing = await $loadResource(linkedResource, tx);+ if (!existing) {+ throw new NotFoundError({ message: `${RESOURCE_LABEL[actualResourceType]} ${linkedResourceId} not found` });+ }+ const tokenVersion = await $bumpTokenVersion(linkedResource, tx);+ return { name: existing.name, orgId: existing.orgId, tokenVersion };});- const accessToken = mintRelayJwt({- relayId: relay.id,- orgId: relay.orgId!,- tokenVersion: relay.tokenVersion,- accessTokenTTL: 0- });+ if (!result.orgId) {+ throw new BadRequestError({ message: "Enrollment token is not linked to a resource" });+ }++ const accessToken = $mintJwt(linkedResource, result.orgId, result.tokenVersion);return {accessToken,- resourceType: "relay" as const,- resourceId: relay.id,- resourceName: relay.name,- orgId: relay.orgId!,+ resourceType: actualResourceType,+ resourceId: linkedResourceId,+ resourceName: result.name,+ orgId: result.orgId,enrollmentTokenId: tokenRecord.id};};@@ -670,6 +619,7 @@ export const resourceAuthMethodServiceFactory = ({return {getByGatewayId,getByRelayId,+ getByKmipServerId,loadView,canRevoke,initAtCreate,diff --git a/backend/src/ee/services/resource-auth-method/resource-auth-method-types.ts b/backend/src/ee/services/resource-auth-method/resource-auth-method-types.tsindex a59170229c..b9636ec766 100644--- a/backend/src/ee/services/resource-auth-method/resource-auth-method-types.ts+++ b/backend/src/ee/services/resource-auth-method/resource-auth-method-types.ts@@ -35,7 +35,7 @@ export type TLoginWithAwsDTO = {export type TLoginWithTokenDTO = {token: string;- expectedResourceType: "gateway" | "relay";+ expectedResourceType: "gateway" | "relay" | "kmip";};export type TAuthMethodView =diff --git a/backend/src/server/plugins/audit-log.ts b/backend/src/server/plugins/audit-log.tsindex f5a4d638ee..f7d478e8fd 100644--- a/backend/src/server/plugins/audit-log.ts+++ b/backend/src/server/plugins/audit-log.ts@@ -102,6 +102,13 @@ export const injectAuditLogInfo = fp(async (server: FastifyZodProvider) => {relayId: req.permission.id}};+ } else if (req.auth.actor === ActorType.KMIP_SERVER) {+ payload.actor = {+ type: ActorType.KMIP_SERVER,+ metadata: {+ kmipServerId: req.permission.id+ }+ };} else {throw new BadRequestError({ message: "Invalid actor type provided" });}diff --git a/backend/src/server/plugins/auth/inject-identity.ts b/backend/src/server/plugins/auth/inject-identity.tsindex 973fd065e0..bcc03a778f 100644--- a/backend/src/server/plugins/auth/inject-identity.ts+++ b/backend/src/server/plugins/auth/inject-identity.ts@@ -17,6 +17,7 @@ import {AuthTokenType,MfaMethod,TGatewayAccessTokenJwtPayload,+ TKmipServerAccessTokenJwtPayload,TRelayAccessTokenJwtPayload} from "@app/services/auth/auth-type";import { TIdentityAccessTokenJwtPayload } from "@app/services/identity-access-token/identity-access-token-types";@@ -99,6 +100,16 @@ export type TAuthMode =parentOrgId: string;authMethod: null;token: TRelayAccessTokenJwtPayload;+ }+ | {+ authMode: AuthMode.KMIP_SERVER_ACCESS_TOKEN;+ actor: ActorType.KMIP_SERVER;+ kmipServerId: string;+ orgId: string;+ rootOrgId: string;+ parentOrgId: string;+ authMethod: null;+ token: TKmipServerAccessTokenJwtPayload;};export const extractAuth = async (req: FastifyRequest, jwtSecret: string) => {@@ -163,6 +174,12 @@ export const extractAuth = async (req: FastifyRequest, jwtSecret: string) => {token: decodedToken as TRelayAccessTokenJwtPayload,actor: ActorType.RELAY} as const;+ case AuthTokenType.KMIP_SERVER_ACCESS_TOKEN:+ return {+ authMode: AuthMode.KMIP_SERVER_ACCESS_TOKEN,+ token: decodedToken as TKmipServerAccessTokenJwtPayload,+ actor: ActorType.KMIP_SERVER+ } as const;default:return { authMode: null, token: null } as const;}@@ -421,6 +438,30 @@ export const injectIdentity = fp(};break;}+ case AuthMode.KMIP_SERVER_ACCESS_TOKEN: {+ const kmipServer = await server.services.kmipServer.getOrgKmipServer({+ kmipServerId: token.kmipServerId,+ orgId: token.orgId+ });++ if (kmipServer.tokenVersion !== token.tokenVersion) {+ throw new UnauthorizedError({ message: "KMIP server token has been revoked" });+ }++ requestContext.set(RequestContextKey.OrgId, token.orgId);++ req.auth = {+ authMode: AuthMode.KMIP_SERVER_ACCESS_TOKEN,+ actor,+ kmipServerId: token.kmipServerId,+ orgId: token.orgId,+ rootOrgId: token.orgId,+ parentOrgId: token.orgId,+ authMethod: null,+ token+ };+ break;+ }default:throw new BadRequestError({ message: "Invalid token strategy provided" });}diff --git a/backend/src/server/plugins/auth/inject-permission.ts b/backend/src/server/plugins/auth/inject-permission.tsindex 5fcc717745..5c1cd742c7 100644--- a/backend/src/server/plugins/auth/inject-permission.ts+++ b/backend/src/server/plugins/auth/inject-permission.ts@@ -87,6 +87,19 @@ export const injectPermission = fp(async (server) => {logger.info(`injectPermission: Injecting permissions for [permissionsForRelay=${req.auth.relayId}] [type=${ActorType.RELAY}]`);+ } else if (req.auth.actor === ActorType.KMIP_SERVER) {+ req.permission = {+ type: ActorType.KMIP_SERVER,+ id: req.auth.kmipServerId,+ orgId: req.auth.orgId,+ rootOrgId: req.auth.rootOrgId,+ parentOrgId: req.auth.parentOrgId,+ authMethod: null+ };++ logger.info(+ `injectPermission: Injecting permissions for [permissionsForKmipServer=${req.auth.kmipServerId}] [type=${ActorType.KMIP_SERVER}]`+ );}});});diff --git a/backend/src/server/routes/index.ts b/backend/src/server/routes/index.tsindex 8de212dea5..830786f7b8 100644--- a/backend/src/server/routes/index.ts+++ b/backend/src/server/routes/index.ts@@ -88,6 +88,8 @@ import { kmipOperationServiceFactory } from "@app/ee/services/kmip/kmip-operatioimport { kmipOrgConfigDALFactory } from "@app/ee/services/kmip/kmip-org-config-dal";import { kmipOrgServerCertificateDALFactory } from "@app/ee/services/kmip/kmip-org-server-certificate-dal";import { kmipServiceFactory } from "@app/ee/services/kmip/kmip-service";+import { kmipServerDALFactory } from "@app/ee/services/kmip-server/kmip-server-dal";+import { kmipServerServiceFactory } from "@app/ee/services/kmip-server/kmip-server-service";import { ldapConfigDALFactory } from "@app/ee/services/ldap-config/ldap-config-dal";import { ldapConfigServiceFactory } from "@app/ee/services/ldap-config/ldap-config-service";import { ldapGroupMapDALFactory } from "@app/ee/services/ldap-config/ldap-group-map-dal";@@ -1357,6 +1359,7 @@ export const registerRoutes = async (const orgRelayConfigDAL = orgRelayConfigDalFactory(db);const relayDAL = relayDalFactory(db);const gatewayV2DAL = gatewayV2DalFactory(db);+ const kmipServerDAL = kmipServerDALFactory(db);const resourceTokenAuthDAL = resourceTokenAuthDALFactory(db);const resourceAuthMethodDAL = resourceAuthMethodDALFactory(db);const resourceAwsAuthDAL = resourceAwsAuthDALFactory(db);@@ -1561,6 +1564,7 @@ export const registerRoutes = async (resourceTokenAuthDAL,gatewayV2DAL,relayDAL,+ kmipServerDAL,identityDAL,permissionService});@@ -1579,6 +1583,12 @@ export const registerRoutes = async (gatewayV2DAL});+ const kmipServerService = kmipServerServiceFactory({+ kmipServerDAL,+ permissionService,+ resourceAuthMethodService+ });+const gatewayV2Service = gatewayV2ServiceFactory({kmsService,relayService,@@ -3558,6 +3568,7 @@ export const registerRoutes = async (secretSync: secretSyncService,kmip: kmipService,kmipOperation: kmipOperationService,+ kmipServer: kmipServerService,gateway: gatewayService,relay: relayService,gatewayV2: gatewayV2Service,diff --git a/backend/src/services/auth/auth-type.ts b/backend/src/services/auth/auth-type.tsindex c9b6c65746..daf60f616f 100644--- a/backend/src/services/auth/auth-type.ts+++ b/backend/src/services/auth/auth-type.ts@@ -24,6 +24,7 @@ export enum AuthTokenType {SCIM_TOKEN = "scimToken",GATEWAY_ACCESS_TOKEN = "gatewayAccessToken",RELAY_ACCESS_TOKEN = "relayAccessToken",+ KMIP_SERVER_ACCESS_TOKEN = "kmipServerAccessToken",ACCOUNT_RECOVERY_TOKEN = "accountRecoveryToken"}@@ -43,7 +44,8 @@ export enum AuthMode {SCIM_TOKEN = "scimToken",MCP_JWT = "mcpJwt",GATEWAY_ACCESS_TOKEN = "gatewayAccessToken",- RELAY_ACCESS_TOKEN = "relayAccessToken"+ RELAY_ACCESS_TOKEN = "relayAccessToken",+ KMIP_SERVER_ACCESS_TOKEN = "kmipServerAccessToken"}export enum ActorType { // would extend to AWS, Azure, ...@@ -59,7 +61,8 @@ export enum ActorType { // would extend to AWS, Azure, ...SCEP_ACCOUNT = "scepAccount",UNKNOWN_USER = "unknownUser",GATEWAY = "gateway",- RELAY = "relay"+ RELAY = "relay",+ KMIP_SERVER = "kmipServer"}export type TGatewayAccessTokenJwtPayload = {@@ -76,6 +79,13 @@ export type TRelayAccessTokenJwtPayload = {tokenVersion: number;};+export type TKmipServerAccessTokenJwtPayload = {+ authTokenType: AuthTokenType.KMIP_SERVER_ACCESS_TOKEN;+ kmipServerId: string;+ orgId: string;+ tokenVersion: number;+};+// This will be null unless the token-type is JWTexport type ActorAuthMethod = AuthMethod | null;diff --git a/backend/src/services/telemetry/telemetry-types.ts b/backend/src/services/telemetry/telemetry-types.tsindex 377f934c50..7402bf4be5 100644--- a/backend/src/services/telemetry/telemetry-types.ts+++ b/backend/src/services/telemetry/telemetry-types.ts@@ -6,6 +6,7 @@ import {GatewayActor,IdentityActor,KmipClientActor,+ KmipServerActor,PlatformActor,RelayActor,ScepAccountActor,@@ -275,7 +276,8 @@ export type TSecretModifiedEvent = {| EstAccountActor| ScepAccountActor| GatewayActor- | RelayActor;+ | RelayActor+ | KmipServerActor;};};diff --git a/docs/cli/commands/kmip.mdx b/docs/cli/commands/kmip.mdxindex 0a67a0fc1f..6e5561f531 100644--- a/docs/cli/commands/kmip.mdx+++ b/docs/cli/commands/kmip.mdx@@ -7,17 +7,22 @@ description: "Run the Infisical KMIP server or manage its systemd service"<Tab title="Start KMIP server">```bashinfisical kmip start \- --identity-client-id=<client-id> \- --identity-client-secret=<client-secret> \- --hostnames-or-ips=<hostnames-or-ips>+ --enroll-method=token \+ --token=<enrollment-token> \+ --server-name=<server-name> \+ --hostnames-or-ips=<hostnames-or-ips> \+ --domain=<your-infisical-domain>```</Tab><Tab title="Start as background daemon (Linux only)">```bashsudo infisical kmip systemd install \- --identity-client-id=<client-id> \- --identity-client-secret=<client-secret> \- --hostnames-or-ips=<hostnames-or-ips>+ --enroll-method=token \+ --token=<enrollment-token> \+ --server-name=<server-name> \+ --hostnames-or-ips=<hostnames-or-ips> \+ --domain=<your-infisical-domain>+ sudo systemctl start infisical-kmip```</Tab></Tabs>@@ -26,64 +31,80 @@ description: "Run the Infisical KMIP server or manage its systemd service"The Infisical KMIP server provides Key Management Interoperability Protocol (KMIP) support for integration with KMIP-compatible clients. It acts as a proxy between your KMIP clients and Infisical KMS, enabling standardized key management operations.+The server is created as an entity in the Infisical UI and then enrolled from the host where you run it, using either a one-time enrollment **token** or **AWS** authentication. The deploy command (including the enrollment token) can be copied from the server's detail page via **Show deploy command**.+For detailed information about KMIP integration, PKI setup, and client configuration, see the [KMIP Integration Guide](/documentation/platform/kms/kmip).## Subcommands & flags<AccordionGroup><Accordion title="infisical kmip start" defaultOpen="true">- Run the Infisical KMIP server in the foreground. The server authenticates to Infisical using a machine identity and proxies KMIP requests to Infisical KMS.+ Run the Infisical KMIP server in the foreground. The server enrolls with Infisical, listens for KMIP client connections, and proxies KMIP operations to Infisical KMS.```bashinfisical kmip start \- --identity-client-id=<client-id> \- --identity-client-secret=<client-secret> \- --hostnames-or-ips=<hostnames-or-ips>+ --enroll-method=token \+ --token=<enrollment-token> \+ --server-name=<server-name> \+ --hostnames-or-ips=<hostnames-or-ips> \+ --domain=<your-infisical-domain>```Once started, the KMIP server will:-- Authenticate to Infisical using the provided machine identity credentials+- Authenticate to Infisical using the enrollment method you provide- Listen for incoming KMIP client connections-- Proxy KMIP operations (Create, Get, Activate, Revoke, etc.) to Infisical KMS+- Forward KMIP operations (Create, Get, Activate, Revoke, etc.) to Infisical KMS- Handle mTLS authentication for KMIP clients### Flags<AccordionGroup>- <Accordion title="--identity-client-id">- The client ID of the machine identity for Universal Auth authentication.+ <Accordion title="--enroll-method">+ The enrollment method used to authenticate the KMIP server: `token` or `aws`.```bash# Example- infisical kmip start --identity-client-id=<client-id> --identity-client-secret=<client-secret> --hostnames-or-ips=<hostnames-or-ips>+ infisical kmip start --enroll-method=token --token=<enrollment-token> --server-name=<server-name>```- You may also set this via the environment variable `INFISICAL_UNIVERSAL_AUTH_CLIENT_ID`.+ You may also set this via the environment variable `INFISICAL_KMIP_ENROLL_METHOD`.++ </Accordion>++ <Accordion title="--token">+ The one-time enrollment token (when `--enroll-method=token`). Generate it from the KMIP server's detail page via **Show deploy command**. Tokens are single-use and expire after 1 hour.++ On restart, the CLI reuses the long-lived access token it stored at enrollment, so the token is only needed for the initial deployment.++ ```bash+ # Example+ infisical kmip start --enroll-method=token --token=<enrollment-token> --server-name=<server-name>+ ```</Accordion>- <Accordion title="--identity-client-secret">- The client secret of the machine identity for Universal Auth authentication.+ <Accordion title="--kmip-server-id">+ The KMIP server ID (when `--enroll-method=aws`). The server signs an `sts:GetCallerIdentity` request on every start and authenticates against the allowlist configured on the server entity.```bash# Example- infisical kmip start --identity-client-id=<client-id> --identity-client-secret=<client-secret> --hostnames-or-ips=<hostnames-or-ips>+ infisical kmip start --enroll-method=aws --kmip-server-id=<kmip-server-id> --server-name=<server-name>```- You may also set this via the environment variable `INFISICAL_UNIVERSAL_AUTH_CLIENT_SECRET`.+ You may also set this via the environment variable `INFISICAL_KMIP_SERVER_ID`.</Accordion>- <Accordion title="--hostnames-or-ips">- Comma-separated list of hostnames or IP addresses for the KMIP server certificate. These should match how clients will connect to the server.+ <Accordion title="--server-name">+ The name of the KMIP server. Default: `kmip-server`. This scopes where enrollment state is stored locally, so use the same name across restarts.```bash# Example- infisical kmip start --identity-client-id=<client-id> --identity-client-secret=<client-secret> --hostnames-or-ips="kmip.example.com,10.0.1.50"+ infisical kmip start --server-name="production-kmip" --enroll-method=token --token=<enrollment-token>```- You may also set this via the environment variable `INFISICAL_KMIP_HOSTNAMES_OR_IPS`.+ You may also set this via the environment variable `INFISICAL_KMIP_SERVER_NAME`.</Accordion>@@ -92,7 +113,7 @@ Once started, the KMIP server will:```bash# Example- infisical kmip start --domain=https://app.your-domain.com --identity-client-id=<client-id> --identity-client-secret=<client-secret> --hostnames-or-ips=<hostnames-or-ips>+ infisical kmip start --domain=https://app.your-domain.com --enroll-method=token --token=<enrollment-token> --server-name=<server-name>```You may also set this via the environment variable `INFISICAL_API_URL`.@@ -100,38 +121,38 @@ Once started, the KMIP server will:</Accordion><Accordion title="--listen-address">- The address for the KMIP server to listen on. Default: `localhost:5696`.+ The address for the KMIP server to listen on. Default: `localhost:5696`. To accept connections from other hosts, bind to all interfaces (`0.0.0.0:5696`) or a specific interface.```bash# Example - listen on all interfaces- infisical kmip start --listen-address="0.0.0.0:5696" --identity-client-id=<client-id> --identity-client-secret=<client-secret> --hostnames-or-ips=<hostnames-or-ips>+ infisical kmip start --listen-address="0.0.0.0:5696" --enroll-method=token --token=<enrollment-token> --server-name=<server-name>```You may also set this via the environment variable `INFISICAL_KMIP_LISTEN_ADDRESS`.</Accordion>- <Accordion title="--server-name">- The name of the KMIP server. Default: `kmip-server`.+ <Accordion title="--certificate-ttl">+ The TTL duration for the server certificate. Default: `1y`.```bash# Example- infisical kmip start --server-name="production-kmip" --identity-client-id=<client-id> --identity-client-secret=<client-secret> --hostnames-or-ips=<hostnames-or-ips>+ infisical kmip start --certificate-ttl="6m" --enroll-method=token --token=<enrollment-token> --server-name=<server-name>```- You may also set this via the environment variable `INFISICAL_KMIP_SERVER_NAME`.+ You may also set this via the environment variable `INFISICAL_KMIP_CERTIFICATE_TTL`.</Accordion>- <Accordion title="--certificate-ttl">- The TTL duration for the server certificate. Default: `1y`.+ <Accordion title="--hostnames-or-ips (required)">+ Comma-separated list of hostnames or IP addresses that KMIP clients will use to reach the server. These become the Subject Alternative Names (SANs) of the server's TLS certificate, so they must match how clients connect.```bash# Example- infisical kmip start --certificate-ttl="6m" --identity-client-id=<client-id> --identity-client-secret=<client-secret> --hostnames-or-ips=<hostnames-or-ips>+ infisical kmip start --hostnames-or-ips="kmip.example.com,10.0.1.50" --enroll-method=token --token=<enrollment-token> --server-name=<server-name>```- You may also set this via the environment variable `INFISICAL_KMIP_CERTIFICATE_TTL`.+ You may also set this via the environment variable `INFISICAL_KMIP_HOSTNAMES_OR_IPS`.</Accordion></AccordionGroup>@@ -143,11 +164,16 @@ Once started, the KMIP server will:```bashsudo infisical kmip systemd install \- --identity-client-id=<client-id> \- --identity-client-secret=<client-secret> \- --hostnames-or-ips=<hostnames-or-ips>+ --enroll-method=token \+ --token=<enrollment-token> \+ --server-name=<server-name> \+ --hostnames-or-ips=<hostnames-or-ips> \+ --domain=<your-infisical-domain>+sudo systemctl start infisical-kmip```+For token enrollment, the single-use token is exchanged for a long-lived access token at install time and persisted to the service config; the service reuses it on every restart. For AWS enrollment, no token is stored and the server re-authenticates via STS on each start.+### Requirements- Must be run on Linux@@ -156,98 +182,14 @@ sudo infisical kmip systemd install \### What it does-1. Creates a config file at `/etc/infisical/kmip.conf` with the provided credentials and settings+1. Creates a config file at `/etc/infisical/kmip.conf` with the provided enrollment settings2. Creates a systemd service file at `/etc/systemd/system/infisical-kmip.service`3. Reloads the systemd daemon4. Enables the service to start on boot### Flags- <AccordionGroup>- <Accordion title="--identity-client-id (required)">- The client ID of the machine identity for Universal Auth authentication.-- ```bash- # Example- sudo infisical kmip systemd install --identity-client-id=<client-id> --identity-client-secret=<client-secret> --hostnames-or-ips=<hostnames-or-ips>- ```-- You may also set this via the environment variable `INFISICAL_UNIVERSAL_AUTH_CLIENT_ID`.-- </Accordion>-- <Accordion title="--identity-client-secret (required)">- The client secret of the machine identity for Universal Auth authentication.-- ```bash- # Example- sudo infisical kmip systemd install --identity-client-id=<client-id> --identity-client-secret=<client-secret> --hostnames-or-ips=<hostnames-or-ips>- ```-- You may also set this via the environment variable `INFISICAL_UNIVERSAL_AUTH_CLIENT_SECRET`.-- </Accordion>-- <Accordion title="--hostnames-or-ips (required)">- Comma-separated list of hostnames or IP addresses for the KMIP server certificate.-- ```bash- # Example- sudo infisical kmip systemd install --identity-client-id=<client-id> --identity-client-secret=<client-secret> --hostnames-or-ips="kmip.example.com,10.0.1.50"- ```-- You may also set this via the environment variable `INFISICAL_KMIP_HOSTNAMES_OR_IPS`.-- </Accordion>-- <Accordion title="--domain">- Domain of your self-hosted Infisical instance. If not specified, defaults to Infisical Cloud.-- ```bash- # Example- sudo infisical kmip systemd install --domain=https://app.your-domain.com --identity-client-id=<client-id> --identity-client-secret=<client-secret> --hostnames-or-ips=<hostnames-or-ips>- ```-- You may also set this via the environment variable `INFISICAL_API_URL`.-- </Accordion>-- <Accordion title="--listen-address">- The address for the KMIP server to listen on. Default: `localhost:5696`.-- ```bash- # Example- sudo infisical kmip systemd install --listen-address="0.0.0.0:5696" --identity-client-id=<client-id> --identity-client-secret=<client-secret> --hostnames-or-ips=<hostnames-or-ips>- ```-- You may also set this via the environment variable `INFISICAL_KMIP_LISTEN_ADDRESS`.-- </Accordion>-- <Accordion title="--server-name">- The name of the KMIP server. Default: `kmip-server`.-- ```bash- # Example- sudo infisical kmip systemd install --server-name="production-kmip" --identity-client-id=<client-id> --identity-client-secret=<client-secret> --hostnames-or-ips=<hostnames-or-ips>- ```-- You may also set this via the environment variable `INFISICAL_KMIP_SERVER_NAME`.-- </Accordion>-- <Accordion title="--certificate-ttl">- The TTL duration for the server certificate. Default: `1y`.-- ```bash- # Example- sudo infisical kmip systemd install --certificate-ttl="6m" --identity-client-id=<client-id> --identity-client-secret=<client-secret> --hostnames-or-ips=<hostnames-or-ips>- ```-- You may also set this via the environment variable `INFISICAL_KMIP_CERTIFICATE_TTL`.-- </Accordion>- </AccordionGroup>+`infisical kmip systemd install` accepts the same flags as `infisical kmip start` (documented above): `--enroll-method`, `--token`, `--kmip-server-id`, `--server-name`, `--hostnames-or-ips`, `--domain`, `--listen-address`, and `--certificate-ttl`.### Service Detailsdiff --git a/docs/documentation/platform/kms/kmip.mdx b/docs/documentation/platform/kms/kmip.mdxindex a6c76a1e52..268e6a2ddb 100644--- a/docs/documentation/platform/kms/kmip.mdx+++ b/docs/documentation/platform/kms/kmip.mdx@@ -21,10 +21,12 @@ At a high level, the KMIP integration works as follows:1. KMIP clients (your applications or tools) communicate with the KMIP server2. The KMIP server acts as a proxy and forwards requests to Infisical KMS-3. The KMIP server authenticates to Infisical using a machine identity+3. The KMIP server authenticates to Infisical using an enrollment-based access tokenThe KMIP server itself is deployed using the Infisical CLI (`infisical kmip start` command) and serves as an intermediary between your KMIP clients and Infisical's key management system.+You create a KMIP server entity in Infisical, then enroll a deployed server against it using a one-time enrollment token or AWS authentication. This is the same enrollment model used by [Gateways](/documentation/platform/gateways/overview) and [Relays](/documentation/platform/gateways/relay-deployment).+### Supported OperationsThe Infisical KMIP server supports the following operations for symmetric keys:@@ -49,88 +51,156 @@ Ensure the following network connectivity is in place:- **KMIP Client → KMIP Server**: KMIP clients must be able to reach the KMIP server on port 5696 (or your configured port). Ensure firewalls allow this traffic and DNS resolution works if using hostnames.-- **KMIP Server → Infisical Platform**: The KMIP server needs outbound HTTP access to Infisical. For self-hosted instances, ensure connectivity to your custom domain.+- **KMIP Server → Infisical Platform**: The KMIP server needs outbound HTTPS access to Infisical. For self-hosted instances, ensure connectivity to your custom domain.++All connections from the KMIP server are outbound; no inbound ports need to be opened on the server's network for it to reach Infisical.## Configure and Deploy the KMIP Server-Follow these steps in order to set up KMIP integration with Infisical:+A KMIP server is created as an organization-wide entity in Infisical and then enrolled from the host where you run it.<Steps>- <Step title="Create a Machine Identity for the KMIP Server">- The KMIP server needs a machine identity to authenticate with Infisical and proxy requests on behalf of clients.-- Configure a [machine identity](/documentation/platform/identities/machine-identities#machine-identities) by heading to your organization's **Access Control** and switching over to the **identities** tab.- From there you can click **Create Identity**.+ <Step title="Create the KMIP Server in the UI">+ 1. In the Infisical dashboard, open **Infisical KMS** and select **KMIP Servers**.+ 2. Click **Create KMIP Server** and enter a **name**.+ 3. (Optional) Open the new server's detail page and click the edit icon next to **Authentication** to switch the auth method. Two methods are supported:+ - **Token** (default): a one-time enrollment token (1h expiry) bootstraps the server.+ - **AWS**: the server authenticates by signing an `sts:GetCallerIdentity` request with whatever AWS credentials it can resolve on the host (instance role, env vars, shared profile). Configure the allowed principal ARNs and/or account IDs that match your hosts.+ 4. Click **Show deploy command** in the **Deployment** card and copy the generated CLI command.+ </Step>- This guide assumes you'll be using the [Universal Auth](/documentation/platform/identities/universal-auth) method for the machine identity but you can choose any supported authentication method.-- + <Step title="Install the Infisical CLI">+ Make sure the Infisical CLI is installed on the target machine where you want to run the KMIP server. See the [CLI Installation Guide](/cli/overview) for instructions.- This machine identity will be used by the KMIP server to authenticate and forward client requests to Infisical KMS.+ You can run the KMIP server on any infrastructure that can reach the Infisical platform, such as a VM or container.</Step>- <Step title="Create a Custom Organization Role with Proxy KMIP Permission">- The machine identity needs permission to proxy KMIP requests.+ <Step title="Configure Network & Firewall">+ Ensure your network and firewall settings allow the required traffic.- Create a custom organization role and give it the **Proxy KMIP** permission.-- - + | Protocol | Direction | Port | Purpose |+ | -------- | --------- | ---- | ------------------------------------------------ |+ | TCP | Inbound | 5696 | KMIP client connections to the KMIP server |+ | TCP | Outbound | 443 | API communication and certificate requests |- This permission allows the KMIP server to act as an intermediary between KMIP clients and Infisical.+ Only the KMIP client port (default `5696`) needs to be reachable by your clients. All traffic from the server to Infisical is outbound.</Step>- <Step title="Assign the Organization Role to the Machine Identity">- Now connect the machine identity to the role you just created.+ <Step title="Run the CLI Command">+ Run the command you copied from the UI on the target machine. This single command enrolls the KMIP server and starts it immediately.++ <AccordionGroup>+ <Accordion title="Token Auth">+ A one-time enrollment token (1h expiry) bootstraps the KMIP server.++ <Tabs>+ <Tab title="Linux (Production)">+ ```bash+ sudo infisical kmip systemd install \+ --enroll-method=token \+ --token=<enrollment-token> \+ --server-name=<server-name> \+ --hostnames-or-ips=<hostnames-or-ips> \+ --listen-address="0.0.0.0:5696" \+ --domain=<your-infisical-domain>+ sudo systemctl start infisical-kmip+ ```+ </Tab>+ <Tab title="Foreground">+ ```bash+ infisical kmip start \+ --enroll-method=token \+ --token=<enrollment-token> \+ --server-name=<server-name> \+ --hostnames-or-ips=<hostnames-or-ips> \+ --listen-address="0.0.0.0:5696" \+ --domain=<your-infisical-domain>+ ```+ </Tab>+ </Tabs>+ </Accordion>+ <Accordion title="AWS Auth">+ The host must have AWS credentials whose principal matches your allowlist. The server re-authenticates via STS on every start.++ <Tabs>+ <Tab title="Linux (Production)">+ ```bash+ sudo infisical kmip systemd install \+ --enroll-method=aws \+ --kmip-server-id=<kmip-server-id> \+ --server-name=<server-name> \+ --hostnames-or-ips=<hostnames-or-ips> \+ --listen-address="0.0.0.0:5696" \+ --domain=<your-infisical-domain>+ sudo systemctl start infisical-kmip+ ```+ </Tab>+ <Tab title="Foreground">+ ```bash+ infisical kmip start \+ --enroll-method=aws \+ --kmip-server-id=<kmip-server-id> \+ --server-name=<server-name> \+ --hostnames-or-ips=<hostnames-or-ips> \+ --listen-address="0.0.0.0:5696" \+ --domain=<your-infisical-domain>+ ```+ </Tab>+ </Tabs>+ </Accordion>+ </AccordionGroup>++ <Warning>+ The systemd install command requires Linux with root/sudo privileges.+ </Warning>++ <Note>+ Replace `<hostnames-or-ips>` with a comma-separated list of the hostnames or IPs that KMIP clients will use to reach this server (for example `kmip.example.com` or `10.0.1.50`). These become the Subject Alternative Names (SANs) of the server's TLS certificate, so they must match how clients connect.+ </Note>++ <Note>+ By default the server listens on `localhost:5696`, which only accepts connections from the same host. To accept connections from your KMIP clients, set `--listen-address="0.0.0.0:5696"` (or bind to a specific interface).+ </Note>- Assign the machine identity to the custom organization role.-- + <Info>+ Token-method enrollment tokens are single-use and expire after 1 hour. If the token expires before deployment, click **Show deploy command** again on the detail page to generate a new one.+ </Info>- This grants the machine identity the ability to serve KMIP client requests and forward them from your KMIP server to Infisical.+ <Info>+ You can safely re-run the same command to restart the server. For token auth the CLI reuses the locally stored access token and skips enrollment; for AWS auth it re-authenticates via STS on each start.+ </Info></Step>- <Step title="Deploy the KMIP Server">- Now you're ready to deploy the KMIP server.- You can run the KMIP server on any infrastructure that can reach the Infisical platform, such as a VM or container.-- Once you have your infrastructure ready, you'll need to install the Infisical CLI on the server where you want to run the KMIP server.+ <Step title="Verify the KMIP Server">+ After deployment, verify the server is running:+ 1. **Check logs** for a "Listening on ..." message and confirm the certificates loaded successfully.+ 2. For systemd installations, check the service status:+ ```bash+ sudo systemctl status infisical-kmip+ sudo journalctl -u infisical-kmip -f+ ```- To install the latest Infisical CLI visit [Infisical CLI instructions](https://infisical.com/docs/cli/overview).- If you need to install specific versions of the CLI, you can find them on the [Infisical CLI GitHub Releases](https://github.com/Infisical/cli/releases).+ Once started, your KMIP server is running and ready to accept client connections. It proxies all KMIP operations to Infisical KMS.+ </Step>+</Steps>- Then, launch the KMIP server with the following command:+## Managing a KMIP Server- ```bash- infisical kmip start \- --identity-client-id=example-client-id \- --identity-client-secret=example-client-secret \- --domain=https://my-infisical-instance.com \- --listen-address="0.0.0.0:5696" \- --hostnames-or-ips="my-kmip-server.com"- ```+From the KMIP server's detail page (under **Infisical KMS > KMIP Servers**):- **Available flags:**- - **listen-address** (default: localhost:5696): The address the KMIP server listens on. In most cases you'll want to listen on all interfaces (0.0.0.0:5696)- - **identity-auth-method** (default: universal-auth): The authentication method for the machine identity- - **identity-client-id**: The client ID of the machine identity (can be set via `INFISICAL_UNIVERSAL_AUTH_CLIENT_ID` env var)- - **identity-client-secret**: The client secret of the machine identity (can be set via `INFISICAL_UNIVERSAL_AUTH_CLIENT_SECRET` env var)- - **server-name** (default: "kmip-server"): The name of the KMIP server- - **certificate-ttl** (default: "1y"): The duration for which the server certificate is valid- - **hostnames-or-ips**: The IP address or the hostname of the server where you have deployed the KMIP server.+- **Show deploy command** — Generates a fresh enrollment token (token method) or re-displays the AWS start command. For token-method servers this does not disconnect a running server; the next enrollment with the new token supersedes the old one.+- **Edit authentication** — Switch between Token and AWS, or update the AWS allowlists.+- **Options → Revoke Access** — Invalidates the server's outstanding access tokens and enrollment tokens. The server must re-enroll to reconnect.+- **Options → Delete** — Permanently removes the KMIP server entity.- Once started, your KMIP server is now running and ready to accept client connections. It will authenticate to Infisical using the machine identity and proxy all KMIP operations.+## Register a KMIP Client- <Info>- **Running as a Background Service (Linux):** For production deployments on Linux, you can install the KMIP server as a systemd service using `sudo infisical kmip systemd install`. This ensures the server starts automatically on boot and restarts on failure. See the [KMIP CLI Command Reference](/cli/commands/kmip) for details.- </Info>- </Step>+Once the KMIP server is running, register the KMIP clients that will connect to it. Clients are managed per-project from a KMS project's KMIP settings and authenticate via mTLS certificates.+<Steps><Step title="Navigate to Your KMS Project">- Now that the KMIP server is running, you need to register KMIP clients that will connect to it.-Navigate to the desired KMS project if you already have one or create a new project of type KMS, then select **KMIP** once inside the project, and click **Add KMIP Client**.-+</Step>@@ -138,7 +208,7 @@ Follow these steps in order to set up KMIP integration with Infisical:Define the client and its permissions.In the modal, provide the details of your client. The selected permissions determine what KMIP operations (Create, Get, Revoke, etc.) can be performed in your KMS project.-+This creates a KMIP client entity in Infisical that will be authenticated via mTLS certificates.@@ -148,15 +218,15 @@ Follow these steps in order to set up KMIP integration with Infisical:Each KMIP client needs its own certificate for mTLS authentication.Click **Generate Certificate** for your newly created client.-+Provide the desired TTL (time-to-live) and key algorithm, then click **Generate Client Certificate**.-+Download the generated client certificate, certificate chain, and private key.-+Configure your KMIP-compatible applications or tools to use these credentials when connecting to the KMIP server. The client will now authenticate via mTLS and perform authorized key management operations through the KMIP server, which proxies requests to Infisical KMS.@@ -179,7 +249,7 @@ While exact configuration steps vary by application, you'll generally need to pr### General Configuration Steps<Steps><Step title="Identify Your KMIP Server Endpoint">- Determine the address where your KMIP server is accessible. This should match one of the hostnames or IPs you specified when starting the KMIP server with the `--hostnames-or-ips` flag.+ Determine the address where your KMIP server is accessible. This should match one of the hostnames or IPs you passed via `--hostnames-or-ips` when deploying the server.**Example endpoints:**- `my-kmip-server.com:5696`@@ -245,6 +315,6 @@ While exact configuration steps vary by application, you'll generally need to prThis command attempts to establish a TLS connection to the KMIP server using your client certificate and key, displaying detailed information about the handshake process.If the connection is successful, you'll see the server's certificate chain and a message indicating that the handshake was completed.-+</Step></Steps>diff --git a/docs/internals/permissions/organization-permissions.mdx b/docs/internals/permissions/organization-permissions.mdxindex 92740cb9aa..81e4c905f5 100644--- a/docs/internals/permissions/organization-permissions.mdx+++ b/docs/internals/permissions/organization-permissions.mdx@@ -216,11 +216,15 @@ Supports conditions and permission inversion| `edit` | Modify KMS settings || `delete` | Remove KMS configurations |-#### Subject: `kmip`--| Action | Description |-| ------- | ---------------------------------- |-| `proxy` | Act as a proxy for KMIP operations |+#### Subject: `kmip-server`++| Action | Description |+| --------------------------- | ------------------------------------------------------- |+| `list-kmip-servers` | View organization KMIP servers |+| `create-kmip-servers` | Create new KMIP servers |+| `edit-kmip-servers` | Modify KMIP server settings and authentication |+| `delete-kmip-servers` | Remove KMIP servers from the organization |+| `revoke-kmip-server-access` | Revoke a KMIP server's access and invalidate its tokens |### Honey Tokensdiff --git a/frontend/src/const/routes.ts b/frontend/src/const/routes.tsindex f5d0dd417f..a1916f6aa1 100644--- a/frontend/src/const/routes.ts+++ b/frontend/src/const/routes.ts@@ -80,6 +80,10 @@ export const ROUTE_PATHS = Object.freeze({RelayDetailsByIDPage: setRoute("/organizations/$orgId/networking/relays/$relayId","/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking/relays/$relayId"+ ),+ KmipServerDetailsByIDPage: setRoute(+ "/organizations/$orgId/projects/kms/kmip-servers/$kmipServerId",+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/kmip-servers/$kmipServerId")},SecretManager: {diff --git a/frontend/src/context/OrgPermissionContext/types.ts b/frontend/src/context/OrgPermissionContext/types.tsindex 6632e59cee..d6b2924a56 100644--- a/frontend/src/context/OrgPermissionContext/types.ts+++ b/frontend/src/context/OrgPermissionContext/types.ts@@ -46,6 +46,14 @@ export enum OrgRelayPermissionActions {RevokeRelayAccess = "revoke-relay-access"}+export enum OrgKmipServerPermissionActions {+ CreateKmipServers = "create-kmip-servers",+ ListKmipServers = "list-kmip-servers",+ EditKmipServers = "edit-kmip-servers",+ DeleteKmipServers = "delete-kmip-servers",+ RevokeKmipServerAccess = "revoke-kmip-server-access"+}+export enum OrgPermissionMachineIdentityAuthTemplateActions {ListTemplates = "list-templates",CreateTemplates = "create-templates",@@ -75,6 +83,7 @@ export enum OrgPermissionSubjects {ProjectTemplates = "project-templates",AppConnections = "app-connections",Kmip = "kmip",+ KmipServer = "kmip-server",Gateway = "gateway",GatewayPool = "gateway-pool",Relay = "relay",@@ -191,6 +200,7 @@ export type OrgPermissionSet =| [OrgPermissionActions, OrgPermissionSubjects.ProjectTemplates]| [OrgPermissionIdentityActions, OrgPermissionSubjects.Identity]| [OrgPermissionKmipActions, OrgPermissionSubjects.Kmip]+ | [OrgKmipServerPermissionActions, OrgPermissionSubjects.KmipServer]| [OrgPermissionMachineIdentityAuthTemplateActions,OrgPermissionSubjects.MachineIdentityAuthTemplatediff --git a/frontend/src/hooks/api/auditLogs/constants.tsx b/frontend/src/hooks/api/auditLogs/constants.tsxindex b969caba01..76f76efa57 100644--- a/frontend/src/hooks/api/auditLogs/constants.tsx+++ b/frontend/src/hooks/api/auditLogs/constants.tsx@@ -449,7 +449,10 @@ export const eventToNameMap: { [K in EventType]: string } = {[EventType.RELAY_CREATE]: "Create relay",[EventType.RELAY_UPDATE]: "Update relay",[EventType.RELAY_DELETE]: "Delete relay",- [EventType.RELAY_ENROLLMENT_TOKEN_CREATE]: "Generate relay enrollment token"+ [EventType.RELAY_ENROLLMENT_TOKEN_CREATE]: "Generate relay enrollment token",+ [EventType.KMIP_SERVER_CREATE]: "Create KMIP server",+ [EventType.KMIP_SERVER_DELETE]: "Delete KMIP server",+ [EventType.KMIP_SERVER_ENROLLMENT_TOKEN_CREATE]: "Generate KMIP server enrollment token"};export const userAgentTypeToNameMap: { [K in UserAgentType]: string } = {diff --git a/frontend/src/hooks/api/auditLogs/enums.tsx b/frontend/src/hooks/api/auditLogs/enums.tsxindex 49dcd625d0..9554f2cacf 100644--- a/frontend/src/hooks/api/auditLogs/enums.tsx+++ b/frontend/src/hooks/api/auditLogs/enums.tsx@@ -445,5 +445,8 @@ export enum EventType {RELAY_CREATE = "relay-create",RELAY_UPDATE = "relay-update",RELAY_DELETE = "relay-delete",- RELAY_ENROLLMENT_TOKEN_CREATE = "relay-enrollment-token-create"+ RELAY_ENROLLMENT_TOKEN_CREATE = "relay-enrollment-token-create",+ KMIP_SERVER_CREATE = "kmip-server-create",+ KMIP_SERVER_DELETE = "kmip-server-delete",+ KMIP_SERVER_ENROLLMENT_TOKEN_CREATE = "kmip-server-enrollment-token-create"}diff --git a/frontend/src/hooks/api/index.tsx b/frontend/src/hooks/api/index.tsxindex 135483edb7..65c43b454a 100644--- a/frontend/src/hooks/api/index.tsx+++ b/frontend/src/hooks/api/index.tsx@@ -32,6 +32,7 @@ export * from "./identityProjectAdditionalPrivilege";export * from "./incidentContacts";export * from "./integrationAuth";export * from "./integrations";+export * from "./kmipServers";export * from "./kms";export * from "./ldapConfig";export * from "./mfaSession";diff --git a/frontend/src/hooks/api/kmipServers/index.tsx b/frontend/src/hooks/api/kmipServers/index.tsxnew file mode 100644index 0000000000..177955438b--- /dev/null+++ b/frontend/src/hooks/api/kmipServers/index.tsx@@ -0,0 +1,3 @@+export * from "./mutations";+export * from "./queries";+export * from "./types";diff --git a/frontend/src/hooks/api/kmipServers/mutations.tsx b/frontend/src/hooks/api/kmipServers/mutations.tsxnew file mode 100644index 0000000000..03f6ddc2b0--- /dev/null+++ b/frontend/src/hooks/api/kmipServers/mutations.tsx@@ -0,0 +1,87 @@+import { useMutation, useQueryClient } from "@tanstack/react-query";++import { apiRequest } from "@app/config/request";++import { kmipServerQueryKeys } from "./queries";+import {+ TCreateKmipServerDTO,+ TGenerateKmipServerEnrollmentTokenDTO,+ TKmipServerWithAuthMethod,+ TRevokeKmipServerAccessDTO,+ TUpdateKmipServerDTO+} from "./types";++export const useDeleteKmipServerById = () => {+ const queryClient = useQueryClient();+ return useMutation({+ mutationFn: (kmipServerId: string) => {+ return apiRequest.delete(`/api/v1/kmip-servers/${kmipServerId}`);+ },+ onSuccess: () => {+ queryClient.invalidateQueries({ queryKey: kmipServerQueryKeys.list() });+ }+ });+};++export const useCreateKmipServer = () => {+ const queryClient = useQueryClient();+ return useMutation({+ mutationFn: async (dto: TCreateKmipServerDTO) => {+ const { data } = await apiRequest.post<TKmipServerWithAuthMethod>(+ "/api/v1/kmip-servers",+ dto+ );+ return data;+ },+ onSuccess: () => {+ queryClient.invalidateQueries({ queryKey: kmipServerQueryKeys.list() });+ }+ });+};++export const useUpdateKmipServer = () => {+ const queryClient = useQueryClient();+ return useMutation({+ mutationFn: async ({ kmipServerId, authMethod }: TUpdateKmipServerDTO) => {+ const body: Record<string, unknown> = {};+ if (authMethod !== undefined) body.authMethod = authMethod;++ const { data } = await apiRequest.patch<TKmipServerWithAuthMethod>(+ `/api/v1/kmip-servers/${kmipServerId}`,+ body+ );+ return data;+ },+ onSuccess: (_, { kmipServerId }) => {+ queryClient.invalidateQueries({ queryKey: kmipServerQueryKeys.byId(kmipServerId) });+ queryClient.invalidateQueries({ queryKey: kmipServerQueryKeys.list() });+ }+ });+};++export const useGenerateKmipServerEnrollmentToken = () => {+ return useMutation({+ mutationFn: async ({ kmipServerId }: TGenerateKmipServerEnrollmentTokenDTO) => {+ const { data } = await apiRequest.post<{ token: string; expiresAt: string }>(+ `/api/v1/kmip-servers/${kmipServerId}/token-auth/generate-enrollment-token`+ );+ return data;+ }+ });+};++export const useRevokeKmipServerAccess = () => {+ const queryClient = useQueryClient();+ return useMutation({+ mutationFn: async ({ kmipServerId }: TRevokeKmipServerAccessDTO) => {+ const { data } = await apiRequest.post<{ method: string; deletedTokenCount: number }>(+ `/api/v1/kmip-servers/${kmipServerId}/revoke`+ );+ return data;+ },+ onSuccess: (_, { kmipServerId }) => {+ queryClient.invalidateQueries({ queryKey: kmipServerQueryKeys.byId(kmipServerId) });+ queryClient.invalidateQueries({ queryKey: kmipServerQueryKeys.list() });+ }+ });+};diff --git a/frontend/src/hooks/api/kmipServers/queries.tsx b/frontend/src/hooks/api/kmipServers/queries.tsxnew file mode 100644index 0000000000..2593ce830d--- /dev/null+++ b/frontend/src/hooks/api/kmipServers/queries.tsx@@ -0,0 +1,39 @@+import { useQuery } from "@tanstack/react-query";++import { apiRequest } from "@app/config/request";++import { TKmipServer, TKmipServerWithAuthMethod } from "./types";++export const kmipServerQueryKeys = {+ list: () => ["kmip-servers"] as const,+ byId: (kmipServerId: string) => [{ kmipServerId }, "kmip-server"] as const+};++const fetchKmipServers = async (): Promise<TKmipServer[]> => {+ const { data } = await apiRequest.get<TKmipServer[]>("/api/v1/kmip-servers");+ return data;+};++const fetchKmipServerById = async (kmipServerId: string): Promise<TKmipServerWithAuthMethod> => {+ const { data } = await apiRequest.get<TKmipServerWithAuthMethod>(+ `/api/v1/kmip-servers/${kmipServerId}`+ );+ return data;+};++export const useGetKmipServers = () => {+ return useQuery({+ queryKey: kmipServerQueryKeys.list(),+ queryFn: fetchKmipServers+ });+};++export const useGetKmipServerById = (kmipServerId: string) => {+ return useQuery({+ queryKey: kmipServerQueryKeys.byId(kmipServerId),+ queryFn: () => fetchKmipServerById(kmipServerId),+ enabled: Boolean(kmipServerId),+ staleTime: 0,+ gcTime: 0+ });+};diff --git a/frontend/src/hooks/api/kmipServers/types.ts b/frontend/src/hooks/api/kmipServers/types.tsnew file mode 100644index 0000000000..b37c08ecce--- /dev/null+++ b/frontend/src/hooks/api/kmipServers/types.ts@@ -0,0 +1,70 @@+export type TKmipServerAuthMethodView =+ | {+ method: "aws";+ config: {+ id: string;+ stsEndpoint: string;+ allowedPrincipalArns: string;+ allowedAccountIds: string;+ createdAt: string;+ updatedAt: string;+ };+ }+ | {+ method: "token";+ config: Record<string, never>;+ }+ | {+ method: "identity";+ config: { identityId: string; identityName: string | null };+ };++export type TKmipServer = {+ id: string;+ createdAt: string;+ updatedAt: string;+ orgId: string;+ name: string;+ heartbeat: string | null;+};++export type TKmipServerWithAuthMethod = TKmipServer & {+ canRevoke: boolean;+ authMethod: TKmipServerAuthMethodView;+};++export type TDeleteKmipServerDTO = {+ kmipServerId: string;+};++export type TCreateKmipServerDTO = {+ name: string;+ authMethod:+ | {+ method: "aws";+ stsEndpoint: string;+ allowedPrincipalArns: string;+ allowedAccountIds: string;+ }+ | { method: "token" };+};++export type TUpdateKmipServerDTO = {+ kmipServerId: string;+ authMethod?:+ | {+ method: "aws";+ stsEndpoint: string;+ allowedPrincipalArns: string;+ allowedAccountIds: string;+ }+ | { method: "token" };+};++export type TGenerateKmipServerEnrollmentTokenDTO = {+ kmipServerId: string;+};++export type TRevokeKmipServerAccessDTO = {+ kmipServerId: string;+};diff --git a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/OrgSidebar.tsx b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/OrgSidebar.tsxindex 6e49d33632..330481c97d 100644--- a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/OrgSidebar.tsx+++ b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/OrgSidebar.tsx@@ -1,4 +1,4 @@-import { useParams } from "@tanstack/react-router";+import { useLocation, useParams } from "@tanstack/react-router";import { Sidebar, SidebarContent, SidebarFooter, SidebarTrigger } from "@app/components/v3";import { useOrganization } from "@app/context";@@ -18,8 +18,12 @@ export const OrgSidebar = () => {type: (el as { type?: string })?.type})});+ const { pathname } = useLocation();const isInsideProject = Boolean(projectId);- const projectType = typeSlug ? urlSlugToProjectType(typeSlug) : null;+ // The org-wide KMIP servers pages live at a literal /projects/<type>/kmip-servers path with no+ // $type route param, so fall back to parsing the product slug from the pathname.+ const effectiveTypeSlug = typeSlug ?? pathname.match(/\/projects\/([^/]+)\/kmip-servers/)?.[1];+ const projectType = effectiveTypeSlug ? urlSlugToProjectType(effectiveTypeSlug) : null;const isOnProjectTypeListing =!isInsideProject && Boolean(projectType) && hasIntermediateProjectsView(projectType!);const { isSubOrganization } = useOrganization();diff --git a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/ProjectTypeNav.tsx b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/ProjectTypeNav.tsxindex a8a7529f08..fc0a9fa702 100644--- a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/ProjectTypeNav.tsx+++ b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/ProjectTypeNav.tsx@@ -1,5 +1,5 @@-import { Link, useParams } from "@tanstack/react-router";-import { ChevronLeft } from "lucide-react";+import { Link, useLocation, useParams } from "@tanstack/react-router";+import { ChevronLeft, Server } from "lucide-react";import {ProjectIcon,@@ -10,15 +10,23 @@ import {SidebarMenuItem} from "@app/components/v3";import { useOrganization } from "@app/context";+import { ProjectType } from "@app/hooks/api/projects/types";export const ProjectTypeNav = () => {- const { type: typeSlug, orgId } = useParams({ strict: false }) as {+ const { type: paramTypeSlug, orgId } = useParams({ strict: false }) as {type?: string;orgId?: string;};+ const { pathname } = useLocation();const { currentOrg } = useOrganization();const resolvedOrgId = orgId ?? currentOrg.id;+ // KMIP servers live at a literal /projects/kms/kmip-servers path (no $type param), so fall+ // back to parsing the product slug out of the pathname when the route param is absent.+ const typeSlug = paramTypeSlug ?? pathname.match(/\/projects\/([^/]+)\/kmip-servers/)?.[1];+ const isKms = typeSlug === ProjectType.KMS;+ const isOnKmipServers = pathname.includes("/kmip-servers");+return (<SidebarGroup><SidebarGroupLabel asChild>@@ -33,7 +41,13 @@ export const ProjectTypeNav = () => {</SidebarGroupLabel><SidebarMenu><SidebarMenuItem>- <SidebarMenuButton size="lg" scope="project" asChild isActive tooltip="Projects">+ <SidebarMenuButton+ size="lg"+ scope="project"+ asChild+ isActive={!isOnKmipServers}+ tooltip="Projects"+ ><Linkto="/organizations/$orgId/projects/$type"params={{ orgId: resolvedOrgId, type: typeSlug ?? "" }}@@ -43,6 +57,25 @@ export const ProjectTypeNav = () => {</Link></SidebarMenuButton></SidebarMenuItem>+ {isKms && (+ <SidebarMenuItem>+ <SidebarMenuButton+ size="lg"+ scope="project"+ asChild+ isActive={isOnKmipServers}+ tooltip="KMIP Servers"+ >+ <Link+ to="/organizations/$orgId/projects/kms/kmip-servers"+ params={{ orgId: resolvedOrgId }}+ >+ <Server className="size-4" />+ <span>KMIP Servers</span>+ </Link>+ </SidebarMenuButton>+ </SidebarMenuItem>+ )}</SidebarMenu></SidebarGroup>);diff --git a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/submenus.ts b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/submenus.tsindex 48ab071b70..d435dc9764 100644--- a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/submenus.ts+++ b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/submenus.ts@@ -181,8 +181,8 @@ export const NETWORKING_SUBMENU: Submenu = {pathSuffix: "networking",defaultTab: "gateways",items: [- { label: "Gateways", icon: DoorOpen, tab: "gateways" },- { label: "Relays", icon: Route, tab: "relays" }+ { label: "Gateways", icon: DoorOpen, tab: "gateways", activeMatch: /\/networking\/gateways\// },+ { label: "Relays", icon: Route, tab: "relays", activeMatch: /\/networking\/relays\// }]};diff --git a/frontend/src/pages/organization/KmipServersPage/KmipServerDetailsByIDPage/KmipServerDetailsByIDPage.tsx b/frontend/src/pages/organization/KmipServersPage/KmipServerDetailsByIDPage/KmipServerDetailsByIDPage.tsxnew file mode 100644index 0000000000..487af21c0e--- /dev/null+++ b/frontend/src/pages/organization/KmipServersPage/KmipServerDetailsByIDPage/KmipServerDetailsByIDPage.tsx@@ -0,0 +1,83 @@+import { Helmet } from "react-helmet";+import { useTranslation } from "react-i18next";+import { Link, useParams } from "@tanstack/react-router";+import { ChevronLeftIcon } from "lucide-react";++import { OrgPermissionCan } from "@app/components/permissions";+import { EmptyState } from "@app/components/v2";+import { PageLoader } from "@app/components/v3";+import { ROUTE_PATHS } from "@app/const/routes";+import { useOrganization } from "@app/context";+import {+ OrgKmipServerPermissionActions,+ OrgPermissionSubjects+} from "@app/context/OrgPermissionContext/types";+import { useGetKmipServerById } from "@app/hooks/api/kmipServers";++import { KmipServerClientsSection } from "./components/KmipServerClientsSection/KmipServerClientsSection";+import { KmipServerDeploySection } from "./components/KmipServerDeploySection/KmipServerDeploySection";+import { KmipServerDetailsCard } from "./components/KmipServerDetailsCard/KmipServerDetailsCard";+import { KmipServerPageHeader } from "./components/KmipServerPageHeader/KmipServerPageHeader";++const Page = () => {+ const params = useParams({ from: ROUTE_PATHS.Organization.KmipServerDetailsByIDPage.id });+ const kmipServerId = params.kmipServerId as string;+ const { currentOrg } = useOrganization();+ const orgId = currentOrg?.id || "";+ const { data: kmipServer, isPending } = useGetKmipServerById(kmipServerId);++ if (isPending) {+ return <PageLoader />;+ }++ if (!kmipServer) {+ return <EmptyState title="KMIP server not found" />;+ }++ return (+ <div className="mx-auto flex max-w-8xl flex-col">+ <Link+ to="/organizations/$orgId/projects/kms/kmip-servers"+ params={{ orgId }}+ className="mb-4 flex w-fit items-center gap-x-1 text-sm text-mineshaft-400 transition hover:text-mineshaft-400/80"+ >+ <ChevronLeftIcon size={16} />+ KMIP Servers+ </Link>+ <KmipServerPageHeader kmipServer={kmipServer} orgId={orgId} />+ <div className="flex flex-col gap-5 lg:flex-row">+ <div className="flex w-full flex-col gap-y-5 lg:max-w-[24rem]">+ <KmipServerDetailsCard kmipServer={kmipServer} />+ </div>+ <div className="flex flex-1 flex-col gap-y-5">+ <KmipServerDeploySection+ kmipServerId={kmipServerId}+ kmipServerName={kmipServer.name}+ authMethod={kmipServer.authMethod}+ isFirstTimeSetup={!kmipServer.heartbeat}+ />+ <KmipServerClientsSection />+ </div>+ </div>+ </div>+ );+};++export const KmipServerDetailsByIDPage = () => {+ const { t } = useTranslation();+ return (+ <>+ <Helmet>+ <title>{t("common.head-title", { title: t("settings.org.title") })}</title>+ <link rel="icon" href="/infisical.ico" />+ </Helmet>+ <OrgPermissionCan+ passThrough={false}+ I={OrgKmipServerPermissionActions.ListKmipServers}+ a={OrgPermissionSubjects.KmipServer}+ >+ <Page />+ </OrgPermissionCan>+ </>+ );+};diff --git a/frontend/src/pages/organization/KmipServersPage/KmipServerDetailsByIDPage/components/KmipServerAuthMethod/KmipServerAuthMethodModal.tsx b/frontend/src/pages/organization/KmipServersPage/KmipServerDetailsByIDPage/components/KmipServerAuthMethod/KmipServerAuthMethodModal.tsxnew file mode 100644index 0000000000..34e98d24ef--- /dev/null+++ b/frontend/src/pages/organization/KmipServersPage/KmipServerDetailsByIDPage/components/KmipServerAuthMethod/KmipServerAuthMethodModal.tsx@@ -0,0 +1,240 @@+import { useEffect } from "react";+import { Controller, useForm } from "react-hook-form";+import { zodResolver } from "@hookform/resolvers/zod";+import { z } from "zod";++import { createNotification } from "@app/components/notifications";+import {+ Button,+ Dialog,+ DialogContent,+ DialogDescription,+ DialogFooter,+ DialogHeader,+ DialogTitle,+ Field,+ FieldContent,+ FieldError,+ FieldLabel,+ FilterableSelect,+ Input+} from "@app/components/v3";+import { useOrganization } from "@app/context";+import { useUpdateKmipServer } from "@app/hooks/api/kmipServers";+import { TKmipServerAuthMethodView } from "@app/hooks/api/kmipServers/types";++type SettableMethod = "aws" | "token";++const METHOD_OPTIONS: { value: SettableMethod; label: string }[] = [+ { value: "token", label: "Token Auth" },+ { value: "aws", label: "AWS Auth" }+];++const schema = z+ .object({+ method: z.enum(["aws", "token"]),+ stsEndpoint: z.string(),+ allowedPrincipalArns: z.string(),+ allowedAccountIds: z.string()+ })+ .superRefine((data, ctx) => {+ if (data.method === "aws") {+ const hasArns = data.allowedPrincipalArns.trim().length > 0;+ const hasAccountIds = data.allowedAccountIds.trim().length > 0;+ if (!hasArns && !hasAccountIds) {+ const message = "At least one of allowed principal ARNs or allowed account IDs must be set";+ ctx.addIssue({+ code: z.ZodIssueCode.custom,+ path: ["allowedPrincipalArns"],+ message+ });+ ctx.addIssue({+ code: z.ZodIssueCode.custom,+ path: ["allowedAccountIds"],+ message+ });+ }+ }+ });++type FormData = z.infer<typeof schema>;++type Props = {+ isOpen: boolean;+ onOpenChange: (isOpen: boolean) => void;+ kmipServerId: string;+ currentMethod: TKmipServerAuthMethodView;+};++export const KmipServerAuthMethodModal = ({+ isOpen,+ onOpenChange,+ kmipServerId,+ currentMethod+}: Props) => {+ const { mutateAsync: updateKmipServer, isPending } = useUpdateKmipServer();+ const { isSubOrganization } = useOrganization();++ const initialMethod: SettableMethod = currentMethod.method === "aws" ? "aws" : "token";+ const initialAws = currentMethod.method === "aws" ? currentMethod.config : null;++ const {+ control,+ handleSubmit,+ watch,+ reset,+ formState: { isSubmitting, isDirty }+ } = useForm<FormData>({+ resolver: zodResolver(schema),+ defaultValues: {+ method: initialMethod,+ stsEndpoint: initialAws?.stsEndpoint ?? "https://sts.amazonaws.com/",+ allowedPrincipalArns: initialAws?.allowedPrincipalArns ?? "",+ allowedAccountIds: initialAws?.allowedAccountIds ?? ""+ }+ });++ useEffect(() => {+ if (isOpen) {+ reset({+ method: initialMethod,+ stsEndpoint: initialAws?.stsEndpoint ?? "https://sts.amazonaws.com/",+ allowedPrincipalArns: initialAws?.allowedPrincipalArns ?? "",+ allowedAccountIds: initialAws?.allowedAccountIds ?? ""+ });+ }+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [isOpen]);++ const method = watch("method");++ const onSubmit = async (form: FormData) => {+ try {+ if (form.method === "aws") {+ await updateKmipServer({+ kmipServerId,+ authMethod: {+ method: "aws",+ stsEndpoint: form.stsEndpoint,+ allowedPrincipalArns: form.allowedPrincipalArns,+ allowedAccountIds: form.allowedAccountIds+ }+ });+ } else {+ await updateKmipServer({ kmipServerId, authMethod: { method: "token" } });+ }+ createNotification({ type: "success", text: "Auth method updated" });+ onOpenChange(false);+ } catch {+ createNotification({ type: "error", text: "Failed to update auth method" });+ }+ };++ return (+ <Dialog open={isOpen} onOpenChange={onOpenChange}>+ <DialogContent className="max-w-lg overflow-visible">+ <DialogHeader>+ <DialogTitle>Edit Auth Method</DialogTitle>+ <DialogDescription>+ Switch the KMIP server's auth method or update the current method's config.+ </DialogDescription>+ </DialogHeader>+ <form onSubmit={handleSubmit(onSubmit)} className="space-y-4">+ <Controller+ control={control}+ name="method"+ render={({ field }) => {+ const selected =+ METHOD_OPTIONS.find((o) => o.value === field.value) ?? METHOD_OPTIONS[0];+ return (+ <Field>+ <FieldLabel>Method</FieldLabel>+ <FieldContent>+ <FilterableSelect+ value={selected}+ onChange={(opt) => {+ const next = opt as { value: SettableMethod } | null;+ if (next) field.onChange(next.value);+ }}+ options={METHOD_OPTIONS}+ isSearchable={false}+ isClearable={false}+ getOptionLabel={(o) => o.label}+ getOptionValue={(o) => o.value}+ />+ </FieldContent>+ </Field>+ );+ }}+ />++ {method === "aws" && (+ <>+ <Controller+ control={control}+ name="allowedPrincipalArns"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel>Allowed Principal ARNs</FieldLabel>+ <FieldContent>+ <Input+ {...field}+ isError={Boolean(error)}+ placeholder="arn:aws:iam::123456789012:role/MyRoleName, arn:aws:iam::123456789012:user/MyUserName..."+ />+ <FieldError errors={[error]} />+ </FieldContent>+ </Field>+ )}+ />+ <Controller+ control={control}+ name="allowedAccountIds"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel>Allowed Account IDs</FieldLabel>+ <FieldContent>+ <Input {...field} isError={Boolean(error)} placeholder="123456789012, ..." />+ <FieldError errors={[error]} />+ </FieldContent>+ </Field>+ )}+ />+ <Controller+ control={control}+ name="stsEndpoint"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel>STS Endpoint</FieldLabel>+ <FieldContent>+ <Input+ {...field}+ isError={Boolean(error)}+ placeholder="https://sts.amazonaws.com/"+ />+ <FieldError errors={[error]} />+ </FieldContent>+ </Field>+ )}+ />+ </>+ )}++ <DialogFooter className="gap-2 sm:gap-2">+ <Button type="button" variant="ghost" onClick={() => onOpenChange(false)}>+ Cancel+ </Button>+ <Button+ type="submit"+ variant={isSubOrganization ? "sub-org" : "org"}+ isPending={isSubmitting || isPending}+ isDisabled={isSubmitting || isPending || !isDirty}+ >+ Update+ </Button>+ </DialogFooter>+ </form>+ </DialogContent>+ </Dialog>+ );+};diff --git a/frontend/src/pages/organization/KmipServersPage/KmipServerDetailsByIDPage/components/KmipServerClientsSection/KmipServerClientsSection.tsx b/frontend/src/pages/organization/KmipServersPage/KmipServerDetailsByIDPage/components/KmipServerClientsSection/KmipServerClientsSection.tsxnew file mode 100644index 0000000000..475b99773e--- /dev/null+++ b/frontend/src/pages/organization/KmipServersPage/KmipServerDetailsByIDPage/components/KmipServerClientsSection/KmipServerClientsSection.tsx@@ -0,0 +1,48 @@+import { ArrowUpRightIcon, BookOpenIcon } from "lucide-react";++import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@app/components/v3";++const STEPS = [+ "Deploy this KMIP server on a target host (see Deployment above).",+ "Create a KMIP client in a KMS project's KMIP settings.",+ "Generate a client certificate for that client.",+ "Point your KMIP application at the server address using the client certificate."+];++export const KmipServerClientsSection = () => {+ return (+ <Card className="w-full">+ <CardHeader>+ <CardTitle>Connecting KMIP Clients</CardTitle>+ <CardDescription>+ KMIP clients authenticate to this server with a client certificate to run key operations.+ Clients are managed per-project from a KMS project's KMIP settings.+ </CardDescription>+ </CardHeader>+ <CardContent>+ <ol className="flex flex-col gap-y-3">+ {STEPS.map((step, idx) => (+ <li key={step} className="flex items-start gap-x-3 text-sm text-mineshaft-300">+ <span className="flex size-5 shrink-0 items-center justify-center rounded-full bg-mineshaft-600 text-xs font-medium text-mineshaft-200">+ {idx + 1}+ </span>+ <span>{step}</span>+ </li>+ ))}+ </ol>+ <div className="mt-5 flex flex-wrap items-center gap-x-6 gap-y-2">+ <a+ href="https://infisical.com/docs/documentation/platform/kms/kmip"+ target="_blank"+ rel="noreferrer"+ className="flex items-center gap-x-2 text-sm text-mineshaft-300 transition-colors hover:text-mineshaft-100"+ >+ <BookOpenIcon className="size-4" />+ View docs+ <ArrowUpRightIcon className="size-3" />+ </a>+ </div>+ </CardContent>+ </Card>+ );+};diff --git a/frontend/src/pages/organization/KmipServersPage/KmipServerDetailsByIDPage/components/KmipServerDeploySection/KmipServerDeployCommandDialog.tsx b/frontend/src/pages/organization/KmipServersPage/KmipServerDetailsByIDPage/components/KmipServerDeploySection/KmipServerDeployCommandDialog.tsxnew file mode 100644index 0000000000..34523039c7--- /dev/null+++ b/frontend/src/pages/organization/KmipServersPage/KmipServerDetailsByIDPage/components/KmipServerDeploySection/KmipServerDeployCommandDialog.tsx@@ -0,0 +1,155 @@+import { useMemo } from "react";+import { faCopy, faUpRightFromSquare } from "@fortawesome/free-solid-svg-icons";+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";++import { createNotification } from "@app/components/notifications";+import {+ Button,+ FormLabel,+ IconButton,+ Input,+ Modal,+ ModalClose,+ ModalContent,+ Tab,+ TabList,+ TabPanel,+ Tabs+} from "@app/components/v2";+import { Badge } from "@app/components/v3/generic/Badge";++type Props = {+ isOpen: boolean;+ onOpenChange: (isOpen: boolean) => void;+ kmipServerId: string;+ kmipServerName: string;+ authMethod: "token" | "aws";+ enrollmentToken: string | null;+};++export const KmipServerDeployCommandDialog = ({+ isOpen,+ onOpenChange,+ kmipServerId,+ kmipServerName,+ authMethod,+ enrollmentToken+}: Props) => {+ const { protocol, hostname, port } = window.location;+ const portSuffix = port && port !== "80" ? `:${port}` : "";+ const siteURL = `${protocol}//${hostname}${portSuffix}`;++ const cliCommand = useMemo(() => {+ const common = `--hostnames-or-ips=<hostnames-or-ips> --server-name=${kmipServerName} --domain=${siteURL}`;+ if (authMethod === "aws") {+ return `infisical kmip start --enroll-method=aws --kmip-server-id=${kmipServerId} ${common}`;+ }+ return `infisical kmip start --enroll-method=token --token=${enrollmentToken} ${common}`;+ }, [kmipServerName, kmipServerId, enrollmentToken, authMethod, siteURL]);++ const systemdInstallCommand = useMemo(() => {+ const common = `--hostnames-or-ips=<hostnames-or-ips> --server-name=${kmipServerName} --domain=${siteURL}`;+ if (authMethod === "aws") {+ return `sudo infisical kmip systemd install --enroll-method=aws --kmip-server-id=${kmipServerId} ${common}`;+ }+ return `sudo infisical kmip systemd install --enroll-method=token --token=${enrollmentToken} ${common}`;+ }, [kmipServerName, kmipServerId, enrollmentToken, authMethod, siteURL]);++ const startServiceCommand = "sudo systemctl start infisical-kmip";++ const copy = (text: string, label: string) => {+ navigator.clipboard.writeText(text);+ createNotification({ type: "info", text: `${label} copied to clipboard` });+ };++ const badgeLabel = authMethod === "aws" ? "AWS Auth" : "Token Auth";+ const baseHelperText =+ authMethod === "aws"+ ? "The host must have AWS credentials whose principal matches your allowlist."+ : "The enrollment token expires in 1 hour and can only be used once.";+ const helperText = `${baseHelperText} Replace <hostnames-or-ips> with a comma-separated list of the hostnames or IPs that KMIP clients will use to reach this server.`;++ return (+ <Modal isOpen={isOpen} onOpenChange={onOpenChange}>+ <ModalContent+ className="max-w-2xl"+ title={`Deploy command for ${kmipServerName}`}+ subTitle="Run the following command on the machine where you want to deploy the KMIP server."+ bodyClassName="overflow-visible"+ >+ <div className="mb-4">+ <div className="mb-0.5 flex items-center gap-2">+ <FormLabel label="Auth Method" className="mb-0 text-foreground" />+ <Badge variant="info">{badgeLabel}</Badge>+ </div>+ <p className="mt-1 text-xs text-mineshaft-400">{helperText}</p>+ </div>++ <Tabs defaultValue="cli" className="mt-2">+ <TabList>+ <Tab value="cli">CLI</Tab>+ <Tab value="systemd">CLI (systemd)</Tab>+ </TabList>+ <TabPanel value="cli">+ <div className="flex gap-2">+ <Input value={cliCommand} isDisabled />+ <IconButton+ ariaLabel="copy"+ variant="outline_bg"+ colorSchema="secondary"+ onClick={() => copy(cliCommand, "Command")}+ className="w-10"+ >+ <FontAwesomeIcon icon={faCopy} />+ </IconButton>+ </div>+ </TabPanel>+ <TabPanel value="systemd">+ <FormLabel label="Installation Command" />+ <div className="flex gap-2">+ <Input value={systemdInstallCommand} isDisabled />+ <IconButton+ ariaLabel="copy install"+ variant="outline_bg"+ colorSchema="secondary"+ onClick={() => copy(systemdInstallCommand, "Installation command")}+ className="w-10"+ >+ <FontAwesomeIcon icon={faCopy} />+ </IconButton>+ </div>+ <FormLabel label="Start the KMIP Server Service" className="mt-4" />+ <div className="flex gap-2">+ <Input value={startServiceCommand} isDisabled />+ <IconButton+ ariaLabel="copy start"+ variant="outline_bg"+ colorSchema="secondary"+ onClick={() => copy(startServiceCommand, "Start command")}+ className="w-10"+ >+ <FontAwesomeIcon icon={faCopy} />+ </IconButton>+ </div>+ </TabPanel>+ </Tabs>+ <a+ href="https://infisical.com/docs/cli/overview"+ target="_blank"+ rel="noreferrer"+ className="mt-2 flex h-4 w-fit items-center gap-2 border-b border-mineshaft-400 text-sm text-mineshaft-400 transition-colors hover:border-yellow-400 hover:text-yellow-400"+ >+ <span>Install the Infisical CLI</span>+ <FontAwesomeIcon icon={faUpRightFromSquare} className="size-3" />+ </a>+ <div className="mt-6 flex items-center">+ <ModalClose asChild>+ <Button className="mr-4" size="sm" colorSchema="secondary">+ Done+ </Button>+ </ModalClose>+ </div>+ </ModalContent>+ </Modal>+ );+};diff --git a/frontend/src/pages/organization/KmipServersPage/KmipServerDetailsByIDPage/components/KmipServerDeploySection/KmipServerDeploySection.tsx b/frontend/src/pages/organization/KmipServersPage/KmipServerDetailsByIDPage/components/KmipServerDeploySection/KmipServerDeploySection.tsxnew file mode 100644index 0000000000..e2b726cb74--- /dev/null+++ b/frontend/src/pages/organization/KmipServersPage/KmipServerDetailsByIDPage/components/KmipServerDeploySection/KmipServerDeploySection.tsx@@ -0,0 +1,107 @@+import { useState } from "react";+import { RocketIcon } from "lucide-react";++import { createNotification } from "@app/components/notifications";+import { OrgPermissionCan } from "@app/components/permissions";+import {+ Button,+ Card,+ CardAction,+ CardDescription,+ CardHeader,+ CardTitle+} from "@app/components/v3";+import { useOrganization } from "@app/context";+import {+ OrgKmipServerPermissionActions,+ OrgPermissionSubjects+} from "@app/context/OrgPermissionContext/types";+import { useGenerateKmipServerEnrollmentToken } from "@app/hooks/api/kmipServers";+import { TKmipServerAuthMethodView } from "@app/hooks/api/kmipServers/types";++import { KmipServerDeployCommandDialog } from "./KmipServerDeployCommandDialog";++type Props = {+ kmipServerId: string;+ kmipServerName: string;+ authMethod: TKmipServerAuthMethodView;+ isFirstTimeSetup: boolean;+};++export const KmipServerDeploySection = ({+ kmipServerId,+ kmipServerName,+ authMethod,+ isFirstTimeSetup+}: Props) => {+ const { isSubOrganization } = useOrganization();+ const [showDialog, setShowDialog] = useState(false);+ const [enrollmentToken, setEnrollmentToken] = useState<string | null>(null);+ const { mutateAsync: mint, isPending: isMinting } = useGenerateKmipServerEnrollmentToken();++ if (authMethod.method === "identity") return null;++ const handleClick = async () => {+ if (authMethod.method === "token") {+ try {+ const result = await mint({ kmipServerId });+ setEnrollmentToken(result.token);+ setShowDialog(true);+ } catch {+ createNotification({ type: "error", text: "Failed to generate enrollment token" });+ }+ } else {+ setShowDialog(true);+ }+ };++ return (+ <>+ <Card className="w-full">+ <CardHeader>+ <CardTitle>Deployment</CardTitle>+ <CardDescription>Launch this KMIP server on a target host</CardDescription>+ <CardAction>+ <OrgPermissionCan+ I={OrgKmipServerPermissionActions.EditKmipServers}+ a={OrgPermissionSubjects.KmipServer}+ >+ {(isAllowed) => {+ let variant: "neutral" | "org" | "sub-org" = "neutral";+ if (isFirstTimeSetup) variant = isSubOrganization ? "sub-org" : "org";+ return (+ <Button+ variant={variant}+ size="sm"+ isPending={isMinting}+ isDisabled={!isAllowed || isMinting}+ onClick={handleClick}+ >+ <RocketIcon className="size-4" />+ Show deploy command+ </Button>+ );+ }}+ </OrgPermissionCan>+ </CardAction>+ </CardHeader>+ </Card>++ {showDialog && (+ <KmipServerDeployCommandDialog+ isOpen+ onOpenChange={(open) => {+ if (!open) {+ setShowDialog(false);+ setEnrollmentToken(null);+ }+ }}+ kmipServerId={kmipServerId}+ kmipServerName={kmipServerName}+ authMethod={authMethod.method as "token" | "aws"}+ enrollmentToken={enrollmentToken}+ />+ )}+ </>+ );+};diff --git a/frontend/src/pages/organization/KmipServersPage/KmipServerDetailsByIDPage/components/KmipServerDetailsCard/KmipServerDetailsCard.tsx b/frontend/src/pages/organization/KmipServersPage/KmipServerDetailsByIDPage/components/KmipServerDetailsCard/KmipServerDetailsCard.tsxnew file mode 100644index 0000000000..282a9dd53a--- /dev/null+++ b/frontend/src/pages/organization/KmipServersPage/KmipServerDetailsByIDPage/components/KmipServerDetailsCard/KmipServerDetailsCard.tsx@@ -0,0 +1,187 @@+import { useState } from "react";+import { Link } from "@tanstack/react-router";+import { format } from "date-fns";+import { CheckIcon, ClipboardListIcon, PencilIcon, TriangleAlertIcon } from "lucide-react";++import { OrgPermissionCan } from "@app/components/permissions";+import {+ Alert,+ AlertDescription,+ AlertTitle,+ Badge,+ Card,+ CardContent,+ CardHeader,+ CardTitle,+ Detail,+ DetailGroup,+ DetailGroupHeader,+ DetailLabel,+ DetailValue,+ IconButton,+ Separator+} from "@app/components/v3";+import { useOrganization } from "@app/context";+import {+ OrgKmipServerPermissionActions,+ OrgPermissionSubjects+} from "@app/context/OrgPermissionContext/types";+import { useTimedReset } from "@app/hooks";+import {+ TKmipServerAuthMethodView,+ TKmipServerWithAuthMethod+} from "@app/hooks/api/kmipServers/types";++import { KmipServerAuthMethodModal } from "../KmipServerAuthMethod/KmipServerAuthMethodModal";++const AuthMethodBadge = ({ method }: { method: TKmipServerAuthMethodView["method"] }) => {+ if (method === "aws") return <Badge variant="info">AWS Auth</Badge>;+ if (method === "token") return <Badge variant="info">Token Auth</Badge>;+ return <Badge variant="warning">Machine Identity</Badge>;+};++export const KmipServerDetailsCard = ({+ kmipServer+}: {+ kmipServer: TKmipServerWithAuthMethod;+}) => {+ const [, isCopyingId, setCopyTextId] = useTimedReset<string>({+ initialState: "Copy ID to clipboard"+ });+ const [authModalOpen, setAuthModalOpen] = useState(false);+ const { currentOrg } = useOrganization();+ const orgId = currentOrg?.id || "";++ const { authMethod } = kmipServer;+ const isIdentityServer = authMethod.method === "identity";++ return (+ <>+ <Card className="w-full">+ <CardHeader className="border-b">+ <CardTitle>Details</CardTitle>+ </CardHeader>+ <CardContent>+ <DetailGroup>+ <DetailGroupHeader>General</DetailGroupHeader>+ <Detail>+ <DetailLabel>ID</DetailLabel>+ <DetailValue className="flex items-center gap-x-1">+ <span className="font-mono text-xs">{kmipServer.id}</span>+ <IconButton+ aria-label="copy kmip server id"+ onClick={() => {+ navigator.clipboard.writeText(kmipServer.id);+ setCopyTextId("Copied");+ }}+ variant="ghost"+ size="xs"+ >+ {isCopyingId ? <CheckIcon /> : <ClipboardListIcon className="text-label" />}+ </IconButton>+ </DetailValue>+ </Detail>+ <Detail>+ <DetailLabel>Name</DetailLabel>+ <DetailValue>{kmipServer.name}</DetailValue>+ </Detail>+ <Detail>+ <DetailLabel>Created</DetailLabel>+ <DetailValue>{format(new Date(kmipServer.createdAt), "PPpp")}</DetailValue>+ </Detail>+ </DetailGroup>+ <Separator className="my-4" />+ <DetailGroup>+ <DetailGroupHeader className="flex items-center justify-between">+ Authentication+ {!isIdentityServer && (+ <OrgPermissionCan+ I={OrgKmipServerPermissionActions.EditKmipServers}+ a={OrgPermissionSubjects.KmipServer}+ >+ {(isAllowed) => (+ <IconButton+ size="xs"+ variant="ghost-muted"+ aria-label="edit auth method"+ isDisabled={!isAllowed}+ onClick={() => setAuthModalOpen(true)}+ >+ <PencilIcon />+ </IconButton>+ )}+ </OrgPermissionCan>+ )}+ </DetailGroupHeader>+ {isIdentityServer && (+ <Alert variant="warning">+ <TriangleAlertIcon />+ <AlertTitle>Authenticated via Machine Identity (Legacy)</AlertTitle>+ <AlertDescription>+ <p>+ This KMIP server is still using machine identity. We recommend creating a new+ KMIP server.+ </p>+ <Link+ to="/organizations/$orgId/projects/kms/kmip-servers"+ params={{ orgId }}+ className="underline underline-offset-4"+ >+ Create a new KMIP server+ </Link>+ </AlertDescription>+ </Alert>+ )}+ {!isIdentityServer && (+ <Detail>+ <DetailLabel>Method</DetailLabel>+ <DetailValue>+ <AuthMethodBadge method={authMethod.method} />+ </DetailValue>+ </Detail>+ )}+ {authMethod.method === "aws" && (+ <>+ <Detail>+ <DetailLabel>STS Endpoint</DetailLabel>+ <DetailValue>{authMethod.config.stsEndpoint}</DetailValue>+ </Detail>+ <Detail>+ <DetailLabel>Allowed Principal ARNs</DetailLabel>+ <DetailValue>+ {authMethod.config.allowedPrincipalArns || (+ <span className="text-muted">—</span>+ )}+ </DetailValue>+ </Detail>+ <Detail>+ <DetailLabel>Allowed Account IDs</DetailLabel>+ <DetailValue>+ {authMethod.config.allowedAccountIds || (+ <span className="text-muted">—</span>+ )}+ </DetailValue>+ </Detail>+ </>+ )}+ {authMethod.method === "identity" && authMethod.config.identityName && (+ <Detail>+ <DetailLabel>Machine Identity</DetailLabel>+ <DetailValue>{authMethod.config.identityName}</DetailValue>+ </Detail>+ )}+ </DetailGroup>+ </CardContent>+ </Card>++ {!isIdentityServer && (+ <KmipServerAuthMethodModal+ isOpen={authModalOpen}+ onOpenChange={setAuthModalOpen}+ kmipServerId={kmipServer.id}+ currentMethod={authMethod}+ />+ )}+ </>+ );+};diff --git a/frontend/src/pages/organization/KmipServersPage/KmipServerDetailsByIDPage/components/KmipServerPageHeader/KmipServerPageHeader.tsx b/frontend/src/pages/organization/KmipServersPage/KmipServerDetailsByIDPage/components/KmipServerPageHeader/KmipServerPageHeader.tsxnew file mode 100644index 0000000000..a3c9750816--- /dev/null+++ b/frontend/src/pages/organization/KmipServersPage/KmipServerDetailsByIDPage/components/KmipServerPageHeader/KmipServerPageHeader.tsx@@ -0,0 +1,136 @@+import { useNavigate } from "@tanstack/react-router";+import { BanIcon, CopyIcon, EllipsisIcon, TrashIcon } from "lucide-react";++import { createNotification } from "@app/components/notifications";+import { OrgPermissionCan } from "@app/components/permissions";+import { DeleteActionModal, PageHeader } from "@app/components/v2";+import {+ Button,+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuTrigger+} from "@app/components/v3";+import {+ OrgKmipServerPermissionActions,+ OrgPermissionSubjects+} from "@app/context/OrgPermissionContext/types";+import { usePopUp } from "@app/hooks";+import { useDeleteKmipServerById, useRevokeKmipServerAccess } from "@app/hooks/api/kmipServers";+import { TKmipServerWithAuthMethod } from "@app/hooks/api/kmipServers/types";++export const KmipServerPageHeader = ({+ kmipServer,+ orgId+}: {+ kmipServer: TKmipServerWithAuthMethod;+ orgId: string;+}) => {+ const navigate = useNavigate();+ const { mutateAsync: deleteKmipServer } = useDeleteKmipServerById();+ const { mutateAsync: revokeKmipServer } = useRevokeKmipServerAccess();+ const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp([+ "deleteKmipServer",+ "revokeKmipServer"+ ] as const);++ const onDelete = async () => {+ await deleteKmipServer(kmipServer.id);+ createNotification({ type: "success", text: "Successfully deleted KMIP server" });+ navigate({+ to: "/organizations/$orgId/projects/kms/kmip-servers",+ params: { orgId }+ });+ };++ const onRevoke = async () => {+ try {+ await revokeKmipServer({ kmipServerId: kmipServer.id });+ createNotification({ type: "success", text: "KMIP server access revoked" });+ handlePopUpToggle("revokeKmipServer", false);+ } catch {+ createNotification({ type: "error", text: "Failed to revoke KMIP server access" });+ }+ };++ const { canRevoke } = kmipServer;++ return (+ <>+ <PageHeader+ scope="org"+ title={kmipServer.name}+ description="KMIP server configuration and authentication"+ >+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <Button variant="outline">+ Options+ <EllipsisIcon />+ </Button>+ </DropdownMenuTrigger>+ <DropdownMenuContent align="end">+ <DropdownMenuItem+ onClick={() => {+ navigator.clipboard.writeText(kmipServer.id);+ createNotification({ type: "info", text: "KMIP server ID copied to clipboard" });+ }}+ >+ <CopyIcon />+ Copy KMIP Server ID+ </DropdownMenuItem>+ {canRevoke && (+ <OrgPermissionCan+ I={OrgKmipServerPermissionActions.RevokeKmipServerAccess}+ a={OrgPermissionSubjects.KmipServer}+ >+ {(isAllowed) => (+ <DropdownMenuItem+ variant="danger"+ isDisabled={!isAllowed}+ onClick={() => handlePopUpOpen("revokeKmipServer")}+ >+ <BanIcon />+ Revoke Access+ </DropdownMenuItem>+ )}+ </OrgPermissionCan>+ )}+ <OrgPermissionCan+ I={OrgKmipServerPermissionActions.DeleteKmipServers}+ a={OrgPermissionSubjects.KmipServer}+ >+ {(isAllowed) => (+ <DropdownMenuItem+ variant="danger"+ isDisabled={!isAllowed}+ onClick={() => handlePopUpOpen("deleteKmipServer")}+ >+ <TrashIcon />+ Delete KMIP Server+ </DropdownMenuItem>+ )}+ </OrgPermissionCan>+ </DropdownMenuContent>+ </DropdownMenu>+ </PageHeader>++ <DeleteActionModal+ isOpen={popUp.deleteKmipServer.isOpen}+ title={`Delete KMIP server "${kmipServer.name}"?`}+ onChange={(isOpen) => handlePopUpToggle("deleteKmipServer", isOpen)}+ deleteKey="confirm"+ onDeleteApproved={onDelete}+ />+ <DeleteActionModal+ isOpen={popUp.revokeKmipServer.isOpen}+ title={`Revoke access for KMIP server "${kmipServer.name}"?`}+ subTitle="The KMIP server will be disconnected and any active tokens will be invalidated. The server will need to re-authenticate to reconnect."+ onChange={(isOpen) => handlePopUpToggle("revokeKmipServer", isOpen)}+ deleteKey="confirm"+ buttonText="Revoke access"+ onDeleteApproved={onRevoke}+ />+ </>+ );+};diff --git a/frontend/src/pages/organization/KmipServersPage/KmipServerDetailsByIDPage/index.tsx b/frontend/src/pages/organization/KmipServersPage/KmipServerDetailsByIDPage/index.tsxnew file mode 100644index 0000000000..e69de29bb2diff --git a/frontend/src/pages/organization/KmipServersPage/KmipServerDetailsByIDPage/route.tsx b/frontend/src/pages/organization/KmipServersPage/KmipServerDetailsByIDPage/route.tsxnew file mode 100644index 0000000000..d38a3bdab1--- /dev/null+++ b/frontend/src/pages/organization/KmipServersPage/KmipServerDetailsByIDPage/route.tsx@@ -0,0 +1,20 @@+import { createFileRoute, linkOptions } from "@tanstack/react-router";++import { KmipServerDetailsByIDPage } from "./KmipServerDetailsByIDPage";++export const Route = createFileRoute(+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/kmip-servers/$kmipServerId"+)({+ component: KmipServerDetailsByIDPage,+ context: ({ params }) => ({+ breadcrumbs: [+ {+ label: "KMIP Servers",+ link: linkOptions({+ to: "/organizations/$orgId/projects/kms/kmip-servers" as const,+ params+ })+ }+ ]+ })+});diff --git a/frontend/src/pages/organization/KmipServersPage/KmipServersPage.tsx b/frontend/src/pages/organization/KmipServersPage/KmipServersPage.tsxnew file mode 100644index 0000000000..8e32131be2--- /dev/null+++ b/frontend/src/pages/organization/KmipServersPage/KmipServersPage.tsx@@ -0,0 +1,19 @@+import { Helmet } from "react-helmet";++import { KmipServerTab } from "./components";++export const KmipServersPage = () => {+ return (+ <>+ <Helmet>+ <title>Infisical | KMIP Servers</title>+ <meta property="og:image" content="/images/message.png" />+ </Helmet>+ <div className="flex w-full justify-center bg-bunker-800 text-white">+ <div className="w-full max-w-8xl">+ <KmipServerTab />+ </div>+ </div>+ </>+ );+};diff --git a/frontend/src/pages/organization/KmipServersPage/components/KmipServerTab.tsx b/frontend/src/pages/organization/KmipServersPage/components/KmipServerTab.tsxnew file mode 100644index 0000000000..c93a4721da--- /dev/null+++ b/frontend/src/pages/organization/KmipServersPage/components/KmipServerTab.tsx@@ -0,0 +1,224 @@+import { useState } from "react";+import {+ faCopy,+ faEllipsisV,+ faMagnifyingGlass,+ faPlus,+ faSearch,+ faServer,+ faTrash+} from "@fortawesome/free-solid-svg-icons";+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";+import { useNavigate } from "@tanstack/react-router";+import { formatRelative } from "date-fns";++import { createNotification } from "@app/components/notifications";+import { OrgPermissionCan } from "@app/components/permissions";+import {+ Button,+ DeleteActionModal,+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuTrigger,+ EmptyState,+ IconButton,+ Input,+ Table,+ TableContainer,+ TableSkeleton,+ TBody,+ Td,+ Th,+ THead,+ Tooltip,+ Tr+} from "@app/components/v2";+import { DocumentationLinkBadge } from "@app/components/v3";+import { useOrganization } from "@app/context";+import {+ OrgKmipServerPermissionActions,+ OrgPermissionSubjects+} from "@app/context/OrgPermissionContext/types";+import { withPermission } from "@app/hoc";+import { usePopUp } from "@app/hooks";+import { useDeleteKmipServerById, useGetKmipServers } from "@app/hooks/api/kmipServers";++import { KmipServerDeployModal } from "./components/KmipServerDeployModal";++export const KmipServerTab = withPermission(+ () => {+ const [search, setSearch] = useState("");+ const { data: kmipServers, isPending: isLoading } = useGetKmipServers();+ const { currentOrg } = useOrganization();+ const orgId = currentOrg?.id || "";++ const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp([+ "deleteKmipServer",+ "deployKmipServer"+ ] as const);++ const navigate = useNavigate();++ const deleteKmipServerById = useDeleteKmipServerById();++ const handleDeleteKmipServer = async () => {+ const data = popUp.deleteKmipServer.data as { id: string };+ await deleteKmipServerById.mutateAsync(data.id);++ handlePopUpToggle("deleteKmipServer");+ createNotification({+ type: "success",+ text: "Successfully deleted KMIP server"+ });+ };++ const filteredKmipServers = kmipServers?.filter((el) =>+ el.name.toLowerCase().includes(search.toLowerCase())+ );++ return (+ <div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">+ <div className="mb-2 flex items-center justify-between">+ <div className="flex grow items-center gap-x-2">+ <h3 className="text-lg font-medium text-mineshaft-100">KMIP Servers</h3>+ <DocumentationLinkBadge href="https://infisical.com/docs/documentation/platform/kms/kmip" />+ <div className="flex grow" />+ <OrgPermissionCan+ I={OrgKmipServerPermissionActions.CreateKmipServers}+ a={OrgPermissionSubjects.KmipServer}+ >+ {(isAllowed) => (+ <Button+ variant="outline_bg"+ leftIcon={<FontAwesomeIcon icon={faPlus} />}+ isDisabled={!isAllowed}+ onClick={() => handlePopUpOpen("deployKmipServer")}+ >+ Create KMIP Server+ </Button>+ )}+ </OrgPermissionCan>+ </div>+ </div>+ <p className="mb-4 text-sm text-mineshaft-400">+ Create and configure KMIP servers that proxy KMIP requests to Infisical KMS+ </p>+ <div>+ <div className="flex gap-2">+ <Input+ value={search}+ onChange={(e) => setSearch(e.target.value)}+ leftIcon={<FontAwesomeIcon icon={faMagnifyingGlass} />}+ placeholder="Search KMIP server..."+ className="flex-1"+ />+ </div>+ <TableContainer className="mt-4">+ <Table>+ <THead>+ <Tr>+ <Th className="w-2/3">Name</Th>+ <Th>Created</Th>+ <Th className="w-5" />+ </Tr>+ </THead>+ <TBody>+ {isLoading && (+ <TableSkeleton innerKey="kmip-server-table" columns={3} key="kmip-server-table" />+ )}+ {filteredKmipServers?.map((el) => (+ <Tr+ key={el.id}+ className="cursor-pointer hover:bg-mineshaft-700"+ onClick={() => {+ navigate({+ to: "/organizations/$orgId/projects/kms/kmip-servers/$kmipServerId",+ params: { orgId, kmipServerId: el.id }+ });+ }}+ >+ <Td>{el.name}</Td>+ <Td>{formatRelative(new Date(el.createdAt), new Date())}</Td>+ <Td className="w-5">+ <Tooltip className="max-w-sm text-center" content="Options">+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <IconButton+ ariaLabel="Options"+ colorSchema="secondary"+ className="w-6"+ variant="plain"+ >+ <FontAwesomeIcon icon={faEllipsisV} />+ </IconButton>+ </DropdownMenuTrigger>+ <DropdownMenuContent align="end">+ <DropdownMenuItem+ icon={<FontAwesomeIcon icon={faCopy} />}+ onClick={(e) => {+ e.stopPropagation();+ navigator.clipboard.writeText(el.id);+ }}+ >+ Copy ID+ </DropdownMenuItem>+ <OrgPermissionCan+ I={OrgKmipServerPermissionActions.DeleteKmipServers}+ a={OrgPermissionSubjects.KmipServer}+ >+ {(isAllowed: boolean) => (+ <DropdownMenuItem+ isDisabled={!isAllowed}+ icon={<FontAwesomeIcon icon={faTrash} />}+ className="text-red"+ onClick={(e) => {+ e.stopPropagation();+ handlePopUpOpen("deleteKmipServer", el);+ }}+ >+ Delete KMIP Server+ </DropdownMenuItem>+ )}+ </OrgPermissionCan>+ </DropdownMenuContent>+ </DropdownMenu>+ </Tooltip>+ </Td>+ </Tr>+ ))}+ </TBody>+ </Table>+ {!isLoading && !filteredKmipServers?.length && (+ <EmptyState+ title={+ kmipServers?.length+ ? "No KMIP servers match search..."+ : "No KMIP servers have been configured"+ }+ icon={kmipServers?.length ? faSearch : faServer}+ />+ )}+ <DeleteActionModal+ isOpen={popUp.deleteKmipServer.isOpen}+ title={`Are you sure you want to delete KMIP server ${+ (popUp?.deleteKmipServer?.data as { name: string })?.name || ""+ }?`}+ onChange={(isOpen) => handlePopUpToggle("deleteKmipServer", isOpen)}+ deleteKey="confirm"+ onDeleteApproved={() => handleDeleteKmipServer()}+ />+ <KmipServerDeployModal+ isOpen={popUp.deployKmipServer.isOpen}+ onOpenChange={(isOpen) => handlePopUpToggle("deployKmipServer", isOpen)}+ />+ </TableContainer>+ </div>+ </div>+ );+ },+ {+ action: OrgKmipServerPermissionActions.ListKmipServers,+ subject: OrgPermissionSubjects.KmipServer+ }+);diff --git a/frontend/src/pages/organization/KmipServersPage/components/components/KmipServerDeployModal.tsx b/frontend/src/pages/organization/KmipServersPage/components/components/KmipServerDeployModal.tsxnew file mode 100644index 0000000000..2aafb079cd--- /dev/null+++ b/frontend/src/pages/organization/KmipServersPage/components/components/KmipServerDeployModal.tsx@@ -0,0 +1,98 @@+import { useState } from "react";+import { useNavigate } from "@tanstack/react-router";++import { createNotification } from "@app/components/notifications";+import { Button, FormControl, Input, Modal, ModalClose, ModalContent } from "@app/components/v2";+import { useOrganization } from "@app/context";+import { useCreateKmipServer } from "@app/hooks/api/kmipServers";++type Props = {+ isOpen: boolean;+ onOpenChange: (isOpen: boolean) => void;+};++export const KmipServerDeployModal = ({ isOpen, onOpenChange }: Props) => {+ const [name, setName] = useState("");+ const [formErrors, setFormErrors] = useState<string[]>([]);++ const { currentOrg } = useOrganization();+ const orgId = currentOrg?.id || "";+ const navigate = useNavigate();+ const { mutateAsync: createKmipServer, isPending: isCreating } = useCreateKmipServer();++ const handleCreate = async () => {+ const errors: string[] = [];+ if (!name.trim()) errors.push("Name is required");+ if (errors.length) {+ setFormErrors(errors);+ return;+ }+ setFormErrors([]);++ try {+ const kmipServer = await createKmipServer({+ name: name.trim(),+ authMethod: { method: "token" }+ });++ onOpenChange(false);+ navigate({+ to: "/organizations/$orgId/projects/kms/kmip-servers/$kmipServerId",+ params: { orgId, kmipServerId: kmipServer.id }+ });+ } catch (err: any) {+ createNotification({+ type: "error",+ text: err?.message || "Failed to create KMIP server"+ });+ }+ };++ const handleClose = (open: boolean) => {+ if (!open) {+ setName("");+ setFormErrors([]);+ }+ onOpenChange(open);+ };++ return (+ <Modal isOpen={isOpen} onOpenChange={handleClose}>+ <ModalContent+ className="max-w-lg"+ title="Create KMIP Server"+ subTitle="Create a new KMIP server. You can generate an enrollment token and deploy it from the KMIP server detail page."+ bodyClassName="overflow-visible"+ >+ <div className="flex flex-col gap-4">+ {formErrors.length > 0 && (+ <div className="rounded-md bg-red-500/10 p-3">+ {formErrors.map((e) => (+ <p key={e} className="text-sm text-red-400">+ {e}+ </p>+ ))}+ </div>+ )}+ <FormControl label="Name" isRequired>+ <Input+ value={name}+ onChange={(e) => setName(e.target.value)}+ placeholder="my-kmip-server"+ />+ </FormControl>+ <div className="mt-2 flex items-center gap-2">+ <Button onClick={handleCreate} isLoading={isCreating} isDisabled={isCreating} size="sm">+ Create KMIP Server+ </Button>+ <ModalClose asChild>+ <Button size="sm" colorSchema="secondary">+ Cancel+ </Button>+ </ModalClose>+ </div>+ </div>+ </ModalContent>+ </Modal>+ );+};diff --git a/frontend/src/pages/organization/KmipServersPage/components/index.tsx b/frontend/src/pages/organization/KmipServersPage/components/index.tsxnew file mode 100644index 0000000000..bb264c94e1--- /dev/null+++ b/frontend/src/pages/organization/KmipServersPage/components/index.tsx@@ -0,0 +1 @@+export { KmipServerTab } from "./KmipServerTab";diff --git a/frontend/src/pages/organization/KmipServersPage/index.tsx b/frontend/src/pages/organization/KmipServersPage/index.tsxnew file mode 100644index 0000000000..03998c475b--- /dev/null+++ b/frontend/src/pages/organization/KmipServersPage/index.tsx@@ -0,0 +1 @@+export { KmipServersPage } from "./KmipServersPage";diff --git a/frontend/src/pages/organization/KmipServersPage/route.tsx b/frontend/src/pages/organization/KmipServersPage/route.tsxnew file mode 100644index 0000000000..295e86ff61--- /dev/null+++ b/frontend/src/pages/organization/KmipServersPage/route.tsx@@ -0,0 +1,16 @@+import { createFileRoute } from "@tanstack/react-router";++import { KmipServersPage } from "./KmipServersPage";++export const Route = createFileRoute(+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/kmip-servers/"+)({+ component: KmipServersPage,+ context: () => ({+ breadcrumbs: [+ {+ label: "KMIP Servers"+ }+ ]+ })+});diff --git a/frontend/src/pages/organization/RoleByIDPage/components/OrgRoleModifySection.utils.ts b/frontend/src/pages/organization/RoleByIDPage/components/OrgRoleModifySection.utils.tsindex efd49981b1..cb712a3eb8 100644--- a/frontend/src/pages/organization/RoleByIDPage/components/OrgRoleModifySection.utils.ts+++ b/frontend/src/pages/organization/RoleByIDPage/components/OrgRoleModifySection.utils.ts@@ -5,6 +5,7 @@ import { OrgPermissionSubjects } from "@app/context";import {OrgGatewayPermissionActions,OrgGatewayPoolPermissionActions,+ OrgKmipServerPermissionActions,OrgPermissionActions,OrgPermissionAdminConsoleAction,OrgPermissionAppConnectionActions,@@ -143,6 +144,18 @@ const orgRelayPermissionSchema = z).optional();+const orgKmipServerPermissionSchema = z+ .array(+ z.object({+ [OrgKmipServerPermissionActions.ListKmipServers]: z.boolean().optional(),+ [OrgKmipServerPermissionActions.EditKmipServers]: z.boolean().optional(),+ [OrgKmipServerPermissionActions.DeleteKmipServers]: z.boolean().optional(),+ [OrgKmipServerPermissionActions.CreateKmipServers]: z.boolean().optional(),+ [OrgKmipServerPermissionActions.RevokeKmipServerAccess]: z.boolean().optional()+ })+ )+ .optional();+const machineIdentityAuthTemplatePermissionSchema = z.array(z.object({@@ -234,6 +247,7 @@ export const formSchema = z.object({gateway: orgGatewayPermissionSchema,"gateway-pool": orgGatewayPoolPermissionSchema,relay: orgRelayPermissionSchema,+ [OrgPermissionSubjects.KmipServer]: orgKmipServerPermissionSchema,"machine-identity-auth-template": machineIdentityAuthTemplatePermissionSchema,"secret-share": secretSharingPermissionSchema,"sub-organization": subOrganizationPermissionSchema,@@ -799,6 +813,37 @@ export const ORG_PERMISSION_OBJECT: Record<string, TOrgPermissionConfig> = {}]},+ [OrgPermissionSubjects.KmipServer]: {+ title: "KMIP Servers",+ description: "Manage KMIP servers that proxy KMIP requests to Infisical KMS",+ actions: [+ {+ value: OrgKmipServerPermissionActions.ListKmipServers,+ label: "List KMIP Servers",+ description: "View available KMIP servers"+ },+ {+ value: OrgKmipServerPermissionActions.CreateKmipServers,+ label: "Create KMIP Servers",+ description: "Add new KMIP servers"+ },+ {+ value: OrgKmipServerPermissionActions.EditKmipServers,+ label: "Edit KMIP Servers",+ description: "Update KMIP server configuration and auth method"+ },+ {+ value: OrgKmipServerPermissionActions.DeleteKmipServers,+ label: "Delete KMIP Servers",+ description: "Remove KMIP servers"+ },+ {+ value: OrgKmipServerPermissionActions.RevokeKmipServerAccess,+ label: "Revoke KMIP Server Access",+ description: "Revoke access to KMIP servers"+ }+ ]+ },[OrgPermissionSubjects.Billing]: {title: "Billing",description: "View and manage billing details, invoices, and payment methods",@@ -926,17 +971,9 @@ export const ORG_PERMISSION_OBJECT: Record<string, TOrgPermissionConfig> = {}]},- [OrgPermissionSubjects.Kmip]: {- title: "KMIP",- description: "Proxy KMIP requests to organization key management infrastructure",- actions: [- {- value: OrgPermissionKmipActions.Proxy,- label: "Proxy KMIP requests",- description: "Route KMIP requests to organization key management infrastructure"- }- ]- },+ // NOTE: The "KMIP" (proxy) org permission is deprecated — KMIP servers now authenticate via+ // enrollment-based access tokens, so the permission is no longer needed and is intentionally+ // not surfaced here. The schema still accepts it so existing roles that carry it keep working.[OrgPermissionSubjects.SubOrganization]: {title: "Sub-Organizations",description: "Create and manage namespaces within the organization",diff --git a/frontend/src/routeTree.gen.ts b/frontend/src/routeTree.gen.tsindex fcd4cf5429..10bb83d9b7 100644--- a/frontend/src/routeTree.gen.ts+++ b/frontend/src/routeTree.gen.ts@@ -84,7 +84,9 @@ import { Route as pamLayoutImport } from './pages/pam/layout'import { Route as kmsLayoutImport } from './pages/kms/layout'import { Route as certManagerLayoutImport } from './pages/cert-manager/layout'import { Route as aiLayoutImport } from './pages/ai/layout'+import { Route as organizationKmipServersPageKmipServerDetailsByIDPageRouteImport } from './pages/organization/KmipServersPage/KmipServerDetailsByIDPage/route'import { Route as organizationAppConnectionsOauthCallbackPageRouteImport } from './pages/organization/AppConnections/OauthCallbackPage/route'+import { Route as organizationKmipServersPageRouteImport } from './pages/organization/KmipServersPage/route'import { Route as projectAuditLogsPageRouteSshImport } from './pages/project/AuditLogsPage/route-ssh'import { Route as projectAccessControlPageRouteSshImport } from './pages/project/AccessControlPage/route-ssh'import { Route as projectAuditLogsPageRouteSecretScanningImport } from './pages/project/AuditLogsPage/route-secret-scanning'@@ -335,6 +337,10 @@ const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIcreateFileRoute('/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId',)()+const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsKmsKmipServersImport =+ createFileRoute(+ '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/kmip-servers',+ )()const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsKmsProjectIdImport =createFileRoute('/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/$projectId',@@ -985,6 +991,15 @@ const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectI} as any,)+const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsKmsKmipServersRoute =+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsKmsKmipServersImport.update(+ {+ id: '/kms/kmip-servers',+ path: '/kms/kmip-servers',+ getParentRoute: () => organizationProjectsPageRouteRoute,+ } as any,+ )+const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsKmsProjectIdRoute =AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsKmsProjectIdImport.update({@@ -1078,6 +1093,14 @@ const aiLayoutRoute = aiLayoutImport.update({AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsAiProjectIdRoute,} as any)+const organizationKmipServersPageKmipServerDetailsByIDPageRouteRoute =+ organizationKmipServersPageKmipServerDetailsByIDPageRouteImport.update({+ id: '/$kmipServerId',+ path: '/$kmipServerId',+ getParentRoute: () =>+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsKmsKmipServersRoute,+ } as any)+const organizationAppConnectionsOauthCallbackPageRouteRoute =organizationAppConnectionsOauthCallbackPageRouteImport.update({id: '/$appConnection/oauth/callback',@@ -1086,6 +1109,14 @@ const organizationAppConnectionsOauthCallbackPageRouteRoute =AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdAppConnectionsRoute,} as any)+const organizationKmipServersPageRouteRoute =+ organizationKmipServersPageRouteImport.update({+ id: '/',+ path: '/',+ getParentRoute: () =>+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsKmsKmipServersRoute,+ } as any)+const projectAuditLogsPageRouteSshRoute =projectAuditLogsPageRouteSshImport.update({id: '/audit-logs',@@ -3259,6 +3290,13 @@ declare module '@tanstack/react-router' {preLoaderRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsKmsProjectIdImportparentRoute: typeof organizationProjectsPageRouteImport}+ '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/kmip-servers': {+ id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/kmip-servers'+ path: '/kms/kmip-servers'+ fullPath: '/organizations/$orgId/projects/kms/kmip-servers'+ preLoaderRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsKmsKmipServersImport+ parentRoute: typeof organizationProjectsPageRouteImport+ }'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId': {id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId'path: '/pam/$projectId'@@ -3294,6 +3332,13 @@ declare module '@tanstack/react-router' {preLoaderRoute: typeof secretManagerRedirectsRedirectApprovalPageImportparentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdSecretManagerProjectIdImport}+ '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/kmip-servers/': {+ id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/kmip-servers/'+ path: '/'+ fullPath: '/organizations/$orgId/projects/kms/kmip-servers/'+ preLoaderRoute: typeof organizationKmipServersPageRouteImport+ parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsKmsKmipServersImport+ }'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/app-connections/$appConnection/oauth/callback': {id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/app-connections/$appConnection/oauth/callback'path: '/$appConnection/oauth/callback'@@ -3301,6 +3346,13 @@ declare module '@tanstack/react-router' {preLoaderRoute: typeof organizationAppConnectionsOauthCallbackPageRouteImportparentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdAppConnectionsImport}+ '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/kmip-servers/$kmipServerId': {+ id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/kmip-servers/$kmipServerId'+ path: '/$kmipServerId'+ fullPath: '/organizations/$orgId/projects/kms/kmip-servers/$kmipServerId'+ preLoaderRoute: typeof organizationKmipServersPageKmipServerDetailsByIDPageRouteImport+ parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsKmsKmipServersImport+ }'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/ai/$projectId/_ai-layout': {id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/ai/$projectId/_ai-layout'path: ''@@ -5193,6 +5245,24 @@ const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsKmsProjectIAuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsKmsProjectIdRouteChildren,)+interface AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsKmsKmipServersRouteChildren {+ organizationKmipServersPageRouteRoute: typeof organizationKmipServersPageRouteRoute+ organizationKmipServersPageKmipServerDetailsByIDPageRouteRoute: typeof organizationKmipServersPageKmipServerDetailsByIDPageRouteRoute+}++const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsKmsKmipServersRouteChildren: AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsKmsKmipServersRouteChildren =+ {+ organizationKmipServersPageRouteRoute:+ organizationKmipServersPageRouteRoute,+ organizationKmipServersPageKmipServerDetailsByIDPageRouteRoute:+ organizationKmipServersPageKmipServerDetailsByIDPageRouteRoute,+ }++const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsKmsKmipServersRouteWithChildren =+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsKmsKmipServersRoute._addFileChildren(+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsKmsKmipServersRouteChildren,+ )+interface AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutApprovalsRouteChildren {pamApprovalsPageRouteRoute: typeof pamApprovalsPageRouteRoutepamApprovalRequestDetailPageRouteRoute: typeof pamApprovalRequestDetailPageRouteRoute@@ -5874,6 +5944,7 @@ interface organizationProjectsPageRouteRouteChildren {AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsAiProjectIdRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsAiProjectIdRouteWithChildrenAuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsCertManagerProjectIdRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsCertManagerProjectIdRouteWithChildrenAuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsKmsProjectIdRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsKmsProjectIdRouteWithChildren+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsKmsKmipServersRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsKmsKmipServersRouteWithChildrenAuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdRouteWithChildrenAuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsSecretManagementProjectIdRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsSecretManagementProjectIdRouteWithChildrenAuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsSecretScanningProjectIdRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsSecretScanningProjectIdRouteWithChildren@@ -5890,6 +5961,8 @@ const organizationProjectsPageRouteRouteChildren: organizationProjectsPageRouteRAuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsCertManagerProjectIdRouteWithChildren,AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsKmsProjectIdRoute:AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsKmsProjectIdRouteWithChildren,+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsKmsKmipServersRoute:+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsKmsKmipServersRouteWithChildren,AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdRoute:AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdRouteWithChildren,AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsSecretManagementProjectIdRoute:@@ -6308,12 +6381,15 @@ export interface FileRoutesByFullPath {'/organizations/$orgId/projects/ai/$projectId': typeof aiLayoutRouteWithChildren'/organizations/$orgId/projects/cert-manager/$projectId': typeof certManagerLayoutRouteWithChildren'/organizations/$orgId/projects/kms/$projectId': typeof kmsLayoutRouteWithChildren+ '/organizations/$orgId/projects/kms/kmip-servers': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsKmsKmipServersRouteWithChildren'/organizations/$orgId/projects/pam/$projectId': typeof pamLayoutRouteWithChildren'/organizations/$orgId/projects/secret-management/$projectId': typeof secretManagerLayoutRouteWithChildren'/organizations/$orgId/projects/secret-scanning/$projectId': typeof secretScanningLayoutRouteWithChildren'/organizations/$orgId/projects/ssh/$projectId': typeof sshLayoutRouteWithChildren'/organizations/$orgId/secret-manager/$projectId/approval': typeof secretManagerRedirectsRedirectApprovalPageRoute+ '/organizations/$orgId/projects/kms/kmip-servers/': typeof organizationKmipServersPageRouteRoute'/organizations/$orgId/app-connections/$appConnection/oauth/callback': typeof organizationAppConnectionsOauthCallbackPageRouteRoute+ '/organizations/$orgId/projects/kms/kmip-servers/$kmipServerId': typeof organizationKmipServersPageKmipServerDetailsByIDPageRouteRoute'/organizations/$orgId/projects/ai/$projectId/overview': typeof aiMCPPageRouteRoute'/organizations/$orgId/projects/ai/$projectId/settings': typeof aiSettingsPageRouteRoute'/organizations/$orgId/projects/cert-manager/$projectId/alerting': typeof certManagerAlertingPageRouteRoute@@ -6598,7 +6674,9 @@ export interface FileRoutesByTo {'/organizations/$orgId/projects/secret-scanning/$projectId': typeof secretScanningLayoutRouteWithChildren'/organizations/$orgId/projects/ssh/$projectId': typeof sshLayoutRouteWithChildren'/organizations/$orgId/secret-manager/$projectId/approval': typeof secretManagerRedirectsRedirectApprovalPageRoute+ '/organizations/$orgId/projects/kms/kmip-servers': typeof organizationKmipServersPageRouteRoute'/organizations/$orgId/app-connections/$appConnection/oauth/callback': typeof organizationAppConnectionsOauthCallbackPageRouteRoute+ '/organizations/$orgId/projects/kms/kmip-servers/$kmipServerId': typeof organizationKmipServersPageKmipServerDetailsByIDPageRouteRoute'/organizations/$orgId/projects/ai/$projectId/overview': typeof aiMCPPageRouteRoute'/organizations/$orgId/projects/ai/$projectId/settings': typeof aiSettingsPageRouteRoute'/organizations/$orgId/projects/cert-manager/$projectId/alerting': typeof certManagerAlertingPageRouteRoute@@ -6871,12 +6949,15 @@ export interface FileRoutesById {'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/ai/$projectId': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsAiProjectIdRouteWithChildren'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsCertManagerProjectIdRouteWithChildren'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/$projectId': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsKmsProjectIdRouteWithChildren+ '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/kmip-servers': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsKmsKmipServersRouteWithChildren'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdRouteWithChildren'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsSecretManagementProjectIdRouteWithChildren'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-scanning/$projectId': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsSecretScanningProjectIdRouteWithChildren'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/ssh/$projectId': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsSshProjectIdRouteWithChildren'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/secret-manager/$projectId/approval': typeof secretManagerRedirectsRedirectApprovalPageRoute+ '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/kmip-servers/': typeof organizationKmipServersPageRouteRoute'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/app-connections/$appConnection/oauth/callback': typeof organizationAppConnectionsOauthCallbackPageRouteRoute+ '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/kmip-servers/$kmipServerId': typeof organizationKmipServersPageKmipServerDetailsByIDPageRouteRoute'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/ai/$projectId/_ai-layout': typeof aiLayoutRouteWithChildren'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout': typeof certManagerLayoutRouteWithChildren'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/$projectId/_kms-layout': typeof kmsLayoutRouteWithChildren@@ -7173,12 +7254,15 @@ export interface FileRouteTypes {| '/organizations/$orgId/projects/ai/$projectId'| '/organizations/$orgId/projects/cert-manager/$projectId'| '/organizations/$orgId/projects/kms/$projectId'+ | '/organizations/$orgId/projects/kms/kmip-servers'| '/organizations/$orgId/projects/pam/$projectId'| '/organizations/$orgId/projects/secret-management/$projectId'| '/organizations/$orgId/projects/secret-scanning/$projectId'| '/organizations/$orgId/projects/ssh/$projectId'| '/organizations/$orgId/secret-manager/$projectId/approval'+ | '/organizations/$orgId/projects/kms/kmip-servers/'| '/organizations/$orgId/app-connections/$appConnection/oauth/callback'+ | '/organizations/$orgId/projects/kms/kmip-servers/$kmipServerId'| '/organizations/$orgId/projects/ai/$projectId/overview'| '/organizations/$orgId/projects/ai/$projectId/settings'| '/organizations/$orgId/projects/cert-manager/$projectId/alerting'@@ -7462,7 +7546,9 @@ export interface FileRouteTypes {| '/organizations/$orgId/projects/secret-scanning/$projectId'| '/organizations/$orgId/projects/ssh/$projectId'| '/organizations/$orgId/secret-manager/$projectId/approval'+ | '/organizations/$orgId/projects/kms/kmip-servers'| '/organizations/$orgId/app-connections/$appConnection/oauth/callback'+ | '/organizations/$orgId/projects/kms/kmip-servers/$kmipServerId'| '/organizations/$orgId/projects/ai/$projectId/overview'| '/organizations/$orgId/projects/ai/$projectId/settings'| '/organizations/$orgId/projects/cert-manager/$projectId/alerting'@@ -7733,12 +7819,15 @@ export interface FileRouteTypes {| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/ai/$projectId'| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId'| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/$projectId'+ | '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/kmip-servers'| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId'| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId'| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-scanning/$projectId'| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/ssh/$projectId'| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/secret-manager/$projectId/approval'+ | '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/kmip-servers/'| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/app-connections/$appConnection/oauth/callback'+ | '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/kmip-servers/$kmipServerId'| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/ai/$projectId/_ai-layout'| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout'| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/$projectId/_kms-layout'@@ -8268,6 +8357,7 @@ export const routeTree = rootRoute"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/ai/$projectId","/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId","/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/$projectId",+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/kmip-servers","/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId","/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId","/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-scanning/$projectId",@@ -8426,6 +8516,14 @@ export const routeTree = rootRoute"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/$projectId/_kms-layout"]},+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/kmip-servers": {+ "filePath": "",+ "parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects",+ "children": [+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/kmip-servers/",+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/kmip-servers/$kmipServerId"+ ]+ },"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId": {"filePath": "","parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects",@@ -8458,10 +8556,18 @@ export const routeTree = rootRoute"filePath": "secret-manager/redirects/redirect-approval-page.tsx","parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/secret-manager/$projectId"},+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/kmip-servers/": {+ "filePath": "organization/KmipServersPage/route.tsx",+ "parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/kmip-servers"+ },"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/app-connections/$appConnection/oauth/callback": {"filePath": "organization/AppConnections/OauthCallbackPage/route.tsx","parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/app-connections"},+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/kmip-servers/$kmipServerId": {+ "filePath": "organization/KmipServersPage/KmipServerDetailsByIDPage/route.tsx",+ "parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/kmip-servers"+ },"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/ai/$projectId/_ai-layout": {"filePath": "ai/layout.tsx","parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/ai/$projectId",diff --git a/frontend/src/routes.ts b/frontend/src/routes.tsindex 1d7e84210c..cb4b06fd87 100644--- a/frontend/src/routes.ts+++ b/frontend/src/routes.ts@@ -443,6 +443,13 @@ const pamAccessRoute = route(const organizationRoutes = route("/organizations/$orgId", [route("/projects", "organization/ProjectsPage/route.tsx"),route("/projects/$type", "organization/ProjectsPage/ProjectTypePage/route.tsx"),+ route("/projects/kms/kmip-servers", [+ index("organization/KmipServersPage/route.tsx"),+ route(+ "/$kmipServerId",+ "organization/KmipServersPage/KmipServerDetailsByIDPage/route.tsx"+ )+ ]),route("/access-management", "organization/AccessManagementPage/route.tsx"),route("/audit-logs", "organization/AuditLogsPage/route.tsx"),route("/billing", "organization/BillingPage/route.tsx"),