- CLI
- systemd
Description
The Infisical gateway provides secure access to private resources using modern TCP-based SSH tunnel architecture with enhanced security and flexible deployment options. The gateway system uses SSH reverse tunnels over TCP, eliminating firewall complexity and providing excellent performance for enterprise environments.Subcommands & flags
infisical gateway start
infisical gateway start
Run the Infisical gateway component within your the network where your target resources are located. The gateway establishes an SSH reverse tunnel to a relay server and provides secure access to private resources within your network.The gateway name is provided as a positional argument.Once started, the gateway component will:
By default, the gateway automatically connects to the relay with the lowest latency. To target a specific relay, use the
--target-relay-name=<relay-name> flag.- Automatically connect to a healthy relay with the lowest latency (unless the
--target-relay-nameflag is specified) - Establish outbound SSH reverse tunnel to relay server (no inbound firewall rules needed)
- Authenticate using SSH certificates issued by Infisical
- Automatically reconnect if the connection is lost
- Provide access to private resources within your network
Flags
--enroll-method
--enroll-method
The enrollment method to use. Currently only 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.
token is supported. Additional authentication methods will be available in the future.Flags
--target-relay-name
--target-relay-name
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, the gateway will automatically connect to a healthy relay with the lowest latency.Note: For Infisical Cloud users using instance relays, the relay infrastructure is already running and managed by Infisical. If using organization relays or self-hosted instance relays, you must first start a relay server. For more information on deploying relays, refer to the Relay Deployment Guide.
--domain
--domain
Domain of your self-hosted Infisical instance.
infisical gateway systemd install
infisical gateway systemd install
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
--enroll-method
--enroll-method
The enrollment method to use. Currently only
token is supported.--token
--token
The one-time enrollment token from the Infisical UI.
--domain
--domain
Domain of your self-hosted Infisical instance.
--target-relay-name
--target-relay-name
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, the gateway will automatically connect to a healthy relay with the lowest latency.Note: For Infisical Cloud users using instance relays, the relay infrastructure is already running and managed by Infisical. If using organization relays or self-hosted instance relays, you must first start a relay server. For more information on deploying relays, refer to the Relay Deployment Guide.
Service Details
The systemd service is installed with secure defaults:- Service file:
/etc/systemd/system/infisical-gateway.service - Config file:
/etc/infisical/gateway.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
Legacy Gateway Commands
infisical gateway (deprecated)
infisical gateway (deprecated)
Run the legacy Infisical gateway in the foreground. The gateway will connect to the relay service and maintain a persistent connection.
Other Flags
--domain
--domain
Domain of your self-hosted Infisical instance.
infisical gateway install (deprecated)
infisical gateway install (deprecated)
Install and enable the legacy 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
Service Details
The systemd service is installed with secure defaults:- Service file:
/etc/systemd/system/infisical-gateway.service - Config file:
/etc/infisical/gateway.conf - Runs with restricted privileges:
- InaccessibleDirectories=/home
- PrivateTmp=yes
- Resource limits configured for stability
- Automatically restarts on failure
- Enabled to start on boot
Frequently Asked Questions
Can I re-run the same enrollment command after a restart?
Can I re-run the same enrollment command after a restart?
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.How are relays auto-selected?
How are relays auto-selected?
If the
--target-relay-name flag is 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.When restarting the gateway without a relay flag, does it select a new relay every time?
When restarting the gateway without a relay flag, does it select a new relay every time?
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.
Will additional authentication methods be supported?
Will additional authentication methods be supported?
Yes. Additional gateway authentication methods are planned for future releases.