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(pki): expose the latest renewal of a certificate so agents can follow renewals
Carlos Monastyrskif0239fe8e40a
diff --git a/backend/src/db/migrations/20260824173418_add-certificate-order-id.ts b/backend/src/db/migrations/20260824173418_add-certificate-order-id.tsnew file mode 100644index 0000000000..bffecda690--- /dev/null+++ b/backend/src/db/migrations/20260824173418_add-certificate-order-id.ts@@ -0,0 +1,37 @@+import { Knex } from "knex";++import { TableName } from "../schemas";++export async function up(knex: Knex): Promise<void> {+ if (await knex.schema.hasColumn(TableName.Certificate, "orderId")) return;++ await knex.schema.alterTable(TableName.Certificate, (t) => {+ t.uuid("orderId").notNullable().defaultTo(knex.raw("gen_random_uuid()"));+ t.index("orderId");+ });++ await knex.raw(`+ WITH RECURSIVE chain AS (+ SELECT id, "orderId"+ FROM "${TableName.Certificate}"+ WHERE "renewedFromCertificateId" IS NULL+ UNION ALL+ SELECT c.id, chain."orderId"+ FROM "${TableName.Certificate}" c+ INNER JOIN chain ON c."renewedFromCertificateId" = chain.id+ )+ UPDATE "${TableName.Certificate}" AS target+ SET "orderId" = chain."orderId"+ FROM chain+ WHERE target.id = chain.id+ AND target."orderId" <> chain."orderId"+ `);+}++export async function down(knex: Knex): Promise<void> {+ if (!(await knex.schema.hasColumn(TableName.Certificate, "orderId"))) return;++ await knex.schema.alterTable(TableName.Certificate, (t) => {+ t.dropColumn("orderId");+ });+}diff --git a/backend/src/db/schemas/certificates.ts b/backend/src/db/schemas/certificates.tsindex 67aaa17e8f..bdf4c9ec4e 100644--- a/backend/src/db/schemas/certificates.ts+++ b/backend/src/db/schemas/certificates.ts@@ -53,7 +53,8 @@ export const CertificatesSchema = z.object({hsmConnectorId: z.string().uuid().nullable().optional(),hsmKeyLabel: z.string().nullable().optional(),hsmPublicKeySpki: zodBuffer.nullable().optional(),- subjectDomainComponents: z.string().nullable().optional()+ subjectDomainComponents: z.string().nullable().optional(),+ orderId: z.string().uuid().default("00000000-0000-0000-0000-000000000000")});export type TCertificates = z.infer<typeof CertificatesSchema>;diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.tsindex c078361122..242649a29b 100644--- a/backend/src/lib/api-docs/constants.ts+++ b/backend/src/lib/api-docs/constants.ts@@ -2145,7 +2145,9 @@ export const CERTIFICATES = {GET: {id: "The ID of the certificate to get.",serialNumber: "The serial number of the certificate to get.",- hasPrivateKey: "Whether Infisical holds the private key for this certificate."+ hasPrivateKey: "Whether Infisical holds the private key for this certificate.",+ latestRenewalCertificateId:+ "The ID of the newest certificate that has replaced this one through renewal, or null if no newer replacement is available. Revoked certificates are never named, so this is null when this certificate has never been renewed and also when every renewal of it has since been revoked. Use this to follow renewals without walking the chain one certificate at a time."},RENEW: {id: "The ID of the certificate to renew.",diff --git a/backend/src/server/routes/v1/certificate-router.ts b/backend/src/server/routes/v1/certificate-router.tsindex d15aff98c9..1cab2692bd 100644--- a/backend/src/server/routes/v1/certificate-router.ts+++ b/backend/src/server/routes/v1/certificate-router.ts@@ -1349,7 +1349,7 @@ export const registerCertificateRouter = async (server: FastifyZodProvider) => {}),response: {200: z.object({- certificate: CertificatesSchema.extend({+ certificate: CertificatesSchema.omit({ orderId: true }).extend({subject: z.object({commonName: z.string().optional(),@@ -1378,6 +1378,12 @@ export const registerCertificateRouter = async (server: FastifyZodProvider) => {profileName: z.string().nullable().optional(),applicationName: z.string().nullable().optional(),hasPrivateKey: z.boolean().describe(CERTIFICATES.GET.hasPrivateKey),+ latestRenewalCertificateId: z+ .string()+ .uuid()+ .nullable()+ .optional()+ .describe(CERTIFICATES.GET.latestRenewalCertificateId),metadata: z.array(z.object({ key: z.string(), value: z.string() })).optional()})})@@ -1761,7 +1767,7 @@ export const registerCertificateRouter = async (server: FastifyZodProvider) => {}),response: {200: z.object({- certificate: CertificatesSchema+ certificate: CertificatesSchema.omit({ orderId: true })})}},@@ -1822,7 +1828,7 @@ export const registerCertificateRouter = async (server: FastifyZodProvider) => {}),response: {200: z.object({- certificate: CertificatesSchema+ certificate: CertificatesSchema.omit({ orderId: true })})}},diff --git a/backend/src/server/routes/v1/deprecated-certificate-router.ts b/backend/src/server/routes/v1/deprecated-certificate-router.tsindex fc71385884..899eea461c 100644--- a/backend/src/server/routes/v1/deprecated-certificate-router.ts+++ b/backend/src/server/routes/v1/deprecated-certificate-router.ts@@ -35,7 +35,7 @@ export const registerDeprecatedCertRouter = async (server: FastifyZodProvider) =}),response: {200: z.object({- certificate: CertificatesSchema+ certificate: CertificatesSchema.omit({ orderId: true })})}},@@ -534,7 +534,7 @@ export const registerDeprecatedCertRouter = async (server: FastifyZodProvider) =}),response: {200: z.object({- certificate: CertificatesSchema+ certificate: CertificatesSchema.omit({ orderId: true })})}},diff --git a/backend/src/server/routes/v1/pki-subscriber-router.ts b/backend/src/server/routes/v1/pki-subscriber-router.tsindex 68b32672aa..8249e3e583 100644--- a/backend/src/server/routes/v1/pki-subscriber-router.ts+++ b/backend/src/server/routes/v1/pki-subscriber-router.ts@@ -747,7 +747,7 @@ export const registerPkiSubscriberRouter = async (server: FastifyZodProvider) =>}),response: {200: z.object({- certificates: z.array(CertificatesSchema),+ certificates: z.array(CertificatesSchema.omit({ orderId: true })),totalCount: z.number()})}diff --git a/backend/src/server/routes/v1/project-router.ts b/backend/src/server/routes/v1/project-router.tsindex d1b6b5d8f7..969966ef69 100644--- a/backend/src/server/routes/v1/project-router.ts+++ b/backend/src/server/routes/v1/project-router.ts@@ -1274,7 +1274,7 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {}),response: {200: z.object({- certificates: z.array(CertificatesSchema.extend({ hasPrivateKey: z.boolean() })),+ certificates: z.array(CertificatesSchema.omit({ orderId: true }).extend({ hasPrivateKey: z.boolean() })),totalCount: z.number()})}@@ -1365,7 +1365,7 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {response: {200: z.object({certificates: z.array(- CertificatesSchema.extend({+ CertificatesSchema.omit({ orderId: true }).extend({hasPrivateKey: z.boolean(),caName: z.string().nullable().optional(),profileName: z.string().nullable().optional(),diff --git a/backend/src/server/routes/v2/deprecated-project-router.ts b/backend/src/server/routes/v2/deprecated-project-router.tsindex 71121d0784..078b5bc4c4 100644--- a/backend/src/server/routes/v2/deprecated-project-router.ts+++ b/backend/src/server/routes/v2/deprecated-project-router.ts@@ -392,7 +392,7 @@ export const registerDeprecatedProjectRouter = async (server: FastifyZodProvider}),response: {200: z.object({- certificates: z.array(CertificatesSchema),+ certificates: z.array(CertificatesSchema.omit({ orderId: true })),totalCount: z.number()})}diff --git a/backend/src/services/certificate-authority/acme/acme-certificate-authority-fns.ts b/backend/src/services/certificate-authority/acme/acme-certificate-authority-fns.tsindex f93106cc1a..aba2873825 100644--- a/backend/src/services/certificate-authority/acme/acme-certificate-authority-fns.ts+++ b/backend/src/services/certificate-authority/acme/acme-certificate-authority-fns.ts@@ -25,7 +25,7 @@ import { TCloudflareConnection } from "@app/services/app-connection/cloudflare/cimport { TDNSMadeEasyConnection } from "@app/services/app-connection/dns-made-easy/dns-made-easy-connection-types";import { TCertificateBodyDALFactory } from "@app/services/certificate/certificate-body-dal";import { TCertificateDALFactory } from "@app/services/certificate/certificate-dal";-import { extractCertificateFields } from "@app/services/certificate/certificate-fns";+import { extractCertificateFields, linkRenewedCertificate } from "@app/services/certificate/certificate-fns";import { TCertificateSecretDALFactory } from "@app/services/certificate/certificate-secret-dal";import {CertExtendedKeyUsage,@@ -138,7 +138,7 @@ type TAcmeCertificateAuthorityFnsDeps = {"create" | "transaction" | "findByIdWithAssociatedCa" | "updateById" | "findWithAssociatedCa" | "findById">;externalCertificateAuthorityDAL: Pick<TExternalCertificateAuthorityDALFactory, "create" | "update" | "findOne">;- certificateDAL: Pick<TCertificateDALFactory, "create" | "transaction" | "updateById">;+ certificateDAL: Pick<TCertificateDALFactory, "create" | "findById" | "transaction" | "updateById">;certificateBodyDAL: Pick<TCertificateBodyDALFactory, "create">;certificateSecretDAL: Pick<TCertificateSecretDALFactory, "create">;kmsService: Pick<@@ -156,7 +156,7 @@ type TOrderCertificateDeps = {appConnectionDAL: Pick<TAppConnectionDALFactory, "findById">;certificateAuthorityDAL: Pick<TCertificateAuthorityDALFactory, "findByIdWithAssociatedCa">;externalCertificateAuthorityDAL: Pick<TExternalCertificateAuthorityDALFactory, "update">;- certificateDAL: Pick<TCertificateDALFactory, "create" | "transaction" | "updateById">;+ certificateDAL: Pick<TCertificateDALFactory, "create" | "findById" | "transaction" | "updateById">;certificateBodyDAL: Pick<TCertificateBodyDALFactory, "create">;certificateSecretDAL: Pick<TCertificateSecretDALFactory, "create">;kmsService: Pick<@@ -600,7 +600,7 @@ export const executeAcmeOrder = async ();if (isRenewal && originalCertificateId) {- await certificateDAL.updateById(originalCertificateId, { renewedByCertificateId: cert.id }, innerTx);+ await linkRenewedCertificate(certificateDAL, originalCertificateId, cert.id, innerTx);}await certificateBodyDAL.create(diff --git a/backend/src/services/certificate-authority/adcs/adcs-certificate-authority-fns.ts b/backend/src/services/certificate-authority/adcs/adcs-certificate-authority-fns.tsindex 16367d4b5b..effb70f45b 100644--- a/backend/src/services/certificate-authority/adcs/adcs-certificate-authority-fns.ts+++ b/backend/src/services/certificate-authority/adcs/adcs-certificate-authority-fns.ts@@ -21,6 +21,7 @@ import { AppConnection } from "@app/services/app-connection/app-connection-enumsimport { TAppConnectionServiceFactory } from "@app/services/app-connection/app-connection-service";import { TCertificateBodyDALFactory } from "@app/services/certificate/certificate-body-dal";import { TCertificateDALFactory } from "@app/services/certificate/certificate-dal";+import { linkRenewedCertificate } from "@app/services/certificate/certificate-fns";import { TCertificateSecretDALFactory } from "@app/services/certificate/certificate-secret-dal";import {CertExtendedKeyUsage,@@ -149,7 +150,7 @@ type TADCSCertificateAuthorityFnsDeps = {"create" | "transaction" | "findByIdWithAssociatedCa" | "updateById" | "findWithAssociatedCa" | "findById">;externalCertificateAuthorityDAL: Pick<TExternalCertificateAuthorityDALFactory, "create" | "update">;- certificateDAL: Pick<TCertificateDALFactory, "create" | "findOne" | "transaction" | "updateById">;+ certificateDAL: Pick<TCertificateDALFactory, "create" | "findById" | "findOne" | "transaction" | "updateById">;certificateBodyDAL: Pick<TCertificateBodyDALFactory, "create">;certificateSecretDAL: Pick<TCertificateSecretDALFactory, "create">;kmsService: Pick<@@ -585,7 +586,7 @@ export const ADCSCertificateAuthorityFns = ({certificateId = cert.id;if (isRenewal && originalCertificateId) {- await certificateDAL.updateById(originalCertificateId, { renewedByCertificateId: cert.id }, tx);+ await linkRenewedCertificate(certificateDAL, originalCertificateId, cert.id, tx);}await certificateBodyDAL.create(diff --git a/backend/src/services/certificate-authority/aws-acm-public-ca/aws-acm-public-ca-certificate-authority-fns.ts b/backend/src/services/certificate-authority/aws-acm-public-ca/aws-acm-public-ca-certificate-authority-fns.tsindex be6a01d1cb..0d6c64b029 100644--- a/backend/src/services/certificate-authority/aws-acm-public-ca/aws-acm-public-ca-certificate-authority-fns.ts+++ b/backend/src/services/certificate-authority/aws-acm-public-ca/aws-acm-public-ca-certificate-authority-fns.ts@@ -26,7 +26,7 @@ import { AppConnection, AWSRegion } from "@app/services/app-connection/app-conneimport { TAppConnectionServiceFactory } from "@app/services/app-connection/app-connection-service";import { TCertificateBodyDALFactory } from "@app/services/certificate/certificate-body-dal";import { TCertificateDALFactory } from "@app/services/certificate/certificate-dal";-import { extractCertificateFields } from "@app/services/certificate/certificate-fns";+import { extractCertificateFields, linkRenewedCertificate } from "@app/services/certificate/certificate-fns";import { TCertificateSecretDALFactory } from "@app/services/certificate/certificate-secret-dal";import {CertExtendedKeyUsage,@@ -753,7 +753,7 @@ export const AwsAcmPublicCaCertificateAuthorityFns = ({newCertId = cert.id;if (isRenewal && originalCertificateId) {- await certificateDAL.updateById(originalCertificateId, { renewedByCertificateId: cert.id }, tx);+ await linkRenewedCertificate(certificateDAL, originalCertificateId, cert.id, tx);}await certificateBodyDAL.create(diff --git a/backend/src/services/certificate-authority/aws-pca/aws-pca-certificate-authority-fns.ts b/backend/src/services/certificate-authority/aws-pca/aws-pca-certificate-authority-fns.tsindex 9434e0e428..69efbe1f15 100644--- a/backend/src/services/certificate-authority/aws-pca/aws-pca-certificate-authority-fns.ts+++ b/backend/src/services/certificate-authority/aws-pca/aws-pca-certificate-authority-fns.ts@@ -29,7 +29,7 @@ import { getAwsConnectionConfig } from "@app/services/app-connection/aws/aws-conimport { TAwsConnection } from "@app/services/app-connection/aws/aws-connection-types";import { TCertificateBodyDALFactory } from "@app/services/certificate/certificate-body-dal";import { TCertificateDALFactory } from "@app/services/certificate/certificate-dal";-import { extractCertificateFields } from "@app/services/certificate/certificate-fns";+import { extractCertificateFields, linkRenewedCertificate } from "@app/services/certificate/certificate-fns";import { TCertificateSecretDALFactory } from "@app/services/certificate/certificate-secret-dal";import {CertExtendedKeyUsage,@@ -176,7 +176,7 @@ type TAwsPcaCertificateAuthorityFnsDeps = {"create" | "transaction" | "findByIdWithAssociatedCa" | "updateById" | "findWithAssociatedCa" | "findById">;externalCertificateAuthorityDAL: Pick<TExternalCertificateAuthorityDALFactory, "create" | "update">;- certificateDAL: Pick<TCertificateDALFactory, "create" | "transaction" | "updateById">;+ certificateDAL: Pick<TCertificateDALFactory, "create" | "findById" | "transaction" | "updateById">;certificateBodyDAL: Pick<TCertificateBodyDALFactory, "create">;certificateSecretDAL: Pick<TCertificateSecretDALFactory, "create">;kmsService: Pick<@@ -830,7 +830,7 @@ export const AwsPcaCertificateAuthorityFns = ({certificateId = cert.id;if (isRenewal && originalCertificateId) {- await certificateDAL.updateById(originalCertificateId, { renewedByCertificateId: cert.id }, tx);+ await linkRenewedCertificate(certificateDAL, originalCertificateId, cert.id, tx);}await certificateBodyDAL.create(diff --git a/backend/src/services/certificate-authority/azure-ad-cs/azure-ad-cs-certificate-authority-fns.ts b/backend/src/services/certificate-authority/azure-ad-cs/azure-ad-cs-certificate-authority-fns.tsindex ed137219fe..90334ecea2 100644--- a/backend/src/services/certificate-authority/azure-ad-cs/azure-ad-cs-certificate-authority-fns.ts+++ b/backend/src/services/certificate-authority/azure-ad-cs/azure-ad-cs-certificate-authority-fns.ts@@ -17,7 +17,7 @@ import {} from "@app/services/app-connection/azure-adcs/azure-adcs-connection-fns";import { TCertificateBodyDALFactory } from "@app/services/certificate/certificate-body-dal";import { TCertificateDALFactory } from "@app/services/certificate/certificate-dal";-import { splitPemChain } from "@app/services/certificate/certificate-fns";+import { linkRenewedCertificate, splitPemChain } from "@app/services/certificate/certificate-fns";import { TCertificateSecretDALFactory } from "@app/services/certificate/certificate-secret-dal";import {CertExtendedKeyUsage,@@ -109,7 +109,7 @@ type TAzureAdCsCertificateAuthorityFnsDeps = {"create" | "transaction" | "findByIdWithAssociatedCa" | "updateById" | "findWithAssociatedCa" | "findById">;externalCertificateAuthorityDAL: Pick<TExternalCertificateAuthorityDALFactory, "create" | "update">;- certificateDAL: Pick<TCertificateDALFactory, "create" | "transaction" | "updateById">;+ certificateDAL: Pick<TCertificateDALFactory, "create" | "findById" | "transaction" | "updateById">;certificateBodyDAL: Pick<TCertificateBodyDALFactory, "create">;certificateSecretDAL: Pick<TCertificateSecretDALFactory, "create">;kmsService: Pick<@@ -1439,7 +1439,7 @@ export const AzureAdCsCertificateAuthorityFns = ({certificateId = cert.id;if (isRenewal && originalCertificateId) {- await certificateDAL.updateById(originalCertificateId, { renewedByCertificateId: cert.id }, tx);+ await linkRenewedCertificate(certificateDAL, originalCertificateId, cert.id, tx);}await certificateBodyDAL.create(diff --git a/backend/src/services/certificate-authority/digicert/digicert-certificate-authority-fns.ts b/backend/src/services/certificate-authority/digicert/digicert-certificate-authority-fns.tsindex 8e3e1660d1..2eea7bf0e9 100644--- a/backend/src/services/certificate-authority/digicert/digicert-certificate-authority-fns.ts+++ b/backend/src/services/certificate-authority/digicert/digicert-certificate-authority-fns.ts@@ -14,6 +14,7 @@ import { TAppConnectionServiceFactory } from "@app/services/app-connection/app-cimport { DIGICERT_CS_PRODUCT_NAME_IDS } from "@app/services/app-connection/digicert/digicert-connection-fns";import { TCertificateBodyDALFactory } from "@app/services/certificate/certificate-body-dal";import { TCertificateDALFactory } from "@app/services/certificate/certificate-dal";+import { linkRenewedCertificate } from "@app/services/certificate/certificate-fns";import { TCertificateSecretDALFactory } from "@app/services/certificate/certificate-secret-dal";import { CertKeyAlgorithm, CertStatus, CrlReason, TAltNameType } from "@app/services/certificate/certificate-types";import {@@ -62,7 +63,7 @@ type TDigiCertCertificateAuthorityFnsDeps = {"create" | "transaction" | "findByIdWithAssociatedCa" | "updateById" | "findWithAssociatedCa" | "findById">;externalCertificateAuthorityDAL: Pick<TExternalCertificateAuthorityDALFactory, "create" | "update">;- certificateDAL: Pick<TCertificateDALFactory, "create" | "transaction" | "updateById" | "findOne">;+ certificateDAL: Pick<TCertificateDALFactory, "create" | "findById" | "transaction" | "updateById" | "findOne">;certificateBodyDAL: Pick<TCertificateBodyDALFactory, "create">;certificateSecretDAL: Pick<TCertificateSecretDALFactory, "create">;kmsService: Pick<@@ -550,7 +551,7 @@ export const DigiCertCertificateAuthorityFns = ({);if (isRenewal && originalCertificateId) {- await certificateDAL.updateById(originalCertificateId, { renewedByCertificateId: cert.id }, tx);+ await linkRenewedCertificate(certificateDAL, originalCertificateId, cert.id, tx);}await certificateBodyDAL.create(diff --git a/backend/src/services/certificate-authority/godaddy/godaddy-certificate-authority-fns.ts b/backend/src/services/certificate-authority/godaddy/godaddy-certificate-authority-fns.tsindex 599367904b..179ecdb025 100644--- a/backend/src/services/certificate-authority/godaddy/godaddy-certificate-authority-fns.ts+++ b/backend/src/services/certificate-authority/godaddy/godaddy-certificate-authority-fns.ts@@ -17,6 +17,7 @@ import { getGoDaddyApiBaseUrl } from "@app/services/app-connection/godaddy/godadimport { TGoDaddyConnection } from "@app/services/app-connection/godaddy/godaddy-connection-types";import { TCertificateBodyDALFactory } from "@app/services/certificate/certificate-body-dal";import { TCertificateDALFactory } from "@app/services/certificate/certificate-dal";+import { linkRenewedCertificate } from "@app/services/certificate/certificate-fns";import { TCertificateSecretDALFactory } from "@app/services/certificate/certificate-secret-dal";import { CertKeyAlgorithm, CertStatus, CrlReason } from "@app/services/certificate/certificate-types";import {@@ -49,7 +50,7 @@ type TGoDaddyCertificateAuthorityFnsDeps = {"create" | "transaction" | "findByIdWithAssociatedCa" | "updateById" | "findWithAssociatedCa" | "findById">;externalCertificateAuthorityDAL: Pick<TExternalCertificateAuthorityDALFactory, "create" | "update">;- certificateDAL: Pick<TCertificateDALFactory, "create" | "transaction" | "updateById" | "findOne">;+ certificateDAL: Pick<TCertificateDALFactory, "create" | "findById" | "transaction" | "updateById" | "findOne">;certificateBodyDAL: Pick<TCertificateBodyDALFactory, "create">;certificateSecretDAL: Pick<TCertificateSecretDALFactory, "create">;kmsService: Pick<@@ -577,7 +578,7 @@ export const GoDaddyCertificateAuthorityFns = ({);if (isRenewal && originalCertificateId) {- await certificateDAL.updateById(originalCertificateId, { renewedByCertificateId: cert.id }, tx);+ await linkRenewedCertificate(certificateDAL, originalCertificateId, cert.id, tx);}await certificateBodyDAL.create(diff --git a/backend/src/services/certificate-authority/venafi-tpp/venafi-tpp-certificate-authority-fns.ts b/backend/src/services/certificate-authority/venafi-tpp/venafi-tpp-certificate-authority-fns.tsindex eff8df0272..712edb5bec 100644--- a/backend/src/services/certificate-authority/venafi-tpp/venafi-tpp-certificate-authority-fns.ts+++ b/backend/src/services/certificate-authority/venafi-tpp/venafi-tpp-certificate-authority-fns.ts@@ -23,7 +23,7 @@ import {} from "@app/services/app-connection/venafi-tpp/venafi-tpp-connection-fns";import { TCertificateBodyDALFactory } from "@app/services/certificate/certificate-body-dal";import { TCertificateDALFactory } from "@app/services/certificate/certificate-dal";-import { splitPemChain } from "@app/services/certificate/certificate-fns";+import { linkRenewedCertificate, splitPemChain } from "@app/services/certificate/certificate-fns";import { TCertificateSecretDALFactory } from "@app/services/certificate/certificate-secret-dal";import {CertExtendedKeyUsage,@@ -344,7 +344,7 @@ type TVenafiTppCertificateAuthorityFnsDeps = {"create" | "transaction" | "findByIdWithAssociatedCa" | "updateById" | "findWithAssociatedCa" | "findById">;externalCertificateAuthorityDAL: Pick<TExternalCertificateAuthorityDALFactory, "create" | "update">;- certificateDAL: Pick<TCertificateDALFactory, "create" | "transaction" | "updateById">;+ certificateDAL: Pick<TCertificateDALFactory, "create" | "findById" | "transaction" | "updateById">;certificateBodyDAL: Pick<TCertificateBodyDALFactory, "create">;certificateSecretDAL: Pick<TCertificateSecretDALFactory, "create">;kmsService: Pick<TKmsServiceFactory, "encryptWithKmsKey" | "generateKmsKey" | "createCipherPairWithDataKey">;@@ -866,7 +866,7 @@ export const VenafiTppCertificateAuthorityFns = ({certificateId = cert.id;if (isRenewal && originalCertificateId) {- await certificateDAL.updateById(originalCertificateId, { renewedByCertificateId: cert.id }, tx);+ await linkRenewedCertificate(certificateDAL, originalCertificateId, cert.id, tx);}await certificateBodyDAL.create(diff --git a/backend/src/services/certificate-v3/certificate-renewal-service.ts b/backend/src/services/certificate-v3/certificate-renewal-service.tsindex 978e0ac9c2..19cc8c124d 100644--- a/backend/src/services/certificate-v3/certificate-renewal-service.ts+++ b/backend/src/services/certificate-v3/certificate-renewal-service.ts@@ -237,10 +237,13 @@ export const certificateRenewalServiceFactory = ({renewedFromCertificateId?: string;renewBeforeDays?: number;applicationId?: string | null;+ orderId?: string;} = isRenewalLinkPreset? {}: { profileId: originalCert.profileId || null, renewedFromCertificateId: originalCert.id };+ if (originalCert.orderId) renewalUpdate.orderId = originalCert.orderId;+if (finalRenewBeforeDays !== undefined) renewalUpdate.renewBeforeDays = finalRenewBeforeDays;if (originalCert.applicationId) renewalUpdate.applicationId = originalCert.applicationId;if (Object.keys(renewalUpdate).length > 0) {diff --git a/backend/src/services/certificate-v3/certificate-v3-service.test.ts b/backend/src/services/certificate-v3/certificate-v3-service.test.tsindex 69360fcc26..39e1730363 100644--- a/backend/src/services/certificate-v3/certificate-v3-service.test.ts+++ b/backend/src/services/certificate-v3/certificate-v3-service.test.ts@@ -95,7 +95,8 @@ describe("CertificateV3Service", () => {commonName: "test.example.com",status: "ACTIVE",source: "issued",- keySource: "infisical"+ keySource: "infisical",+ orderId: "00000000-0000-0000-0000-000000000000"}),transaction: vi.fn().mockImplementation(async (callback: (tx: any) => Promise<unknown>) => {const mockTx = {};@@ -471,7 +472,8 @@ describe("CertificateV3Service", () => {revokedAt: null,revokedBy: null,source: "issued",- keySource: "infisical"+ keySource: "infisical",+ orderId: "00000000-0000-0000-0000-000000000000"};vi.mocked(mockCertificateProfileDAL.findByIdWithConfigs).mockResolvedValue(mockProfile);@@ -613,7 +615,8 @@ describe("CertificateV3Service", () => {pkiSubscriberId: null,profileId: null,source: "issued",- keySource: "infisical"+ keySource: "infisical",+ orderId: "00000000-0000-0000-0000-000000000000"};const camelCaseRequest = {@@ -708,7 +711,8 @@ describe("CertificateV3Service", () => {pkiSubscriberId: null,profileId: null,source: "issued",- keySource: "infisical"+ keySource: "infisical",+ orderId: "00000000-0000-0000-0000-000000000000"});vi.mocked(mockCertificateDAL.updateById).mockResolvedValue(mockCertRecord);@@ -912,7 +916,8 @@ describe("CertificateV3Service", () => {pkiSubscriberId: null,profileId: null,source: "issued",- keySource: "infisical"+ keySource: "infisical",+ orderId: "00000000-0000-0000-0000-000000000000"};const mockPolicy = {@@ -1308,7 +1313,8 @@ describe("CertificateV3Service", () => {pkiSubscriberId: null,profileId: null,source: "issued",- keySource: "infisical"+ keySource: "infisical",+ orderId: "00000000-0000-0000-0000-000000000000"});vi.mocked(mockCertificateDAL.updateById).mockResolvedValue({id: "cert-1",@@ -1332,7 +1338,8 @@ describe("CertificateV3Service", () => {pkiSubscriberId: null,profileId: null,source: "issued",- keySource: "infisical"+ keySource: "infisical",+ orderId: "00000000-0000-0000-0000-000000000000"});vi.mocked(mockCertificateDAL.findById).mockResolvedValue({id: "cert-1",@@ -1356,7 +1363,8 @@ describe("CertificateV3Service", () => {pkiSubscriberId: null,profileId: null,source: "issued",- keySource: "infisical"+ keySource: "infisical",+ orderId: "00000000-0000-0000-0000-000000000000"});vi.mocked(mockCertificateDAL.transaction).mockImplementation(async (callback: (tx: any) => Promise<unknown>) => {return callback(undefined as any);@@ -1475,7 +1483,8 @@ describe("CertificateV3Service", () => {pkiSubscriberId: null,profileId: null,source: "issued",- keySource: "infisical"+ keySource: "infisical",+ orderId: "00000000-0000-0000-0000-000000000000"});vi.mocked(mockCertificateDAL.updateById).mockResolvedValue({id: "cert-1",@@ -1499,7 +1508,8 @@ describe("CertificateV3Service", () => {pkiSubscriberId: null,profileId: null,source: "issued",- keySource: "infisical"+ keySource: "infisical",+ orderId: "00000000-0000-0000-0000-000000000000"});vi.mocked(mockCertificateDAL.findById).mockResolvedValue({id: "cert-1",@@ -1523,7 +1533,8 @@ describe("CertificateV3Service", () => {pkiSubscriberId: null,profileId: null,source: "issued",- keySource: "infisical"+ keySource: "infisical",+ orderId: "00000000-0000-0000-0000-000000000000"});vi.mocked(mockCertificateDAL.transaction).mockImplementation(async (callback: (tx: any) => Promise<unknown>) => {return callback(undefined as any);@@ -1642,7 +1653,8 @@ describe("CertificateV3Service", () => {pkiSubscriberId: null,profileId: null,source: "issued",- keySource: "infisical"+ keySource: "infisical",+ orderId: "00000000-0000-0000-0000-000000000000"});vi.mocked(mockCertificateDAL.updateById).mockResolvedValue({id: "cert-1",@@ -1666,7 +1678,8 @@ describe("CertificateV3Service", () => {pkiSubscriberId: null,profileId: null,source: "issued",- keySource: "infisical"+ keySource: "infisical",+ orderId: "00000000-0000-0000-0000-000000000000"});vi.mocked(mockCertificateDAL.findById).mockResolvedValue({id: "cert-1",@@ -1690,7 +1703,8 @@ describe("CertificateV3Service", () => {pkiSubscriberId: null,profileId: null,source: "issued",- keySource: "infisical"+ keySource: "infisical",+ orderId: "00000000-0000-0000-0000-000000000000"});vi.mocked(mockCertificateDAL.transaction).mockImplementation(async (callback: (tx: any) => Promise<unknown>) => {return callback(undefined as any);@@ -1809,7 +1823,8 @@ describe("CertificateV3Service", () => {pkiSubscriberId: null,profileId: null,source: "issued",- keySource: "infisical"+ keySource: "infisical",+ orderId: "00000000-0000-0000-0000-000000000000"});vi.mocked(mockCertificateDAL.updateById).mockResolvedValue({id: "cert-1",@@ -1833,7 +1848,8 @@ describe("CertificateV3Service", () => {pkiSubscriberId: null,profileId: null,source: "issued",- keySource: "infisical"+ keySource: "infisical",+ orderId: "00000000-0000-0000-0000-000000000000"});vi.mocked(mockCertificateDAL.findById).mockResolvedValue({id: "cert-1",@@ -1857,7 +1873,8 @@ describe("CertificateV3Service", () => {pkiSubscriberId: null,profileId: null,source: "issued",- keySource: "infisical"+ keySource: "infisical",+ orderId: "00000000-0000-0000-0000-000000000000"});vi.mocked(mockCertificateDAL.transaction).mockImplementation(async (callback: (tx: any) => Promise<unknown>) => {return callback(undefined as any);@@ -1906,7 +1923,8 @@ describe("CertificateV3Service", () => {keyAlgorithm: "RSA_2048",signatureAlgorithm: "RSA-SHA256",source: "issued",- keySource: "infisical"+ keySource: "infisical",+ orderId: "00000000-0000-0000-0000-000000000000"};const mockProfile = {@@ -2048,7 +2066,8 @@ describe("CertificateV3Service", () => {{profileId: "profile-123",renewBeforeDays: 14,- renewedFromCertificateId: "cert-123"+ renewedFromCertificateId: "cert-123",+ orderId: "00000000-0000-0000-0000-000000000000"},{});diff --git a/backend/src/services/certificate/certificate-dal.ts b/backend/src/services/certificate/certificate-dal.tsindex 6f24bcdba9..8a0451273a 100644--- a/backend/src/services/certificate/certificate-dal.ts+++ b/backend/src/services/certificate/certificate-dal.ts@@ -45,6 +45,8 @@ const toLegacyExtendedKeyUsageForQuery = (usage: string): string => {}};+const MAX_RENEWAL_CHAIN_DEPTH = 1000;+export const certificateDALFactory = (db: TDbClient) => {const certificateOrm = ormify(db, TableName.Certificate);@@ -742,6 +744,48 @@ export const certificateDALFactory = (db: TDbClient) => {type TCertificateLookupFilter = { id: string; serialNumber?: never } | { id?: never; serialNumber: string };+ const findLatestRenewalOf = async (+ anchor: { id: string; orderId: string },+ tx?: Knex+ ): Promise<string | null> => {+ try {+ // Walks the anchor's own descendants rather than the whole order. A certificate renewed twice+ // leaves two branches sharing one orderId, and the sibling branch never replaced this anchor,+ // so picking the newest row in the order can hand back a certificate for a different name.+ const result = await (tx || db.replicaNode()).raw(+ `+ WITH RECURSIVE descendants AS (+ SELECT id, "createdAt", status, "notAfter", 1 AS depth+ FROM ??+ WHERE "renewedFromCertificateId" = ? AND "orderId" = ?+ UNION ALL+ SELECT c.id, c."createdAt", c.status, c."notAfter", d.depth + 1+ FROM ?? c+ INNER JOIN descendants d ON c."renewedFromCertificateId" = d.id+ WHERE c."orderId" = ? AND d.depth < ?+ )+ SELECT id FROM descendants+ WHERE status <> ? AND "notAfter" > NOW()+ ORDER BY "createdAt" DESC, id DESC+ LIMIT 1+ `,+ [+ TableName.Certificate,+ anchor.id,+ anchor.orderId,+ TableName.Certificate,+ anchor.orderId,+ MAX_RENEWAL_CHAIN_DEPTH,+ CertStatus.REVOKED+ ]+ );++ return (result.rows as { id: string }[])[0]?.id ?? null;+ } catch (error) {+ throw new DatabaseError({ error, name: "Find latest renewal of certificate" });+ }+ };+const findWithFullDetails = async (filter: TCertificateLookupFilter,tx?: Knex@@ -1213,6 +1257,7 @@ export const certificateDALFactory = (db: TDbClient) => {getOriginatingRequestByCertId,findWithPrivateKeyInfo,findWithFullDetails,+ findLatestRenewalOf,getDashboardStats,getActivityTrend,getPqcTrenddiff --git a/backend/src/services/certificate/certificate-fns.ts b/backend/src/services/certificate/certificate-fns.tsindex d954f7ca38..1d285bec25 100644--- a/backend/src/services/certificate/certificate-fns.ts+++ b/backend/src/services/certificate/certificate-fns.ts@@ -1,4 +1,5 @@import * as x509 from "@peculiar/x509";+import { Knex } from "knex";import forge from "node-forge";import RE2 from "re2";@@ -7,6 +8,7 @@ import { BadRequestError, NotFoundError } from "@app/lib/errors";import { extractDnParts } from "../certificate-authority/certificate-authority-fns";import { getProjectKmsCertificateKeyId } from "../project/project-fns";+import type { TCertificateDALFactory } from "./certificate-dal";import {CertExtendedKeyUsage,CertExtendedKeyUsageOIDToName,@@ -401,3 +403,18 @@ export const extractCertificateFields = (decryptedCertificate: Buffer) => {...(parsed.extendedKeyUsages && { extendedKeyUsages: parsed.extendedKeyUsages })};};++export const linkRenewedCertificate = async (+ certificateDAL: Pick<TCertificateDALFactory, "findById" | "updateById">,+ originalCertificateId: string,+ renewedCertificateId: string,+ tx?: Knex+) => {+ const originalCertificate = await certificateDAL.findById(originalCertificateId, tx);++ if (originalCertificate?.orderId) {+ await certificateDAL.updateById(renewedCertificateId, { orderId: originalCertificate.orderId }, tx);+ }++ await certificateDAL.updateById(originalCertificateId, { renewedByCertificateId: renewedCertificateId }, tx);+};diff --git a/backend/src/services/certificate/certificate-service.ts b/backend/src/services/certificate/certificate-service.tsindex f6a79fda5e..b27bf024f4 100644--- a/backend/src/services/certificate/certificate-service.ts+++ b/backend/src/services/certificate/certificate-service.ts@@ -87,6 +87,7 @@ type TCertificateServiceFactoryDep = {| "create"| "findById"| "findWithFullDetails"+ | "findLatestRenewalOf"| "updateById">;pkiApplicationDAL: Pick<TPkiApplicationDALFactory, "findById">;@@ -271,6 +272,8 @@ export const certificateServiceFactory = ({}}+ const latestRenewalCertificateId = await certificateDAL.findLatestRenewalOf(cert);+return {cert: {...cert,@@ -280,6 +283,7 @@ export const certificateServiceFactory = ({caName,profileName,applicationName,+ latestRenewalCertificateId,metadata: certMetadata}};diff --git a/docs/integrations/platforms/certificate-agent.mdx b/docs/integrations/platforms/certificate-agent.mdxindex c7cccf2813..964db0f814 100644--- a/docs/integrations/platforms/certificate-agent.mdx+++ b/docs/integrations/platforms/certificate-agent.mdx@@ -13,9 +13,12 @@ description: "Learn how to use Infisical CLI Agent to manage certificates automaThe Infisical Agent is a client daemon that is packaged into the [Infisical CLI](/cli/overview).It can be used to request a certificate from Infisical using the [API enrollment method](/documentation/platform/pki/enrollment-methods/api) configured on a [certificate profile](/documentation/platform/pki/certificates/profiles), persist it to a specified path on the filesystem, and automatically monitor and renew it before expiration.+It can also run in distribution mode, where it fetches a certificate that already exists in Infisical by ID instead of requesting a new one. This lets many machines share a single centrally managed certificate, such as a wildcard certificate, without each of them triggering an issuance against the certificate authority.+The Infisical Agent is notable:- Automating certificate management: The agent can request, persist, monitor, and renew certificates from Infisical automatically without manual intervention. It also supports post-event hooks to execute custom commands after certificate issuance, renewal, or failure events.+- Distributing a shared certificate: The agent can deliver an existing certificate to many machines and pick up server-side renewals of it automatically.- Leveraging workload identity: The agent can authenticate with Infisical as a [machine identity](/documentation/platform/identities/machine-identities) using an infrastructure-native authentication method such as [AWS Auth](/documentation/platform/identities/aws-auth), [Azure Auth](/documentation/platform/identities/azure-auth), [GCP Auth](/documentation/platform/identities/gcp-auth), [Kubernetes Auth](/documentation/platform/identities/kubernetes-auth), etc.The typical workflow for using the agent involves installing the Infisical CLI on the target machine, creating a configuration file defining the certificate to request and how it should be managed, and then starting the agent with that configuration so it can request, persist, monitor, and renew the certificate before it expires.@@ -290,8 +293,9 @@ The table below provides a complete list of parameters that can be configured in| Parameter | Required | Description || ------------------------------------ | ------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |-| `profile-name` | Yes | The name of the [certificate profile](/documentation/platform/pki/certificates/profiles) to request a certificate against (e.g., `web-server-12345`) |-| `project-slug` | Yes | The slug of the project to request a certificate against (e.g., `my-project-slug`) |+| `certificate-id` | Conditional | The ID of an existing certificate in Infisical to deliver instead of requesting a new one. See [Distributing an existing certificate](/integrations/platforms/certificate-agent#distributing-an-existing-certificate). Cannot be combined with `profile-name`, `project-slug`, `application-name`, `attributes`, or a CSR. |+| `profile-name` | Conditional | The name of the [certificate profile](/documentation/platform/pki/certificates/profiles) to request a certificate against (e.g., `web-server-12345`). Not used when `certificate-id` is set. |+| `project-slug` | Conditional | The slug of the project to request a certificate against (e.g., `my-project-slug`). Not used when `certificate-id` is set. || `common-name` | Optional | The common name for the certificate (e.g. `www.example.com`) || `alt-names` | Optional | The list of subject alternative names for the certificate (e.g., `["www.example.com", "api.example.com"]`) || `ttl` | Optional (uses profile default if not specified) | The time-to-live duration for the certificate, specified as a duration string (e.g. `72h`, `90d`, `1y`, etc.) |@@ -307,8 +311,9 @@ The table below provides a complete list of parameters that can be configured in| `file-output.chain.path` | Optional | The path to store the certificate chain in the filesystem. || `file-output.chain.permission` | Optional (defaults to `0600`) | The octal permissions for the chain file (e.g. `0644`) || `file-output.chain.omit-root` | Optional (defaults to `true`) | Whether to exclude the root CA certificate from the returned certificate chain |-| `lifecycle.renew-before-expiry` | Optional (auto-renewal is disabled if not set) | Duration before certificate expiration when renewal checks should begin, specified as a duration string (e.g. `72h`, `90d`, `1y`, etc.) |+| `lifecycle.renew-before-expiry` | Optional (auto-renewal is disabled if not set) | Duration before certificate expiration when renewal checks should begin, specified as a duration string (e.g. `72h`, `90d`, `1y`, etc.). Ignored when `certificate-id` is set, because the agent delivers a certificate rather than renewing one. || `lifecycle.status-check-interval` | Optional (defaults to `10s`) | How frequently the agent checks certificate status and renewal needs, specified as a duration string (e.g. `10s`, `30m`, `1d`, etc.) |+| `lifecycle.use-latest` | Optional (defaults to `false`) | Whether the agent should deliver the most recent renewal of the certificate named by `certificate-id` instead of that certificate itself. Only valid together with `certificate-id`. || `post-hooks.on-issuance.command` | Optional | The shell command to execute after a certificate is successfully issued for the first time (e.g., `systemctl reload nginx`, `/usr/local/bin/reload-service.sh`) || `post-hooks.on-issuance.timeout` | Optional (defaults to `30`) | Maximum execution time in seconds for the on-issuance post-hook command before it is terminated (e.g., `30`, `60`, `120`) || `post-hooks.on-renewal.command` | Optional | The shell command to execute after a certificate is successfully renewed (e.g., `systemctl reload nginx`, `docker restart web-server`) |@@ -316,6 +321,93 @@ The table below provides a complete list of parameters that can be configured in| `post-hooks.on-failure.command` | Optional | The shell command to execute when certificate issuance or renewal fails (e.g., `logger 'Certificate renewal failed'`, `/usr/local/bin/alert.sh`) || `post-hooks.on-failure.timeout` | Optional (defaults to `30`) | Maximum execution time in seconds for the on-failure post-hook command before it is terminated (e.g., `10`, `30`, `60`) |+### Distributing an existing certificate++By default, the agent requests a new certificate from a certificate profile each time it starts on a new machine. That suits machines that each need their own identity. It does not suit machines meant to serve the same certificate: ten web servers behind a load balancer terminating TLS for `*.example.com` should share one wildcard certificate, not hold ten.++Set `certificate-id` to the ID of a certificate that already exists in Infisical and the agent delivers that certificate instead of issuing one. Nothing reaches the certificate authority, and your certificate inventory does not grow with your fleet.++Copy the ID from the certificate's page in Infisical, or take it from the response of the [issue certificate](/api-reference/endpoints/certificates/create-certificate) endpoint.++```yaml distribution-agent-config.yaml+version: v2++infisical:+ address: "https://app.infisical.com"++auth:+ type: "universal-auth"+ config:+ client-id: "your-client-id"+ client-secret: "your-client-secret"++certificates:+ - certificate-id: "8f2a1c40-5f3b-4e7a-9c21-b3d4e5f60718"+ lifecycle:+ status-check-interval: "6h"+ file-output:+ certificate:+ path: "/etc/ssl/certs/wildcard.crt"+ permission: "0644"+ chain:+ path: "/etc/ssl/certs/wildcard-chain.crt"+ permission: "0644"+ private-key:+ path: "/etc/ssl/private/wildcard.key"+ permission: "0600"+```++`certificate-id` replaces the fields that describe a new certificate. Combining it with `profile-name`, `project-slug`, `application-name`, `attributes`, `csr`, or `csr-path` is rejected when the agent starts, rather than silently ignored.++<Warning>+ `lifecycle.renew-before-expiry` has no effect in distribution mode. The agent delivers a certificate, it does not renew one, so a renewal threshold has nothing to act on. The agent logs a warning and carries on. To have it deliver renewals made in Infisical, use [`lifecycle.use-latest`](/integrations/platforms/certificate-agent#keeping-up-with-renewals) instead.+</Warning>++<Note>+ The machine identity the agent authenticates as needs permission to read the certificate you point it at. Without it, the agent reports the authorization failure and leaves any files it has already written untouched.+</Note>++#### Keeping up with renewals++[Renewing a certificate](/documentation/platform/pki/applications/certificate-renewal) produces a new certificate with its own ID, and the certificate it replaced stays valid until its own expiry. An agent pinned to the original ID therefore keeps serving the original until it expires.++Set `lifecycle.use-latest` to `true` and the agent delivers the most recent renewal instead:++```yaml+certificates:+ - certificate-id: "8f2a1c40-5f3b-4e7a-9c21-b3d4e5f60718"+ lifecycle:+ status-check-interval: "6h"+ use-latest: true+ post-hooks:+ on-renewal:+ command: "systemctl reload nginx"+ timeout: 30+ file-output:+ certificate:+ path: "/etc/ssl/certs/wildcard.crt"+ permission: "0644"+ private-key:+ path: "/etc/ssl/private/wildcard.key"+ permission: "0600"+```++Renewing the certificate once in Infisical then reaches every machine running the agent, with no configuration change and no manual step on the machines. Leave `certificate-id` pointing at the certificate you started from. You never need to update it, and Infisical resolves the most recent renewal for you however many times the certificate has been renewed.++The agent rewrites the files only when the certificate it resolves to changes, and runs the `on-renewal` hook when that happens. Use that hook to reload whatever service consumes the certificate. When nothing has changed, the agent writes nothing and runs no hooks, including across a restart: it compares what it resolves against the certificate already on disk, not just against what it delivered earlier in the same run.++<Note>+ Leaving `use-latest` unset keeps the agent on exactly the certificate you named. Choose that when you want a deliberate step before a new certificate reaches production.+</Note>++**What to expect in less common cases:**++- A revoked or expired certificate is reported and runs the `on-failure` hook, but the agent does not overwrite what is already on disk. The machine keeps serving the last certificate known to be good.+- A certificate that Infisical does not hold a private key for, such as one issued from a certificate signing request or through ACME, is written along with its chain. The agent logs a warning and skips the private key file. If such a certificate would *replace* one already delivered, the agent refuses the write instead, because overwriting the certificate while leaving the previous key in place would put a non-matching pair on disk and the `on-renewal` hook would reload a service onto it.+- `status-check-interval` sets how often the agent checks, and so how quickly a renewal reaches the machine.+- Keep the certificate named in `certificate-id`, even after it has been renewed. The agent starts from it, so deleting it leaves a restarted agent unable to resolve. Certificates that replaced it can be deleted safely, including the one directly after it.+- `use-latest` requires an Infisical server that supports it. Against an older self-hosted instance the agent cannot tell that a renewal exists, so it logs a warning and stays on the certificate it already delivered. Upgrade the server, or leave `use-latest` unset and point `certificate-id` at the current certificate.+### Post-event hooksThe Infisical Agent supports running custom commands in response to certificate lifecycle events such as issuance, renewal, and failure through the `post-hooks` configuration@@ -554,3 +646,50 @@ certificates:command: "systemctl reload nginx && logger 'Certificate renewed'"timeout: 30```++### Distributing a shared wildcard certificate++The configuration below instructs the agent to fetch an existing wildcard certificate by ID rather than issue a new one, and to keep it current as the certificate is renewed in Infisical. The same file can be deployed unchanged to every machine that terminates TLS for the domain.++```yaml+version: v2++# Infisical server configuration+infisical:+ address: "https://app.infisical.com"+ retry-strategy:+ max-retries: 3+ max-delay: "5s"+ base-delay: "200ms"++# Infisical authentication configuration+auth:+ type: "universal-auth"+ config:+ client-id: "your-client-id"+ client-secret: "your-client-secret"++# Certificate configuration+certificates:+ - certificate-id: "8f2a1c40-5f3b-4e7a-9c21-b3d4e5f60718"+ lifecycle:+ status-check-interval: "6h" # How often to check certificate status and renewal needs+ use-latest: true # Deliver the most recent renewal of the certificate above+ file-output:+ private-key:+ path: "/etc/ssl/private/wildcard.example.com.key"+ permission: "0600"+ certificate:+ path: "/etc/ssl/certs/wildcard.example.com.crt"+ permission: "0644"+ chain:+ path: "/etc/ssl/certs/wildcard.example.com.chain.crt"+ permission: "0644"+ post-hooks:+ on-renewal:+ command: "systemctl reload nginx"+ timeout: 30+ on-failure:+ command: "logger 'Shared certificate could not be refreshed'"+ timeout: 10+```diff --git a/frontend/src/pages/cert-manager/CertificateDetailsByIDPage/components/CertificateOverviewSection.tsx b/frontend/src/pages/cert-manager/CertificateDetailsByIDPage/components/CertificateOverviewSection.tsxindex 6a257bf599..98c5b8b26c 100644--- a/frontend/src/pages/cert-manager/CertificateDetailsByIDPage/components/CertificateOverviewSection.tsx+++ b/frontend/src/pages/cert-manager/CertificateDetailsByIDPage/components/CertificateOverviewSection.tsx@@ -80,6 +80,13 @@ export const CertificateOverviewSection = ({ certificateId }: Props) => {<DetailLabel>Common Name</DetailLabel><DetailValue>{certificate.commonName}</DetailValue></Detail>+ <Detail>+ <DetailLabel>Certificate ID</DetailLabel>+ <DetailValue className="flex items-center gap-2 font-mono text-xs">+ {certificate.id}+ <CopyButton value={certificate.id} size="xs" variant="plain" />+ </DetailValue>+ </Detail><Detail><DetailLabel>Status</DetailLabel><DetailValue>