Skip to main content

Description

The Infisical gateway runs inside your network and lets Infisical reach systems that aren’t exposed to the internet, such as a database in a private subnet or an on-premises appliance. There are two ways the gateway and Infisical reach each other:
  • Direct listen. The gateway listens on the address you set with --listen-address, and Infisical connects to it. No relay is needed. Self-hosted Infisical only.
  • Relay. The gateway opens an SSH reverse tunnel to a relay server, and Infisical reaches it back through that tunnel. No inbound ports have to be open on the gateway host.
Passing --listen-address and --target-relay-name together runs both, and Infisical uses the listen address first, keeping the relay as a fallback. See Gateway deployment for choosing a mode and the full deployment walkthrough, and Network architecture for the ports and traffic flow of each.

Subcommands & flags

infisical gateway start

Run the gateway inside the network where your target resources live. It connects to Infisical over a relay or by listening for direct connections, depending on the flags below.
The gateway name is provided as a positional argument.
With no --listen-address and no --target-relay-name, the gateway connects to the relay with the lowest latency. To target a specific relay, use --target-relay-name=<relay-name>. To skip relays entirely, use --listen-address=<host:port>.
Once started, the gateway component will:
  • Authenticate using certificates issued by Infisical
  • Automatically renew its certificates
In relay mode it also:
  • Connects to a healthy relay with the lowest latency, unless --target-relay-name names one
  • Establishes an outbound SSH reverse tunnel to the relay, so no inbound firewall rules are needed
  • Reconnects if the connection is lost, and fails over to a different healthy relay if the current one becomes unreachable
In direct listen mode it also:
  • Binds the port from --listen-address on every interface, unless --bind says otherwise
  • Accepts mutually authenticated TLS connections from Infisical on that port

Flags

How the gateway authenticates with Infisical. Must match the auth method configured on the gateway in the Infisical UI. One of token, aws, or kubernetes.
A one-time enrollment token from the Infisical UI bootstraps the gateway.
After enrollment, the gateway saves its credentials locally. You can safely re-run the same command to restart the gateway. It will detect the token has already been used and skip enrollment automatically.
The name of the relay that this gateway should connect to. The relay must be running and registered before starting the gateway.If this flag is omitted and no --listen-address is set, the gateway connects to a healthy relay with the lowest latency.
Can also be set with the INFISICAL_RELAY_NAME environment variable.For Infisical Cloud users on instance relays, the relay infrastructure is already running and managed by Infisical. If using organization relays or self-hosted instance relays, start a relay server first. See the Relay Deployment Guide.
The host:port address that Infisical dials to reach this gateway. Setting it runs the gateway in direct listen mode, where Infisical opens the connection and no relay is involved.The address has to be reachable from wherever Infisical runs, and it’s written into the gateway’s server certificate, so it has to be stable. An internal DNS name or a load balancer in front of the gateway both work. Changing it means re-running the command so a certificate is issued for the new address.
Pass it alongside --target-relay-name to run both modes, so Infisical uses the listen address first and falls back to the relay. Running both modes covers when to keep both, and how to use it to switch modes without an outage:
Can also be set with the INFISICAL_GATEWAY_LISTEN_ADDRESS environment variable.
Direct listen is only available on self-hosted Infisical.
The local host:port the gateway binds for direct connections. Defaults to every interface on the port from --listen-address. Reach for this flag only when the address Infisical dials differs from the socket the gateway should open.Use it to bind a single interface, or to listen on a different local port than the one advertised, such as behind a load balancer that terminates on 8443 and forwards to 9000.
Can also be set with the INFISICAL_GATEWAY_BIND_ADDRESS environment variable. Has no effect without --listen-address.
Domain of your self-hosted Infisical instance.
Absolute path to the PKCS#11 driver shipped by your HSM vendor. When set, the gateway loads the driver on startup and is reachable by HSM Connectors for signing operations.
See HSM Connectors for the full setup.
Install and enable the gateway as a systemd service. This command must be run with sudo on Linux.

Requirements

  • Must be run on Linux
  • Must be run with root/sudo privileges
  • Requires systemd

Flags

How the gateway authenticates with Infisical. One of token or aws.
kubernetes is not available here. In-cluster gateways are not managed by systemd, so run infisical gateway start --enroll-method=kubernetes as the container command instead.
The one-time enrollment token from the Infisical UI.
Domain of your self-hosted Infisical instance.
The name of the relay that this gateway should connect to. The relay must be running and registered before starting the gateway.If this flag is omitted and no --listen-address is set, the gateway connects to a healthy relay with the lowest latency.
For Infisical Cloud users on instance relays, the relay infrastructure is already running and managed by Infisical. If using organization relays or self-hosted instance relays, start a relay server first. See the Relay Deployment Guide.
The host:port address that Infisical dials to reach this gateway, which runs it in direct listen mode.
Pass it alongside --target-relay-name to run both modes. See the infisical gateway start reference above for what the address has to satisfy.
The local host:port the gateway binds for direct connections. Defaults to every interface on the port from --listen-address.
Absolute path to the PKCS#11 driver shipped by your HSM vendor. When set, the systemd unit captures the flag so every restart loads the same driver and the gateway is reachable by HSM Connectors.
See HSM Connectors for the full setup.

Service details

The systemd service is installed with secure defaults:
  • Service file: /etc/systemd/system/<gateway-name>.service
  • Config file: /etc/infisical/gateways/<gateway-name>.conf
  • Runs with restricted privileges:
    • InaccessibleDirectories=/home
    • PrivateTmp=yes
    • Resource limits configured for stability
  • Automatically restarts on failure
  • Enabled to start on boot
  • Maintains persistent SSH reverse tunnel connections to the specified relay
  • Handles certificate rotation and connection recovery automatically
After installation, manage the service with standard systemd commands (replace my-gateway with your gateway name):
Uninstall and remove the gateway systemd service. This command must be run with sudo on Linux.
The gateway name is provided as a positional argument.

Frequently asked questions

Yes. The CLI stores the enrollment token locally after the first successful enrollment. If you run the same command again with the same --token value, it detects the token has already been used and skips enrollment, proceeding directly to start the gateway. This means you can safely use the same command (e.g., via up-arrow in your shell) without getting “token already used” or “token expired” errors.
If --target-relay-name and --listen-address are both omitted, the gateway automatically selects the optimal relay. It first checks for healthy organization relays and connects to the one with the lowest latency. If no organization relays are available, it then performs the same latency-based selection among the available managed relays.If the selected relay becomes unreachable while the gateway is running, the gateway will automatically switch to a different healthy one. Gateways started with an explicit --target-relay-name do not switch and will keep retrying the specified relay.
Relay mode, with a relay chosen automatically. Direct listen is opt-in: the gateway only listens for connections when you pass --listen-address.
No. The first time the gateway starts, it selects the optimal relay (based on latency) and caches that selection. On subsequent restarts, it will prioritize connecting to the cached relay. If it’s unable to connect, it will then re-evaluate and connect to the next most optimal relay available.
Yes. Additional gateway authentication methods are planned for future releases.