Before you start
Have these on hand before you create a Connector:- A running, HSM-capable Gateway on a host that can reach your HSM. New to Gateways? Start at Gateway Deployment, then come back. The Gateway must be started with
--pkcs11-module=<absolute path>so it loads your HSM’s PKCS#11 driver. - The absolute path to the PKCS#11 driver (
.so) provided by your HSM vendor. Gateway HSM support runs on Linux only. - The slot label and PIN of the HSM slot Infisical should use. Both come from your HSM provider.
How it fits together
At the top level there are three actors: The detailed exchange Infisical performs against the HSM through the Gateway looks like this: Three pieces have to be in place for an HSM Connector to be usable:- A Gateway running on a Linux host that can talk to your HSM, started with
--pkcs11-module=<path to vendor .so>. See Gateway Deployment. - An HSM Connector that points at that Gateway (or a Pool that contains it) and carries the slot credentials.
- A consumer, a feature that supports HSM-backed keys. See the feature’s own docs for how it references an HSM Connector.
Run a Gateway with PKCS#11 enabled
The Gateway is the agent Infisical talks to when it needs your HSM. You install it once on a host inside your network, start it with your HSM’s PKCS#11 driver path, and Infisical routes every HSM operation through it. A Gateway started without the PKCS#11 driver path is not eligible for HSM Connectors and is skipped automatically. If you have never deployed a Gateway before, read Gateway Deployment first for the general install and auth flow, then return here for the HSM-specific flag.Install your HSM's PKCS#11 driver on the Gateway host
.so. You will pass it to the Gateway in the next step.For example, the Fortanix DSM PKCS#11 driver is commonly placed at /opt/fortanix/pkcs11/fortanix_pkcs11.so by Fortanix’s installer, though you can put it anywhere the Gateway process can read.Follow the vendor’s onboarding to provision a slot, configure operator credentials, and confirm pkcs11-tool --module <driver> --list-slots returns the expected slot label.Create the Gateway in the Infisical UI
Start the Gateway with --pkcs11-module
--pkcs11-module=<absolute path> to the start command. The Gateway loads the driver once on startup and serves HSM operations alongside its other traffic.- Linux (Production)
- Foreground
--pkcs11-module flag, so restarts pick up the same driver.(Optional) Add the Gateway to a Pool
Create an HSM Connector
Once you have a PKCS#11-enabled Gateway running, create the Connector in Cert Manager. In Certificate Manager > Settings > HSM Connectors, click Add HSM Connector. The wizard walks you through three steps.Basics
| Field | Description |
|---|---|
| Name | Slug-friendly identifier (lowercase, dashes). Example: fortanix-prod. |
| Description | Optional. Context for your team. Example: Fortanix DSM, production keys. |
Connection
- Gateway: route every operation through one specific Gateway. Use this if you have a single PKCS#11-enabled Gateway, or if you want strict routing.
- Gateway Pool: route through any healthy, PKCS#11-capable member of the pool. Recommended for production so a single Gateway outage doesn’t stop operations. Pool members without PKCS#11 enabled are skipped automatically.
--pkcs11-module.Credentials
| Field | Description |
|---|---|
| Slot label | The PKCS#11 token label of the slot to use. |
| PIN | The PKCS#11 user PIN for that slot. Stored encrypted with your KMS key, sent to the Gateway over the proxied TLS channel on every request. |
| Key label prefix | Optional prefix prepended to every key label Infisical creates in this slot. Example: infisical- produces labels like infisical-{id}. Useful when the HSM hosts keys for multiple applications. |
FAQ
What happens to keys on the HSM when I delete a referencing resource?
What happens to keys on the HSM when I delete a referencing resource?
Can I route HSM traffic through the same Gateway that serves my databases or app connections?
Can I route HSM traffic through the same Gateway that serves my databases or app connections?
--pkcs11-module to the start command of an existing Gateway and that Gateway will serve HSM operations alongside its other traffic. Restart is required for the driver to load.Does a Gateway Pool need every member to be PKCS#11-capable?
Does a Gateway Pool need every member to be PKCS#11-capable?
Which mechanisms are supported?
Which mechanisms are supported?
| Mechanism | What it does |
|---|---|
| RSA PKCS#1 v1.5 | Raw RSA signing of a pre-hashed digest |
| SHA-256 with RSA PKCS#1 v1.5 | RSA signing with SHA-256 inside the HSM |
| SHA-384 with RSA PKCS#1 v1.5 | RSA signing with SHA-384 inside the HSM |
| SHA-512 with RSA PKCS#1 v1.5 | RSA signing with SHA-512 inside the HSM |
| ECDSA with SHA-256 | ECDSA signing with SHA-256 inside the HSM |
| ECDSA with SHA-384 | ECDSA signing with SHA-384 inside the HSM |
| ECDSA with SHA-512 | ECDSA signing with SHA-512 inside the HSM |
Can I rotate the PIN without recreating resources that reference the Connector?
Can I rotate the PIN without recreating resources that reference the Connector?