docs/cli/commands/gateway.mdx
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.
<Warning> **Deprecation and Migration Notice:** The legacy `infisical gateway` command (v1) will be removed in a future release. Please migrate to `infisical gateway start` (Gateway v2).If you are moving from Gateway v1 to Gateway v2, this is NOT a drop-in switch. Gateway v2 creates new gateway instances with new gateway IDs. You must update any existing resources that reference gateway IDs (for example: dynamic secret configs, app connections, or other gateway-bound resources) to point to the new Gateway v2 gateway resource. Until you update those references, traffic will continue to target the old v1 gateway.
</Warning>infisical gateway start <name> --enroll-method=token --token=<enrollment-token> --domain=<domain>
The gateway name is provided as a positional argument.
<Info> 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. </Info>Once started, the gateway component will:
--target-relay-name flag is specified) <ParamField query="Flags">
<Expandable title="properties">
<ParamField query="enroll-method" type="string" required>
Must be `token` when using an enrollment token.
</ParamField>
<ParamField query="token" type="string" required>
The one-time enrollment token from the Infisical UI.
</ParamField>
<ParamField query="domain" type="string" required>
The URL of your Infisical instance.
</ParamField>
</Expandable>
</ParamField>
```bash
infisical gateway start my-gateway --enroll-method=token --token=<enrollment-token> --domain=https://app.infisical.com
```
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.
If this flag is omitted, the gateway will automatically connect to a healthy relay with the lowest latency.
```bash
# Example
infisical gateway start my-gateway --target-relay-name=my-relay --enroll-method=token --token=<token> --domain=<domain>
```
**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](/documentation/platform/gateways/relay-deployment).
```bash
# Example
infisical gateway start <name> --domain=https://app.your-domain.com --enroll-method=token --token=<token>
```
sudo infisical gateway systemd install my-gateway --enroll-method=token --token=<enrollment-token> --domain=<domain>
```bash
# Example
sudo infisical gateway systemd install my-gateway --enroll-method=token --token=<enrollment-token> --domain=<domain>
```
```bash
# Example
sudo infisical gateway systemd install my-gateway --enroll-method=token --token=<token> --domain=<domain>
```
```bash
# Example
sudo infisical gateway systemd install my-gateway --enroll-method=token --token=<token> --domain=https://app.your-domain.com
```
If this flag is omitted, the gateway will automatically connect to a healthy relay with the lowest latency.
```bash
# Example
sudo infisical gateway systemd install my-gateway --target-relay-name=my-relay --enroll-method=token --token=<token> --domain=<domain>
```
**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](/documentation/platform/gateways/relay-deployment).
The systemd service is installed with secure defaults:
/etc/systemd/system/infisical-gateway.service/etc/infisical/gateway.confAfter installation, manage the service with standard systemd commands:
sudo systemctl start infisical-gateway # Start the service
sudo systemctl stop infisical-gateway # Stop the service
sudo systemctl status infisical-gateway # Check service status
sudo systemctl disable infisical-gateway # Disable auto-start on boot
Please migrate to infisical gateway start for the new TCP-based SSH tunnel architecture.
Migration required: If you are currently using Gateway v1 (via infisical gateway), moving to Gateway v2 is not in-place. Gateway v2 provisions new gateway instances with new gateway IDs. Update any resources that reference a gateway ID (for example: dynamic secret configs, app connections, or other gateway-bound resources) to use the new Gateway v2 gateway ID. Until you update those references, traffic will continue to target the old v1 gateway.
Run the legacy Infisical gateway in the foreground. The gateway will connect to the relay service and maintain a persistent connection.
infisical gateway --domain=<domain> --auth-method=<auth-method>
```bash
# Example
infisical gateway --domain=https://app.your-domain.com
```
Please migrate to infisical gateway systemd install for the new TCP-based SSH tunnel architecture with enhanced security and better performance.
Migration required: If you previously installed Gateway v1 via infisical gateway install, moving to Gateway v2 is not in-place. Gateway v2 provisions new gateway instances with new gateway IDs. Update any resources that reference a gateway ID (for example: dynamic secret configs, app connections, or other gateway-bound resources) to use the new Gateway v2 gateway ID. Until you update those references, traffic will continue to target the old v1 gateway.
Install and enable the legacy gateway as a systemd service. This command must be run with sudo on Linux.
sudo infisical gateway install --token=<token> --domain=<domain>
The systemd service is installed with secure defaults:
/etc/systemd/system/infisical-gateway.service/etc/infisical/gateway.confAfter installation, manage the service with standard systemd commands:
sudo systemctl start infisical-gateway # Start the service
sudo systemctl stop infisical-gateway # Stop the service
sudo systemctl status infisical-gateway # Check service status
sudo systemctl disable infisical-gateway # Disable auto-start on boot