Skip to main content
Infisical Gateways run inside your network and let Infisical reach systems that aren’t exposed to the internet, such as a database in a private subnet or an internal API. This guide covers everything you need to deploy and configure Infisical Gateways.
For a complete Helm chart reference for Kubernetes deployments, see the Gateway Helm chart documentation.

Choose a connection mode

There are two ways to connect a Gateway, and your network usually decides which one you can use:
  • On Infisical Cloud? Use relay mode. Cloud runs outside your network and has no route into it, so there’s no address it could dial.
  • Self-hosted, and you can open an inbound port on the Gateway host? Use direct listen. It’s the simpler setup, with no relay in the path.
  • Self-hosted, but the Gateway sits behind NAT or a firewall you can’t change? Use relay mode.
The difference underneath is which side opens the connection, and that’s what drives every row above. You can also run both at once. See Running both modes. For the ports, certificates, and traffic flow behind each mode, see Network architecture.

Deployment steps

1

Set up a relay server (relay mode only)

Skip this step if you’re using direct listen.For relay mode, a relay server has to be running and reachable before you deploy any gateways. You have two options:
  • Managed relay (Infisical Cloud, US/EU only): If you’re using Infisical Cloud in the US or EU regions, you can use the provided managed relay.
  • Self-hosted relay: For all other cases, deploy your own relay server. See the Relay Deployment Guide.
2

Create the gateway in the UI

  1. Go to Organization Settings > Networking > Gateways.
  2. Select Create Gateway. Create Gateway button
  3. Enter a name for the gateway, then select Create Gateway. Create Gateway form
  4. (Optional) Open the new gateway’s detail page and change the method under Authentication in the Details card. Three methods are supported:
    • Token (default): a one-time enrollment token (1h expiry) bootstraps the gateway.
    • AWS: the gateway 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.
    • Kubernetes: the gateway authenticates with the projected service account token of the pod it runs in, so no credential has to be distributed to the cluster. Configure the cluster’s API server URL and the allowed namespaces and/or service account names.
  5. In the Deployment card, select Generate deploy command. For the AWS and Kubernetes methods the command is shown without this step.
  6. Under Connection Mode, select Direct Listen or Relay.
    • For Direct Listen, enter the Listen Address that Infisical will dial, as host:port.
    • For Relay, pick a relay, or leave Auto Select Relay so the gateway chooses the healthiest one.
  7. Copy the generated CLI command.
3

Install the Infisical CLI

Make sure the Infisical CLI is installed on the target machine. See the CLI Installation Guide for instructions.
4

Configure network and firewall

What you open depends on the connection mode you chose.Relay mode. All connections are outbound, so no inbound ports need to be opened.For managed relays, allow outbound traffic to the provided relay server IP/hostname. For self-hosted relays, allow outbound traffic to your own relay server address.If you’re in a corporate environment with strict egress filtering, ensure outbound TCP 2222 to relay servers and outbound HTTPS 443 to Infisical API endpoints are allowed.Direct listen mode. The Gateway accepts inbound connections. On the Gateway host, allow:
  • Inbound on the port in your listen address, from the Infisical instance host only
  • Outbound TCP 443 to the Infisical instance host
For the full connection model, a complete port reference, and firewall details (including self-hosted relays and HTTP forward proxies), see the Network Architecture page.
5

Run the CLI command

Run the command you copied from the UI on the target machine. This single command enrolls the gateway and starts it immediately.The examples below are grouped by authentication method. The connection mode is set by two flags, which you can add to any of them:
  • --listen-address=<host:port> for direct listen, where host:port is the address Infisical dials
  • --target-relay-name=<relay-name> to pin a relay, or omit it to let the gateway pick the healthiest one
Passing both runs the gateway in both modes.
For Kubernetes, set gateway.listenAddress to the address Infisical dials:
A one-time enrollment token (1h expiry) bootstraps the gateway.
The host must have AWS credentials whose principal matches your allowlist. The gateway re-authenticates via STS on every start.
The gateway sends the projected service account token of its own pod, and Infisical verifies it against your cluster’s TokenReview API. Nothing has to be copied into the cluster, so this is the method to use when gateway creation is automated. The gateway re-authenticates on every start.Before deploying, configure the Kubernetes auth method on the gateway’s detail page:At least one of Allowed Namespaces or Allowed Service Account Names must be set, so that not every pod in the cluster can enroll as the gateway.

Clusters with a private API server

By default Infisical calls your API server directly, which requires an address it can reach. If your API server is private, select a gateway or gateway pool under Gateway and the check is tunnelled through it instead. Two modes are available:A gateway pool can only be used with Manual Token Reviewer JWT (API), where any healthy member performs the check and one gateway going offline doesn’t stop the others from authenticating. Gateway as Reviewer requires a specific gateway, because in that mode the selected gateway decides the outcome and pool membership can change after the config is saved.
A gateway can’t review its own token. The proxy runs over the gateway’s own tunnel, which only exists once it has already authenticated, so the reviewer must be a different gateway that is already enrolled and connected.This means the first gateway in a private cluster can’t use Kubernetes auth. Enrol it with an enrollment token or AWS auth, then point later gateways at it. Deleting a gateway that other gateways use as their reviewer is refused until they’re pointed elsewhere.
Install the Infisical Helm chart repository:
Install the gateway:
The chart binds the gateway’s service account to the system:auth-delegator ClusterRole by default, which is what lets its own token act as the token reviewer. Set serviceAccount.createAsAuthDelegator=false only if you configure a separate Token Reviewer JWT on the gateway instead.
Make sure the release namespace and service account name match the allowlists you configured. With the command above, that is namespace infisical-gateway and service account infisical-gateway.
Infisical must be able to reach the cluster’s API server to review the token. For a cluster with no publicly reachable API server, use Token or AWS auth instead.
The systemd install command requires Linux with root/sudo privileges.
Token-method enrollment tokens are single-use and expire after 1 hour. If the token expires before deployment, select Generate deploy command again on the detail page to generate a new one.
You can safely re-run the same command to restart the gateway. The CLI detects the token has already been used locally and skips enrollment automatically.
6

Verify your gateway deployment

After deployment, verify your gateway is working:
  1. Check logs for the “Gateway started successfully” message. In direct listen mode you’ll also see “Direct gateway listener started” with the listen address it’s advertising and the port it bound.
  2. Verify registration in the Infisical UI. Go to Networking > Gateways and confirm the gateway shows a Healthy status. A gateway running both modes stays healthy while either one works.
  3. Test connectivity by creating a resource that uses the gateway to access a private service.

Managing a gateway

From the gateway’s detail page (select the gateway row in the list):
  • Generate deploy command: Generates a fresh enrollment token (token method) or re-displays the start command for the AWS and Kubernetes methods. Selecting this on a token-method gateway doesn’t disconnect the running gateway; the next login with the new token rotates credentials atomically.
  • Edit auth method: Switch between Token, AWS, and Kubernetes, or update the allowlists of the current method. Existing gateways keep their JWT until they restart and re-authenticate.
  • Options → Revoke Access — Disconnects the running gateway and invalidates outstanding enrollment tokens. The gateway must re-authenticate to reconnect. Gated by the dedicated revoke-gateway-access permission, separate from edit-gateways.
  • Options → Delete Gateway — Permanently removes the gateway.
To migrate a gateway to a different host with zero downtime: select Generate deploy command to generate a fresh token, run it on the new host, and the new login will rotate credentials away from the old host.

Running both modes

A Gateway can run both modes at once. Pass --target-relay-name and --listen-address together, and Infisical uses the listen address first, falling back to the relay when that address stops answering. Health checks probe each mode separately, so the Gateway stays healthy while either one works. A Gateway declares its transports every time it registers, so its mode is set by which flags it starts with: Running both permanently only helps clients that can reach the listen address. PAM CLI sessions dial the Gateway from the user’s own machine, so a user outside the network waits for that attempt to time out before the session falls back to the relay. If most of your CLI users are outside the network, relay mode alone serves them better.

Frequently asked questions

That depends on the connection mode.In relay mode, no. The gateway only makes outbound connections:
  • Outbound SSH to relay servers on port 2222
  • Outbound HTTPS to Infisical API endpoints on port 443
  • SSH reverse tunnels carry all return traffic, so nothing needs to be configured for it
In direct listen mode, one inbound port has to be open: the port in your listen address, reachable from the Infisical instance host. Scope the rule to that host so the port isn’t open to anything else.
Yes. Open the gateway’s detail page, choose the mode you want under Connection Mode, and re-run the generated command on the host. The gateway re-registers with the new mode and is issued the certificate it needs for it.The new mode replaces the old one. To switch without an outage, start the Gateway with both flags first. If the listen address is wrong, the relay keeps serving and the Gateway page shows the direct path as unreachable. Once direct is healthy, drop --target-relay-name.
The listen address has to be host:port, with a port in the range 1 to 65535. Use gateway.internal:8443, not https://gateway.internal or gateway.internal: an address is rejected if it has no port, or if it carries a scheme or a path.Direct listen is also unavailable on Infisical Cloud, which runs outside your network and has no route into it. On Cloud, use relay mode.
Only from a machine that can reach the gateway’s listen address. The CLI connects to the gateway from the user’s own machine rather than through Infisical, so a laptop outside the network can’t reach a gateway listening on an internal address. Give those users a VPN into the network, or run a relay on the gateway alongside direct listen.Browser-based PAM access works in either mode, because the platform brokers that connection.
Test relay connectivity and outbound API access from the gateway:
  1. Test SSH port to relay:
  1. Test outbound API access (replace with your Infisical domain if different):
If the gateway can’t connect to the relay:
  1. Verify the relay server is running and accessible
  2. Check firewall rules allow outbound connections on port 2222
  3. Confirm the relay name matches exactly
  4. Test SSH port to relay:
The gateway registers and looks healthy only once Infisical can reach it, so start from the Infisical host:
  1. Confirm the gateway logged “Direct gateway listener started” and check the port it bound
  2. From the Infisical instance host, test the listen address:
  1. Check the inbound firewall rule allows the Infisical instance host on that port
  2. Confirm the listen address resolves from the Infisical host, not just from your own machine
If the gateway binds a different local port than the one you advertise, such as behind a load balancer, pass --bind to set the local address and keep --listen-address as the address Infisical dials.
For token method: ensure the enrollment token hasn’t expired or already been used. Open the gateway’s detail page and select Generate deploy command to generate a fresh token.For AWS method: ensure the host has AWS credentials available (instance role, env vars, or shared profile) and the resolved principal/account is in the allowlist on the gateway’s detail page.For Kubernetes method: ensure Infisical can reach the configured Kubernetes host, that the pod’s namespace and service account are in the allowlists, and that the reviewer (the gateway’s own service account by default) holds the system:auth-delegator ClusterRole. The gateway’s audit log records the reviewed namespace and service account name for each login, and the reason code for each failure.
Check gateway logs for detailed error information:
  • systemd service:
  • Local installation: Logs appear in the terminal where you started the gateway
Enrollment tokens expire after 1 hour. If the token expires before deployment, open the gateway’s detail page and select Generate deploy command to generate a new one.
For token-method gateways, the access token and domain are saved to a config file scoped by gateway name:
  • Running as root/sudo: /etc/infisical/gateways/<gateway-name>.conf
  • Running as a regular user: ~/.infisical/gateways/<gateway-name>.conf
For AWS-method and Kubernetes-method gateways, no JWT is persisted to disk. The gateway re-authenticates on every start, by signing a fresh STS request with the host’s AWS credentials or by presenting the pod’s service account token. Only the gateway id and domain are stored locally.For systemd-based installations, the configuration is at /etc/infisical/gateways/<gateway-name>.conf. All config files are created with restricted permissions (0600).
Yes. Each gateway stores its credentials in a separate config file scoped by name (e.g., ~/.infisical/gateways/my-gateway.conf). You can enroll and start multiple gateways in separate terminal sessions using different names.
The gateway is designed to handle network interruptions gracefully:
  • Automatic reconnection: The gateway will automatically attempt to reconnect to relay servers if the SSH connection is lost
  • Transport fallback: A gateway running both modes falls back to its relay when its listen address stops answering, and returns to direct connections once it recovers
  • Connection retry logic: Built-in retry mechanisms handle temporary network outages without manual intervention
  • Automatic failover: Gateways configured with automatic relay selection will switch to a different healthy relay if the current one becomes unreachable
  • Gateway Pools: If the gateway itself becomes unavailable, a Gateway Pool will automatically route through a healthy member
  • Persistent SSH tunnels: SSH connections are automatically re-established when connectivity is restored
  • Certificate rotation: The gateway handles certificate renewal automatically during reconnection
  • Graceful degradation: The gateway logs connection issues and continues attempting to restore connectivity
No manual intervention is typically required during network interruptions.