Skip to content

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

Add more missing ACME stuff

Fang-Pen Lin2d8126c0111f
diff --git a/backend/src/services/certificate-profile/certificate-profile-service.ts b/backend/src/services/certificate-profile/certificate-profile-service.ts
index d9b9565e10..0de9d6c55c 100644
--- a/backend/src/services/certificate-profile/certificate-profile-service.ts
+++ b/backend/src/services/certificate-profile/certificate-profile-service.ts
@@ -225,11 +225,8 @@ export const certificateProfileServiceFactory = ({
message: "API enrollment requires API configuration"
});
}
- if (data.enrollmentType === EnrollmentType.ACME && !data.acmeConfig) {
- throw new ForbiddenRequestError({
- message: "ACME enrollment requires ACME configuration"
- });
- }
+ // TODO: acme type currently doesn't require config obj, but add a check in the future if
+ // we have options
// Create enrollment configs and profile
const profile = await certificateProfileDAL.transaction(async (tx) => {
diff --git a/frontend/src/hooks/api/certificateProfiles/types.ts b/frontend/src/hooks/api/certificateProfiles/types.ts
index f3584b12dc..94d8d0c6d1 100644
--- a/frontend/src/hooks/api/certificateProfiles/types.ts
+++ b/frontend/src/hooks/api/certificateProfiles/types.ts
@@ -5,7 +5,7 @@ export type TCertificateProfile = {
certificateTemplateId: string;
slug: string;
description?: string;
- enrollmentType: "api" | "est";
+ enrollmentType: "api" | "est" | "acme";
estConfigId?: string;
apiConfigId?: string;
createdAt: string;
@@ -44,7 +44,7 @@ export type TCreateCertificateProfileDTO = {
certificateTemplateId: string;
slug: string;
description?: string;
- enrollmentType: "api" | "est";
+ enrollmentType: "api" | "est" | "acme";
estConfig?: {
disableBootstrapCaValidation?: boolean;
passphrase: string;
@@ -54,6 +54,7 @@ export type TCreateCertificateProfileDTO = {
autoRenew?: boolean;
renewBeforeDays?: number;
};
+ acmeConfig?: {};
};
export type TUpdateCertificateProfileDTO = {
@@ -69,6 +70,7 @@ export type TUpdateCertificateProfileDTO = {
autoRenew?: boolean;
renewBeforeDays?: number;
};
+ acmeConfig?: {};
};
export type TDeleteCertificateProfileDTO = {
@@ -81,7 +83,7 @@ export type TListCertificateProfilesDTO = {
offset?: number;
search?: string;
includeConfigs?: boolean;
- enrollmentType?: "api" | "est";
+ enrollmentType?: "api" | "est" | "acme";
};
export type TGetCertificateProfileByIdDTO = {
diff --git a/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/CreateProfileModal.tsx b/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/CreateProfileModal.tsx
index 245eadacca..eefc76a1dc 100644
--- a/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/CreateProfileModal.tsx
+++ b/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/CreateProfileModal.tsx
@@ -72,7 +72,8 @@ const createSchema = z
autoRenew: z.boolean().optional(),
renewBeforeDays: z.number().min(1).max(365).optional()
})
- .optional()
+ .optional(),
+ acmeConfig: z.object({}).optional()
})
.refine(
(data) => {
@@ -82,6 +83,9 @@ const createSchema = z
if (data.enrollmentType === "api" && !data.apiConfig) {
return false;
}
+ if (data.enrollmentType === "acme" && !data.acmeConfig) {
+ return false;
+ }
return true;
},
{
@@ -188,7 +192,8 @@ export const CreateProfileModal = ({ isOpen, onClose, profile, mode = "create" }
autoRenew: profile.apiConfig?.autoRenew || false,
renewBeforeDays: profile.apiConfig?.renewBeforeDays || 30
}
- : undefined
+ : undefined,
+ acmeConfig: profile.enrollmentType === "acme" ? {} : undefined
}
: {
slug: "",
@@ -199,7 +204,8 @@ export const CreateProfileModal = ({ isOpen, onClose, profile, mode = "create" }
apiConfig: {
autoRenew: false,
renewBeforeDays: 30
- }
+ },
+ acmeConfig: {}
}
});
@@ -230,7 +236,8 @@ export const CreateProfileModal = ({ isOpen, onClose, profile, mode = "create" }
autoRenew: profile.apiConfig?.autoRenew || false,
renewBeforeDays: profile.apiConfig?.renewBeforeDays || 30
}
- : undefined
+ : undefined,
+ acmeConfig: profile.enrollmentType === "acme" ? {} : undefined
});
}
}, [isEdit, profile, reset]);
@@ -249,6 +256,8 @@ export const CreateProfileModal = ({ isOpen, onClose, profile, mode = "create" }
updateData.estConfig = data.estConfig;
} else if (data.enrollmentType === "api" && data.apiConfig) {
updateData.apiConfig = data.apiConfig;
+ } else if (data.enrollmentType === "acme" && data.acmeConfig) {
+ updateData.acmeConfig = data.acmeConfig;
}
await updateProfile.mutateAsync(updateData);
@@ -549,6 +558,20 @@ export const CreateProfileModal = ({ isOpen, onClose, profile, mode = "create" }
</div>
)}
+ {/* ACME Configuration */}
+ {watchedEnrollmentType === "acme" && (
+ <div className="mb-4 space-y-4">
+ <Controller
+ control={control}
+ name="acmeConfig"
+ render={({ field, fieldState: { error } }) => (
+ <FormControl isError={Boolean(error)} errorText={error?.message}>
+ <div className="flex items-center gap-2">FIXME: ACME configuration</div>
+ </FormControl>
+ )}
+ />
+ </div>
+ )}
{watchedAutoRenew && (
<div className="mb-4 space-y-4">
<Controller
diff --git a/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/ProfileRow.tsx b/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/ProfileRow.tsx
index a9175c66c4..19638483bb 100644
--- a/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/ProfileRow.tsx
+++ b/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/ProfileRow.tsx
@@ -82,7 +82,8 @@ export const ProfileRow = ({ profile, onEditProfile, onDeleteProfile }: Props) =
const getEnrollmentTypeBadge = (enrollmentType: string) => {
const config = {
api: { variant: "ghost" as const, label: "API" },
- est: { variant: "ghost" as const, label: "EST" }
+ est: { variant: "ghost" as const, label: "EST" },
+ acme: { variant: "ghost" as const, label: "ACME" }
} as const;
const configKey = Object.keys(config).includes(enrollmentType)