Skip to content

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

feat(kmip): audit flag for certificate renewals, optional TTL

bernie-g3fb98017c087
diff --git a/backend/src/ee/routes/v1/kmip-server-router.ts b/backend/src/ee/routes/v1/kmip-server-router.ts
index 53d344d2a0..1456ed7585 100644
--- a/backend/src/ee/routes/v1/kmip-server-router.ts
+++ b/backend/src/ee/routes/v1/kmip-server-router.ts
@@ -10,6 +10,7 @@ import { ms } from "@app/lib/ms";
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
import { slugSchema } from "@app/server/lib/schemas";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
+import { booleanSchema } from "@app/server/routes/sanitizedSchemas";
import { ActorType, AuthMode } from "@app/services/auth/auth-type";
import { CertKeyAlgorithm } from "@app/services/certificate/certificate-types";
import { validateAltNamesField } from "@app/services/certificate-authority/certificate-authority-validators";
@@ -549,6 +550,13 @@ export const registerKmipServerRouter = async (server: FastifyZodProvider) => {
url: "/connect",
config: { rateLimit: writeLimit },
schema: {
+ querystring: z.object({
+ isRenewal: booleanSchema
+ .default(false)
+ .describe(
+ "Set by the KMIP server daemon when fetching a replacement certificate for one it is already serving, so renewals are distinguishable from first-time connects in the audit log."
+ )
+ }),
response: {
200: z.object({
clientCertificateChain: z.string(),
@@ -598,7 +606,8 @@ export const registerKmipServerRouter = async (server: FastifyZodProvider) => {
hostnamesOrIps: kmipServer.hostnamesOrIps,
commonName: resolvedCommonName,
keyAlgorithm: resolvedKeyAlgorithm ?? CertKeyAlgorithm.RSA_2048,
- ttl: resolvedTtl
+ ttl: resolvedTtl,
+ isRenewal: req.query.isRenewal
}
}
});
diff --git a/backend/src/ee/services/audit-log/audit-log-types.ts b/backend/src/ee/services/audit-log/audit-log-types.ts
index 5b5d31b571..d761c66aa1 100644
--- a/backend/src/ee/services/audit-log/audit-log-types.ts
+++ b/backend/src/ee/services/audit-log/audit-log-types.ts
@@ -5016,6 +5016,7 @@ interface RegisterKmipServerEvent {
commonName: string;
keyAlgorithm: CertKeyAlgorithm;
ttl: string;
+ isRenewal?: boolean;
};
}
diff --git a/docs/cli/commands/kmip.mdx b/docs/cli/commands/kmip.mdx
index 00fdbe4b37..2a04714ce9 100644
--- a/docs/cli/commands/kmip.mdx
+++ b/docs/cli/commands/kmip.mdx
@@ -29,7 +29,7 @@ The Infisical KMIP server provides Key Management Interoperability Protocol (KMI
The server is created in Infisical and then enrolled from the host where you run it, using either a one-time enrollment **token** or **AWS** authentication. The deploy command (including the enrollment token) can be copied from the server's detail page via **Show deploy command**.
-The server's certificate configuration (hostnames/IPs, TTL, and key algorithm) is defined on the server entity in the UI. The CLI fetches it on start, so you do not pass it on the command line. To change the certificate, edit the configuration in the UI and restart the server.
+The server's certificate configuration (hostnames/IPs, TTL, and key algorithm) is defined on the server entity in the UI. The CLI fetches it on start, so you do not pass it on the command line. The running server renews its certificate automatically before it expires, with no restart required. To change the certificate configuration, edit it in the UI; the change applies at the next automatic renewal, or restart the server to apply it immediately.
For detailed information about KMIP integration, PKI setup, and client configuration, see the [KMIP Integration Guide](/documentation/platform/kms/kmip).
diff --git a/docs/documentation/platform/kms/kmip.mdx b/docs/documentation/platform/kms/kmip.mdx
index 9df6e47abb..374c3a8b99 100644
--- a/docs/documentation/platform/kms/kmip.mdx
+++ b/docs/documentation/platform/kms/kmip.mdx
@@ -65,10 +65,10 @@ A KMIP server is created as an organization-wide entity in Infisical and then en
2. Click **Create KMIP Server** and fill in:
- **Name** of the server.
- **Hostnames or IPs**: a comma-separated list of the hostnames or IPs that KMIP clients will use to reach this server (for example `kmip.example.com` or `10.0.1.50`). These become the Subject Alternative Names (SANs) of the server's TLS certificate, so they must match how clients connect.
- - **Certificate TTL**: validity period of the server certificate (for example `1y`).
+ - **Certificate TTL** (optional): validity period of the server certificate (for example `1y`). Defaults to `1y`. The server renews its certificate automatically before it expires, so this value mainly controls how often that happens.
- **Key Algorithm**: key algorithm used to sign the server certificate.
- This certificate configuration is stored on the server entity. The CLI reads it on start, so you do not pass it on the command line. You can change it later from the server's detail page (edit the **Certificate Configuration** card) and restart the server to apply it.
+ This certificate configuration is stored on the server entity. The CLI reads it on start, so you do not pass it on the command line. You can change it later from the server's detail page (edit the **Certificate Configuration** card); changes apply at the server's next automatic certificate renewal, or immediately if you restart it.
3. (Optional) Open the new server's detail page and click the edit icon next to **Authentication** to switch the auth method. Two methods are supported:
- **Token** (default): a one-time enrollment token (1h expiry) bootstraps the server.
- **AWS**: the server authenticates by signing an `sts:GetCallerIdentity` request with whatever AWS credentials it can resolve on the host (instance role, env vars, shared profile). Configure the allowed principal ARNs and/or account IDs that match your hosts.
@@ -153,7 +153,7 @@ A KMIP server is created as an organization-wide entity in Infisical and then en
</Warning>
<Note>
- The server's certificate configuration (hostnames/IPs, TTL, key algorithm) is read from the server entity you configured in the UI, so the deploy command does not include it. To change the certificate, edit the **Certificate Configuration** card on the server's detail page and restart the server.
+ The server's certificate configuration (hostnames/IPs, TTL, key algorithm) is read from the server entity you configured in the UI, so the deploy command does not include it. To change the certificate, edit the **Certificate Configuration** card on the server's detail page. Changes apply at the next automatic certificate renewal, or restart the server to apply them immediately.
</Note>
<Note>
@@ -171,7 +171,7 @@ A KMIP server is created as an organization-wide entity in Infisical and then en
<Step title="Verify the KMIP Server">
After deployment, verify the server is running:
- 1. **Check logs** for a "Listening on ..." message and confirm the certificates loaded successfully.
+ 1. **Check logs** for a "Listening on ..." message, confirmation that the certificates loaded successfully, and a "Next certificate renewal scheduled in ..." line showing auto-renewal is active.
2. For systemd installations, check the service status:
```bash
sudo systemctl status infisical-kmip
@@ -187,11 +187,19 @@ A KMIP server is created as an organization-wide entity in Infisical and then en
From the KMIP server's detail page (under **Infisical KMS > KMIP Servers**):
- **Show deploy command** — Generates a fresh enrollment token (token method) or re-displays the AWS start command. For token-method servers this does not disconnect a running server; the next enrollment with the new token supersedes the old one.
-- **Edit certificate configuration**: Update the hostnames/IPs, TTL, or key algorithm used for the server's TLS certificate. Restart the server after saving for the new certificate to take effect.
+- **Edit certificate configuration**: Update the hostnames/IPs, TTL, or key algorithm used for the server's TLS certificate. Changes take effect at the next automatic certificate renewal; restart the server to apply them immediately.
- **Edit authentication** — Switch between Token and AWS, or update the AWS allowlists.
- **Options → Revoke Access** — Invalidates the server's outstanding access tokens and enrollment tokens. The server must re-enroll to reconnect.
- **Options → Delete** — Permanently removes the KMIP server entity.
+### Certificate Auto-Renewal
+
+A running KMIP server renews its TLS certificate automatically once two-thirds of the certificate's validity period has elapsed. Renewal happens in the background: no restart is needed, existing client connections are not interrupted, and new connections use the renewed certificate right away. Each renewal is recorded in the organization audit log as a `register-kmip-server` event with `isRenewal: true`.
+
+If a renewal attempt fails (for example, the Infisical platform is temporarily unreachable), the server keeps serving its current certificate and retries with increasing frequency as expiry approaches, logging warnings and errors so you can intervene. Once the platform is reachable again, the next retry succeeds and normal operation resumes.
+
+If you revoke the server's access, renewal fails with an authentication error. AWS-enrolled servers recover automatically by re-authenticating via STS. Token-enrolled servers cannot, since enrollment tokens are single-use; the server logs an error asking you to re-enroll. Generate a new enrollment token via **Show deploy command** and restart the server with it to recover.
+
## Register a KMIP Client
Once the KMIP server is running, register the KMIP clients that will connect to it. Clients are managed per-project from a KMS project's KMIP settings and authenticate via mTLS certificates.
diff --git a/frontend/src/pages/organization/KmipServersPage/KmipServerDetailsByIDPage/components/KmipServerCertConfig/KmipServerCertConfigModal.tsx b/frontend/src/pages/organization/KmipServersPage/KmipServerDetailsByIDPage/components/KmipServerCertConfig/KmipServerCertConfigModal.tsx
index 790d9e71c9..ec98f18fa2 100644
--- a/frontend/src/pages/organization/KmipServersPage/KmipServerDetailsByIDPage/components/KmipServerCertConfig/KmipServerCertConfigModal.tsx
+++ b/frontend/src/pages/organization/KmipServersPage/KmipServerDetailsByIDPage/components/KmipServerCertConfig/KmipServerCertConfigModal.tsx
@@ -39,7 +39,7 @@ const schema = z.object({
.trim()
.min(1, "At least one hostname or IP is required")
.max(4096, "Hostnames or IPs must be at most 4096 characters"),
- ttl: z.string().trim().min(1, "TTL is required").max(64, "TTL is too long"),
+ ttl: z.string().trim().max(64, "TTL is too long").optional(),
keyAlgorithm: z.nativeEnum(CertKeyAlgorithm)
});
@@ -57,7 +57,7 @@ export const KmipServerCertConfigModal = ({ isOpen, onOpenChange, kmipServer }:
const defaults: FormData = {
hostnamesOrIps: kmipServer.hostnamesOrIps ?? "",
- ttl: kmipServer.ttl ?? "1y",
+ ttl: kmipServer.ttl ?? "",
keyAlgorithm: (kmipServer.keyAlgorithm as CertKeyAlgorithm) ?? CertKeyAlgorithm.RSA_2048
};
@@ -81,12 +81,12 @@ export const KmipServerCertConfigModal = ({ isOpen, onOpenChange, kmipServer }:
await updateKmipServer({
kmipServerId: kmipServer.id,
hostnamesOrIps: form.hostnamesOrIps,
- ttl: form.ttl,
+ ttl: form.ttl || undefined,
keyAlgorithm: form.keyAlgorithm
});
createNotification({
type: "success",
- text: "Certificate configuration updated. Restart the KMIP server to apply it."
+ text: "Certificate configuration updated. It applies at the next automatic certificate renewal; restart the KMIP server to apply it immediately."
});
onOpenChange(false);
} catch {
@@ -100,7 +100,8 @@ export const KmipServerCertConfigModal = ({ isOpen, onOpenChange, kmipServer }:
<DialogHeader>
<DialogTitle>Edit Certificate Configuration</DialogTitle>
<DialogDescription>
- Restart the KMIP server after saving for the new certificate to take effect.
+ Changes apply when the server next renews its certificate. Restart the KMIP server to
+ apply them immediately.
</DialogDescription>
</DialogHeader>
<form onSubmit={handleSubmit(onSubmit)} className="space-y-4">
diff --git a/frontend/src/pages/organization/KmipServersPage/components/components/KmipServerDeployModal.tsx b/frontend/src/pages/organization/KmipServersPage/components/components/KmipServerDeployModal.tsx
index 4527fd5c50..2869d8f677 100644
--- a/frontend/src/pages/organization/KmipServersPage/components/components/KmipServerDeployModal.tsx
+++ b/frontend/src/pages/organization/KmipServersPage/components/components/KmipServerDeployModal.tsx
@@ -30,7 +30,7 @@ const schema = z.object({
.trim()
.min(1, "At least one hostname or IP is required")
.max(4096, "Hostnames or IPs must be at most 4096 characters"),
- ttl: z.string().trim().min(1, "TTL is required").max(64, "TTL is too long"),
+ ttl: z.string().trim().max(64, "TTL is too long").optional(),
keyAlgorithm: z.nativeEnum(CertKeyAlgorithm)
});
@@ -57,7 +57,7 @@ export const KmipServerDeployModal = ({ isOpen, onOpenChange }: Props) => {
defaultValues: {
name: "",
hostnamesOrIps: "",
- ttl: "1y",
+ ttl: "",
keyAlgorithm: CertKeyAlgorithm.RSA_2048
}
});
@@ -67,7 +67,7 @@ export const KmipServerDeployModal = ({ isOpen, onOpenChange }: Props) => {
const kmipServer = await createKmipServer({
name: form.name,
hostnamesOrIps: form.hostnamesOrIps,
- ttl: form.ttl,
+ ttl: form.ttl || undefined,
keyAlgorithm: form.keyAlgorithm,
authMethod: { method: "token" }
});
@@ -134,10 +134,9 @@ export const KmipServerDeployModal = ({ isOpen, onOpenChange }: Props) => {
render={({ field, fieldState: { error } }) => (
<FormControl
label="Certificate TTL"
- isRequired
isError={Boolean(error)}
errorText={error?.message}
- helperText="Validity period of the server certificate, e.g. 2 days, 1d, 2h, 1y."
+ helperText="Validity period of the server certificate, e.g. 2 days, 1d, 2h, 1y. Defaults to 1y. The server renews its certificate automatically before it expires."
>
<Input {...field} placeholder="1y" />
</FormControl>