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 guide for requesting cert with infisical agent
Tuan Dang909adee46112
diff --git a/docs/docs.json b/docs/docs.jsonindex 00acabe07e..fb69a5c849 100644--- a/docs/docs.json+++ b/docs/docs.json@@ -669,6 +669,7 @@{"group": "Guides","pages": [+ "documentation/platform/pki/guides/request-cert-agent","documentation/platform/pki/guides/request-cert-api","documentation/platform/pki/guides/request-cert-acme"]diff --git a/docs/documentation/platform/pki/guides/request-cert-acme.mdx b/docs/documentation/platform/pki/guides/request-cert-acme.mdxindex 1c1273e798..f0b545ba23 100644--- a/docs/documentation/platform/pki/guides/request-cert-acme.mdx+++ b/docs/documentation/platform/pki/guides/request-cert-acme.mdx@@ -5,6 +5,7 @@ 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).+This includes ACME clients like [Certbot](https://certbot.eff.org/), [cert-manager](https://cert-manager.io/) in Kubernetes using the [ACME issuer type](https://cert-manager.io/docs/configuration/acme/), and more.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.diff --git a/docs/documentation/platform/pki/guides/request-cert-agent.mdx b/docs/documentation/platform/pki/guides/request-cert-agent.mdxnew file mode 100644index 0000000000..2bc976cb1b--- /dev/null+++ b/docs/documentation/platform/pki/guides/request-cert-agent.mdx@@ -0,0 +1,93 @@+---+title: "Request a Certificate via the Infisical Agent"+---++import RequestCertSetup from "/snippets/documentation/platform/pki/guides/request-cert-setup.mdx";++The [Infisical Agent](/integrations/platforms/certificate-agent) is an installable client daemon that can request TLS and other X.509 certificates 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.++Instead of [manually requesting](/documentation/platform/pki/guides/request-cert-api) and renewing a certificate via the [Issue Certificate](/api-reference/endpoints/certificates/create-certificate) API endpoint, you can install and launch the Infisical Agent to have it perform these steps for you automatically.++## Diagram++```mermaid+sequenceDiagram+ autonumber+ participant Agent as Infisical Agent+ participant Infis as Infisical+ participant CA as CA<br/>(Internal or External)++ Agent->>Infis: Request certificate<br/>(profileId, conditional subject/SANs, ttl,<br/>key usages, conditional CSR, etc.)++ Infis->>Infis: Look up certificate profile<br/>(by profileId)+ Infis->>Infis: Validate request<br/>against profile constraints<br/>(CN/SAN rules, key usages, max TTL, etc.)++ alt Issuer Type = Self-Signed+ Infis->>Infis: Generate keypair<br/>and self-sign certificate+ else Issuer Type = Internal CA+ Infis->>CA: Request certificate issuance+ CA-->>Infis: Signed certificate<br/>(+ chain)+ end++ Infis-->>Agent: Return certificate, certificate chain,<br/>(and private key if server-generated)++ Note over Agent: Persist certificate and begin lifecycle monitoring++ loop Periodic certificate status check+ Agent->>Agent: Check certificate expiration<br/>against renew-before-expiry threshold++ alt Renewal not required+ Agent-->>Agent: Continue monitoring+ else Renewal required+ Agent->>Infis: Request new certificate<br/>(same profile and constraints)++ Infis->>Infis: Validate renewal request<br/>against profile constraints++ alt Issuer Type = Self-Signed+ Infis->>Infis: Generate keypair<br/>and self-sign certificate+ else Issuer Type = Internal CA+ Infis->>CA: Request certificate issuance+ CA-->>Infis: Signed certificate<br/>(+ chain)+ end++ Infis-->>Agent: Return renewed certificate, certificate chain, and private key+ end+ end+```++## Guide++In the following steps, we explore an end-to-end workflow for requesting and continuously renewing a certificate using the Infisical Agent.++<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">+ Next, [install the Infisical CLI](/cli/overview) on the target machine you wish to request the certificate on and follow the documentation [here](/integrations/platforms/certificate-agent#operating-the-agent) to set up the Infisical Agent on it.++ As part of the setup, you must create an [agent configuration file](/integrations/platforms/certificate-agent#agent-configuration) that specifies how the agent should authenticate with Infisical using a [machine identity](/documentation/platform/identities/machine-identities), the certificate profile it should request against (from Step 3), what kind of certificate to request, where to persist the certificate, and how it should be managed in terms of auto-renewal.++ Finally, start the agent with that configuration file so it can start requesting and continuously renewing the certificate on your behalf using the command below:++ ```bash+ infisical cert-manager agent --config /path/to/your/agent-config.yaml+ ```++ The certificate, certificate chain, and private key will be persisted to the filesystem at the paths specified in the `file-output` section of the agent configuration file.++ </Step>+</Steps>diff --git a/docs/documentation/platform/pki/guides/request-cert-api.mdx b/docs/documentation/platform/pki/guides/request-cert-api.mdxindex 8ab765f339..3ba4a533cd 100644--- a/docs/documentation/platform/pki/guides/request-cert-api.mdx+++ b/docs/documentation/platform/pki/guides/request-cert-api.mdx@@ -4,7 +4,10 @@ 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.+The [API enrollment method](/documentation/platform/pki/enrollment-methods/api) lets you programmatically request TLS and other X.509 certificates from Infisical.++This is the most flexible way to request certificates from Infisical but requires you to implement certificate request and renewal logic on your own.+For a more automated way to request certificates, we highly recommend you check out the guide for requesting certificates using the [Infisical Agent](/integrations/platforms/certificate-agent) [here](/documentation/platform/pki/guides/request-cert-agent).## Diagram@@ -17,18 +20,14 @@ sequenceDiagramparticipant Infis as Infisicalparticipant 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+ Client->>Infis: POST /certificate<br/>(profileId, conditional subject/SANs, ttl,<br/>key usages, conditional CSR, etc.)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.)+ Infis->>Infis: Validate request or CSR<br/>against profile constraints<br/>(CN/SAN rules, key usages, max TTL, etc.)- alt Issue Certificate - Issuer Type = Self-Signed+ alt Issuer Type = Self-SignedInfis->>Infis: Generate keypair<br/>and self-sign certificate- else Issue/Sign Certificate - Issuer Type = Internal CA+ else Issuer Type = CAInfis->>CA: Request certificate issuance<br/>(CSR)CA-->>Infis: Signed certificate<br/>(+ chain)end@@ -59,13 +58,12 @@ In the following steps, we explore an end-to-end workflow for requesting a certi</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).+ over the Web UI or by making an API request the [Issue Certificate](/api-reference/endpoints/certificates/create-certificate) API endpoint with or without 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.+ - Make a request to issue a new certificate against the same [Issue Certificate](/api-reference/endpoints/certificates/create-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 without a CSR.<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