Running the agent
Start the agent with the--config flag pointing to your configuration file:
--verbose to enable debug logging when troubleshooting.
Instead of a file, you can pass the entire configuration through the INFISICAL_AGENT_CONFIG_BASE64 environment variable as a base64-encoded string. This is useful in containerized environments where mounting files is inconvenient.
For production deployments, run the agent as a system service so it starts automatically and runs continuously.
Configuration file
The agent is driven by a YAML configuration file with four top-level sections:version, infisical, auth, and certificates.
agent-config.yaml
version to v2. Each certificate entry references an Application and a certificate profile attached to it by name, or an existing certificate by ID (see Tracking an existing certificate).
Duration format
Duration values (ttl, renew-before-expiry, status-check-interval, failure-retry-interval) accept standard time units (30s, 10m, 6h) plus a day suffix (14d, 90d).
Infisical connection
Authentication
Theauth section configures how the agent authenticates with Infisical as a machine identity. Upon successful authentication, the agent receives a short-lived access token that it automatically renews for the lifetime of the process.
Set auth.type to one of the supported methods and provide the matching fields under auth.config:
service-account-token (Kubernetes) and service-account-key (GCP IAM) are file paths handed to the authentication flow directly; their environment variables override the path, not the content.
Certificate parameters
Each entry in thecertificates list accepts the following parameters:
Post-event hooks
The agent runs custom commands in response to certificate lifecycle events through thepost-hooks configuration. Commands run through the system shell, so they can chain multiple actions.
- Issuance hook
- Renewal hook
- Failure hook
Runs when a new certificate is successfully issued:
Example configurations
One-time certificate issuance
Requests a certificate once without any subsequent auto-renewal (nolifecycle section):
One-time issuance from a pre-generated CSR
Submits a pre-generated CSR to Infisical for signing. Whencsr-path is specified:
- The
private-keyoutput is omitted because the key pair is generated and managed externally; only the CSR is submitted to Infisical for signing. - The agent cannot auto-renew the certificate, since it does not hold the private key required to generate a new CSR.
Issuance with automatic renewal
Requests a certificate and continuously renews it 14 days before expiration, checking the certificate status every 6 hours:Tracking an existing certificate
Instead of issuing a new certificate, the agent can fetch an existing one by settingcertificate-id. The agent downloads the certificate bundle, writes it to the configured paths, and monitors its status on the configured status-check-interval. If the certificate is revoked or expires, the agent runs the on-failure hook and stops.
Use this when the certificate’s lifecycle is managed in Infisical (for example, through server-driven auto-renewal) and the agent’s job is only to deliver it to the machine.
This is also how several machines share one certificate. Ten web servers terminating TLS for *.example.com can point at the same certificate-id and serve the same wildcard certificate, instead of each issuing its own. Nothing reaches the certificate authority, and your inventory does not grow with the fleet.
certificate-id replaces the fields that describe a new certificate. Combining it with application-name, profile-name, attributes, csr or csr-path is rejected when the agent starts, rather than silently ignored.
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.
Following renewals
Renewing a certificate produces a new certificate with its own ID, and the one it replaced stays valid until its own expiry. An agent pinned to the original ID therefore keeps serving the original. Setlifecycle.replace-on-renewals to true and the agent delivers the most recent renewal instead:
certificate-id pointing at the certificate you started from: Infisical resolves the most recent renewal for you, however many times it 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. When nothing has changed it writes nothing and runs no hooks, including across a restart, because it compares what it resolves against the certificate already on disk.
What to expect in less common cases:
- A revoked or expired certificate is reported and runs the
on-failurehook, 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 that would leave a non-matching certificate and key on disk.
status-check-intervalsets 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. Certificates that replaced it can be deleted safely. replace-on-renewalsrequires 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.