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
add api and acme guides for cert-mgmt
Tuan Dang318c4ab8c9de
diff --git a/docs/docs.json b/docs/docs.jsonindex 4afa236559..13ffe0f77b 100644--- a/docs/docs.json+++ b/docs/docs.json@@ -662,6 +662,13 @@"documentation/platform/pki/concepts/certificate-mgmt","documentation/platform/pki/concepts/certificate-lifecycle"]+ },+ {+ "group": "Guides",+ "pages": [+ "documentation/platform/pki/guides/request-cert-api",+ "documentation/platform/pki/guides/request-cert-acme"+ ]}]},@@ -2438,7 +2445,7 @@]},{- "group": "Infisical PKI",+ "group": "Certificate Management","pages": [{"group": "Certificate Authorities",diff --git a/docs/documentation/platform/pki/enrollment-methods/acme.mdx b/docs/documentation/platform/pki/enrollment-methods/acme.mdxindex 50a4a615ce..afd2dc8634 100644--- a/docs/documentation/platform/pki/enrollment-methods/acme.mdx+++ b/docs/documentation/platform/pki/enrollment-methods/acme.mdx@@ -6,7 +6,9 @@ sidebarTitle: "ACME"## ConceptThe ACME enrollment method allows Infisical to act as an ACME server. It lets you request and manage certificates against a specific [certificate profile](/documentation/platform/pki/certificates/profiles) using the [ACME protocol](https://en.wikipedia.org/wiki/Automatic_Certificate_Management_Environment).-This method is suitable for web servers, load balancers, and other general-purpose servers that can run an [ACME client](https://letsencrypt.org/docs/client-options/) for automated certificate management.++This method is suitable for web servers, load balancers, and other general-purpose servers that can run an [ACME client](https://letsencrypt.org/docs/client-options/) for automated certificate management;+it can also be used with [cert-manager](https://cert-manager.io/) to issue and renew certificates for Kubernetes workloads through the [ACME issuer type](https://cert-manager.io/docs/configuration/acme/).Infisical's ACME enrollment method is based on [RFC 8555](https://datatracker.ietf.org/doc/html/rfc8555/).diff --git a/docs/documentation/platform/pki/guides/request-cert-acme.mdx b/docs/documentation/platform/pki/guides/request-cert-acme.mdxnew file mode 100644index 0000000000..1c1273e798--- /dev/null+++ b/docs/documentation/platform/pki/guides/request-cert-acme.mdx@@ -0,0 +1,107 @@+---+title: "Obtain a Certificate via ACME"+---++import RequestCertSetup from "/snippets/documentation/platform/pki/guides/request-cert-setup.mdx";++The [ACME enrollment method](/documentation/platform/pki/enrollment-methods/acme) lets any [ACME client](https://letsencrypt.org/docs/client-options/) obtain TLS certificates from Infisical using the [ACME protocol](https://en.wikipedia.org/wiki/Automatic_Certificate_Management_Environment).++Infisical currently supports the [HTTP-01 challenge type](https://letsencrypt.org/docs/challenge-types/#http-01-challenge) for domain validation as part of the ACME enrollment method.++## Diagram++The following sequence diagram illustrates the certificate enrollment workflow for requesting a certificate via ACME from Infisical.++```mermaid+sequenceDiagram+ autonumber+ participant ACME as ACME Client+ participant Infis as Infisical ACME Server+ participant Authz as HTTP-01 Challenge<br/>Validation Endpoint+ participant CA as CA<br/>(Internal or External)++ Note over ACME: ACME Client discovers<br/>Infisical ACME Directory URL++ ACME->>Infis: GET /directory+ Infis-->>ACME: Directory + nonce + endpoints++ ACME->>Infis: HEAD /new-nonce+ Infis-->>ACME: Return nonce in Replay-Nonce header++ ACME->>Infis: POST /new-account<br/>(contact, ToS agreed)+ Infis-->>ACME: Return account object++ Note over ACME,Infis: Requesting a certificate++ ACME->>Infis: POST /new-order<br/>(identifiers: DNS names)+ Infis-->>ACME: Return order<br/>with authorization URLs++ loop For each authorization (one per DNS name)+ ACME->>Infis: POST /authorizations/:authzId+ Infis-->>ACME: Return HTTP-01 challenge<br/>(URL + token + keyAuth)++ Note over ACME: Client must prove control<br/>over the domain via HTTP++ ACME->>Authz: Provision challenge response<br/>at<br/>/.well-known/acme-challenge/<token>++ ACME->>Infis: POST /authorizations/:authzId/challenges/:challengeId<br/>(trigger validation)++ Infis->>Authz: HTTP GET /.well-known/acme-challenge/<token>+ Authz-->>Infis: Return keyAuth++ Infis-->>ACME: Authorization = valid+ end++ Note over Infis: All authorizations valid → ready to finalize++ ACME->>ACME: Generate keypair locally<br/>and create CSR+ ACME->>Infis: POST /orders/:orderId/finalize<br/>(CSR)++ Infis->>CA: Request certificate issuance<br/>(CSR)+ CA-->>Infis: Signed certificate (+ chain)++ Infis-->>ACME: Return order with certificate URL<br/>(status: valid)++ ACME->>Infis: POST /orders/:orderId/certificate+ Infis-->>ACME: Return certificate<br/>and certificate chain+```++## Guide++In the following steps, we explore an end-to-end workflow for obtaining a certificate via ACME with Infisical.++<Steps>+ <RequestCertSetup />+ <Step title="Create a certificate profile">+ Next, follow the guide [here](/documentation/platform/pki/certificates/profiles#guide-to-creating-a-certificate-profile) to create a [certificate profile](/documentation/platform/pki/certificates/profiles)+ that will be referenced when requesting a certificate.++ The certificate profile specifies which certificate template and issuing CA should be used to validate an incoming certificate request and issue a certificate;+ it also specifies the [enrollment method](/documentation/platform/pki/enrollment-methods/overview) for how certificates can be requested against this profile+ to begin with.++ You should specify the certificate template from Step 2, the issuing CA from Step 1, and the **ACME** option in the **Enrollment Method** dropdown when creating the certificate profile.++ </Step>+ <Step title="Request a certificate">+ Finally, follow the guide [here](/documentation/platform/pki/enrollment-methods/acme#guide-to-certificate-enrollment-via-acme) to request a certificate against the certificate profile+ using an [ACME client](https://letsencrypt.org/docs/client-options/).++ The ACME client will connect to Infisical's ACME server at the **ACME Directory URL** and authenticate using the **EAB Key Identifier (KID)** and **EAB Secret** credentials as part of the ACME protocol.++ The typical ACME workflow looks likes this:++ - The ACME client creates (or reuses) an ACME account with Infisical using EAB credentials.+ - The ACME client creates an order for one or more DNS names.+ - For each DNS name, the ACME client receives an `HTTP-01` challenge and provisions the corresponding token response at `/.well-known/acme-challenge/<token>`.+ - Once all authorizations are valid, the ACME client finalizes the order by sending a CSR to Infisical.+ - Infisical issues the certificate from the issuing CA on the certificate profile and returns it (plus the chain) back to the ACME client.++ ACME clients typically handle renewal by tracking certificate expiration and completing the lifecycle once again to request a new certificate.++ <Note>+ We recommend reading more about the ACME protocol [here](https://letsencrypt.org/how-it-works/).+ </Note>++ </Step>+</Steps>diff --git a/docs/documentation/platform/pki/guides/request-cert-api.mdx b/docs/documentation/platform/pki/guides/request-cert-api.mdxnew file mode 100644index 0000000000..8ab765f339--- /dev/null+++ b/docs/documentation/platform/pki/guides/request-cert-api.mdx@@ -0,0 +1,81 @@+---+title: "Request a Certificate via API"+---++import RequestCertSetup from "/snippets/documentation/platform/pki/guides/request-cert-setup.mdx";++The [API enrollment method](/documentation/platform/pki/enrollment-methods/api) lets clients programmatically request TLS and other X.509 certificates from Infisical.++## Diagram++The following sequence diagram illustrates the certificate issuance workflow for requesting a certificate via API from Infisical.++```mermaid+sequenceDiagram+ autonumber+ participant Client as Client+ participant Infis as Infisical+ participant CA as CA<br/>(Internal or External)++ alt Issue Certificate+ Client->>Infis: POST /issue-certificate<br/>(profileId, subject/SANs, ttl,<br/>key usages, etc.)+ else Sign Certificate+ Client->>Infis: POST /sign-certificate<br/>(profileId, CSR, ttl)+ end++ Infis->>Infis: Look up certificate profile<br/>(by profileId)+ Infis->>Infis: Validate request or CSR<br/>against template constraints<br/>(CN/SAN rules, key usages, max TTL, etc.)++ alt Issue Certificate - Issuer Type = Self-Signed+ Infis->>Infis: Generate keypair<br/>and self-sign certificate+ else Issue/Sign Certificate - Issuer Type = Internal CA+ Infis->>CA: Request certificate issuance<br/>(CSR)+ CA-->>Infis: Signed certificate<br/>(+ chain)+ end++ Infis-->>Client: Return certificate, certificate chain,<br/>issuing CA certificate, serial number,<br/>certificate ID<br/>(and private key if server-generated)+```++## Guide++In the following steps, we explore an end-to-end workflow for requesting a certificate via API from Infisical.++<Steps>+ <RequestCertSetup />+ <Step title="Create a certificate profile">+ Next, follow the guide [here](/documentation/platform/pki/certificates/profiles#guide-to-creating-a-certificate-profile) to create a [certificate profile](/documentation/platform/pki/certificates/profiles)+ that will be referenced when requesting a certificate.++ The certificate profile specifies which certificate template and issuing CA should be used to validate an incoming certificate request and issue a certificate;+ it also specifies the [enrollment method](/documentation/platform/pki/enrollment-methods/overview) for how certificates can be requested against this profile+ to begin with.++ You should specify the certificate template from Step 2, the issuing CA from Step 1, and the **API** option in the **Enrollment Method** dropdown when creating the certificate profile.++ <Note>+ Note that if you're looking to issue self-signed certificates, you should select the **Self-Signed** option in the **Issuer Type** dropdown when creating the certificate profile.+ </Note>++ </Step>+ <Step title="Request a certificate">+ Finally, follow the guide [here](/documentation/platform/pki/enrollment-methods/api#guide-to-certificate-enrollment-via-api) to request a certificate against the certificate profile+ over the Web UI or by making an API request to either the [Issue Certificate](/api-reference/endpoints/certificates/issue-certificate) API endpoint or the [Sign Certificate](/api-reference/endpoints/certificates/sign-certificate) API endpoint+ with a Certificate Signing Request (CSR).++ To renew a certificate on the client-side, you have two options:++ - Make a request to issue a new certificate against the same [Issue Certificate](/api-reference/endpoints/certificates/issue-certificate) API endpoint.+ - Make a request to the [Renew Certificate](/api-reference/endpoints/certificates/renew) API endpoint with the ID of the certificate you wish to renew. Note that this endpoint only works if the original certificate was issued through the [Issue Certificate](/api-reference/endpoints/certificates/issue-certificate) API endpoint.++ <Note>+ We recommend reading the guide [here](/documentation/platform/pki/certificates/certificates#guide-to-renewing-certificates) to learn more about all the ways to renew a certificate+ with Infisical including [server-driven certificate renewal](/documentation/platform/pki/certificates/certificates#server-driven-certificate-renewal).+ </Note>++ </Step>+</Steps>++Note that depending on your environment and infrastructure use-case, you may wish to use a different [enrollment method](/documentation/platform/pki/enrollment-methods/overview) to request certificates.++For more automated certificate management, you may wish to request certificates using a client that can monitor expiring certificates and request renewals for you.+For example, you can install the Infisical Agent on a VM and have it request and renew certificates for you or use an [ACME client](https://letsencrypt.org/docs/client-options/) paired with Infisical's [ACME enrollment method](/documentation/platform/pki/enrollment-methods/acme).diff --git a/docs/snippets/documentation/platform/pki/guides/request-cert-setup.mdx b/docs/snippets/documentation/platform/pki/guides/request-cert-setup.mdxnew file mode 100644index 0000000000..db10530bba--- /dev/null+++ b/docs/snippets/documentation/platform/pki/guides/request-cert-setup.mdx@@ -0,0 +1,27 @@+<Step title="Configure a Certificate Authority">+ Before you can issue any certificate, you must first configure a [Certificate Authority (CA)](/documentation/platform/pki/ca/overview).++ The CA you configure will be used to issue the certificate back to your client; it can be either Internal or External:++ - [Internal CA](/documentation/platform/pki/ca/private-ca): If you're building your own PKI and wish to issue certificates for internal use, you should+ follow the guide [here](/documentation/platform/pki/ca/private-ca#guide-to-creating-a-ca-hierarchy) to create at minimum a root CA and an intermediate/issuing CA+ within Infisical.++ - [External CA](/documentation/platform/pki/ca/external-ca): If you have existing PKI infrastructure or wish to connect to a public CA (e.g. [Let's Encrypt](/documentation/platform/pki/ca/lets-encrypt), [DigiCert](/documentation/platform/pki/ca/digicert), etc.) to issue TLS certificates,+ you should follow the documentation [here](/documentation/platform/pki/ca/external-ca) to configure an External CA.++ <Note>+ Note that if you're looking to issue self-signed certificates, you can skip this step and proceed to Step 3.+ </Note>++</Step>+<Step title="Create a certificate template">+ Next, follow the guide [here](/documentation/platform/pki/certificates/templates#guide-to-creating-a-certificate-template) to create a [certificate template](http://localhost:3000/documentation/platform/pki/certificates/templates).++ The certificate template will constrain what attributes may or may not be allowed in the request to issue a certificate.+ For example, you can specify that the requested common name must adhere to a specific format like `*.acme.com` and+ that the maximum TTL cannot exceed 1 year.++ If you're looking to issue TLS server certificates, you should select the **TLS Server Certificate** option under the **Template Preset** dropdown.++</Step>