mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 11:38:55 +00:00
misc: migrated KMIP PKI to be scoped at the org level
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
export {
|
||||
useAdminDeleteUser,
|
||||
useCreateAdminUser,
|
||||
useSetupInstanceKmip,
|
||||
useUpdateAdminSlackConfig,
|
||||
useUpdateServerConfig,
|
||||
useUpdateServerEncryptionStrategy
|
||||
@@ -9,7 +8,6 @@ export {
|
||||
export {
|
||||
useAdminGetUsers,
|
||||
useGetAdminSlackConfig,
|
||||
useGetInstanceKmipConfig,
|
||||
useGetServerConfig,
|
||||
useGetServerRootKmsEncryptionDetails
|
||||
} from "./queries";
|
||||
|
||||
@@ -7,12 +7,9 @@ import { User } from "../users/types";
|
||||
import { adminQueryKeys, adminStandaloneKeys } from "./queries";
|
||||
import {
|
||||
AdminSlackConfig,
|
||||
InstanceKmipServerCert,
|
||||
RootKeyEncryptionStrategy,
|
||||
TCreateAdminUserDTO,
|
||||
TGenerateInstanceKmipServerCertDTO,
|
||||
TServerConfig,
|
||||
TSetupInstanceKmipDTO,
|
||||
TUpdateAdminSlackConfigDTO
|
||||
} from "./types";
|
||||
|
||||
@@ -101,26 +98,3 @@ export const useUpdateServerEncryptionStrategy = () => {
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
export const useSetupInstanceKmip = () => {
|
||||
const queryClient = useQueryClient();
|
||||
return useMutation({
|
||||
mutationFn: async (payload: TSetupInstanceKmipDTO) => {
|
||||
await apiRequest.post("/api/v1/admin/kmip", payload);
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: adminQueryKeys.getInstanceKmip() });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
export const useGenerateInstanceKmipServerCert = () => {
|
||||
return useMutation({
|
||||
mutationFn: async (payload: TGenerateInstanceKmipServerCertDTO) => {
|
||||
return apiRequest.post<InstanceKmipServerCert>(
|
||||
"/api/v1/admin/kmip/server-certificates",
|
||||
payload
|
||||
);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -6,7 +6,6 @@ import { User } from "../types";
|
||||
import {
|
||||
AdminGetUsersFilters,
|
||||
AdminSlackConfig,
|
||||
InstanceKmipConfig,
|
||||
TGetServerRootKmsEncryptionDetails,
|
||||
TServerConfig
|
||||
} from "./types";
|
||||
@@ -95,14 +94,3 @@ export const useGetServerRootKmsEncryptionDetails = () => {
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
export const useGetInstanceKmipConfig = () => {
|
||||
return useQuery({
|
||||
queryKey: adminQueryKeys.getInstanceKmip(),
|
||||
queryFn: async () => {
|
||||
const { data } = await apiRequest.get<InstanceKmipConfig>("/api/v1/admin/kmip");
|
||||
|
||||
return data;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { CertKeyAlgorithm } from "../certificates/enums";
|
||||
|
||||
export enum LoginMethod {
|
||||
EMAIL = "email",
|
||||
GOOGLE = "google",
|
||||
@@ -64,30 +62,7 @@ export type TGetServerRootKmsEncryptionDetails = {
|
||||
}[];
|
||||
};
|
||||
|
||||
export type InstanceKmipConfig = {
|
||||
serverCertificateChain: string;
|
||||
clientCertificateChain: string;
|
||||
};
|
||||
|
||||
export enum RootKeyEncryptionStrategy {
|
||||
Software = "SOFTWARE",
|
||||
HSM = "HSM"
|
||||
}
|
||||
|
||||
export type TSetupInstanceKmipDTO = {
|
||||
caKeyAlgorithm: CertKeyAlgorithm;
|
||||
};
|
||||
|
||||
export type TGenerateInstanceKmipServerCertDTO = {
|
||||
commonName: string;
|
||||
keyAlgorithm: CertKeyAlgorithm;
|
||||
altNames: string;
|
||||
ttl: string;
|
||||
};
|
||||
|
||||
export type InstanceKmipServerCert = {
|
||||
serialNumber: string;
|
||||
certificate: string;
|
||||
certificateChain: string;
|
||||
privateKey: string;
|
||||
};
|
||||
|
||||
@@ -5,9 +5,12 @@ import { apiRequest } from "@app/config/request";
|
||||
import { kmipKeys } from "./queries";
|
||||
import {
|
||||
KmipClientCertificate,
|
||||
OrgKmipServerCert,
|
||||
TCreateKmipClient,
|
||||
TDeleteKmipClient,
|
||||
TGenerateKmipClientCertificate,
|
||||
TGenerateOrgKmipServerCertDTO,
|
||||
TSetupOrgKmipDTO,
|
||||
TUpdateKmipClient
|
||||
} from "./types";
|
||||
|
||||
@@ -75,3 +78,23 @@ export const useGenerateKmipClientCertificate = () => {
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
export const useSetupOrgKmip = (orgId: string) => {
|
||||
const queryClient = useQueryClient();
|
||||
return useMutation({
|
||||
mutationFn: async (payload: TSetupOrgKmipDTO) => {
|
||||
await apiRequest.post("/api/v1/kmip", payload);
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: kmipKeys.getOrgKmip(orgId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
export const useGenerateOrgKmipServerCert = () => {
|
||||
return useMutation({
|
||||
mutationFn: async (payload: TGenerateOrgKmipServerCertDTO) => {
|
||||
return apiRequest.post<OrgKmipServerCert>("/api/v1/kmip/server-certificates", payload);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -3,11 +3,17 @@ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
|
||||
import { apiRequest } from "@app/config/request";
|
||||
|
||||
import { OrderByDirection } from "../generic/types";
|
||||
import { KmipClientOrderBy, TListProjectKmipClientsDTO, TProjectKmipClientList } from "./types";
|
||||
import {
|
||||
KmipClientOrderBy,
|
||||
OrgKmipConfig,
|
||||
TListProjectKmipClientsDTO,
|
||||
TProjectKmipClientList
|
||||
} from "./types";
|
||||
|
||||
export const kmipKeys = {
|
||||
getKmipClientsByProjectId: ({ projectId, ...filters }: TListProjectKmipClientsDTO) =>
|
||||
[projectId, filters] as const
|
||||
[projectId, filters] as const,
|
||||
getOrgKmip: (orgId: string) => [{ orgId }, "org-kmip-config"] as const
|
||||
};
|
||||
|
||||
export const useGetKmipClientsByProjectId = (
|
||||
@@ -50,3 +56,14 @@ export const useGetKmipClientsByProjectId = (
|
||||
...options
|
||||
});
|
||||
};
|
||||
|
||||
export const useGetOrgKmipConfig = (orgId: string) => {
|
||||
return useQuery({
|
||||
queryKey: kmipKeys.getOrgKmip(orgId),
|
||||
queryFn: async () => {
|
||||
const { data } = await apiRequest.get<OrgKmipConfig>("/api/v1/kmip");
|
||||
|
||||
return data;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -63,3 +63,26 @@ export type TListProjectKmipClientsDTO = {
|
||||
export enum KmipClientOrderBy {
|
||||
Name = "name"
|
||||
}
|
||||
|
||||
export type OrgKmipConfig = {
|
||||
serverCertificateChain: string;
|
||||
clientCertificateChain: string;
|
||||
};
|
||||
|
||||
export type TSetupOrgKmipDTO = {
|
||||
caKeyAlgorithm: CertKeyAlgorithm;
|
||||
};
|
||||
|
||||
export type TGenerateOrgKmipServerCertDTO = {
|
||||
commonName: string;
|
||||
keyAlgorithm: CertKeyAlgorithm;
|
||||
altNames: string;
|
||||
ttl: string;
|
||||
};
|
||||
|
||||
export type OrgKmipServerCert = {
|
||||
serialNumber: string;
|
||||
certificate: string;
|
||||
certificateChain: string;
|
||||
privateKey: string;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user