Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

docs: add enrollment token deployment method and update CLI reference

bernie-g1537cee7a425
diff --git a/docs/cli/commands/gateway.mdx b/docs/cli/commands/gateway.mdx
index e7da7a74f6..69712bff6c 100644
--- a/docs/cli/commands/gateway.mdx
+++ b/docs/cli/commands/gateway.mdx
@@ -4,14 +4,24 @@ description: "Run the Infisical gateway or manage its systemd service"
---
<Tabs>
- <Tab title="Start gateway">
+ <Tab title="Enrollment token">
```bash
- sudo infisical gateway start --name=<name> --auth-method=<auth-method>
+ infisical gateway start <name> --enroll-method=static --token=<enrollment-token> --domain=<domain>
```
</Tab>
- <Tab title="Start gateway as background daemon (Linux only)">
+ <Tab title="Machine identity">
```bash
- sudo infisical gateway systemd install --token=<token> --domain=<domain> --name=<name>
+ infisical gateway start <name> --auth-method=<auth-method>
+ ```
+ </Tab>
+ <Tab title="systemd (enrollment token)">
+ ```bash
+ sudo infisical gateway systemd install <name> --enroll-method=static --token=<enrollment-token> --domain=<domain>
+ ```
+ </Tab>
+ <Tab title="systemd (machine identity)">
+ ```bash
+ sudo infisical gateway systemd install <name> --token=<token> --domain=<domain>
```
</Tab>
</Tabs>
@@ -36,9 +46,11 @@ If you are moving from Gateway v1 to Gateway v2, this is NOT a drop-in switch. G
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.
```bash
-sudo infisical gateway start --name=<name> --auth-method=<auth-method>
+infisical gateway start <name> --enroll-method=static --token=<enrollment-token> --domain=<domain>
```
+The gateway name is provided as a positional argument. The `--name` flag is still accepted for backwards compatibility but is deprecated.
+
<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>
@@ -56,6 +68,34 @@ Once started, the gateway component will:
The Gateway supports multiple authentication methods. Below are the available authentication methods, with their respective flags.
<AccordionGroup>
+ <Accordion title="Enrollment Token (Recommended)">
+ The simplest way to deploy a gateway. Create the gateway in the Infisical UI, which generates a one-time enrollment token. The CLI enrolls and starts the gateway in a single command.
+
+ <ParamField query="Flags">
+ <Expandable title="properties">
+ <ParamField query="enroll-method" type="string" required>
+ Must be `static` 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=static --token=<enrollment-token> --domain=https://app.infisical.com
+ ```
+
+ After enrollment, the gateway saves its credentials locally. On subsequent restarts, just run:
+
+ ```bash
+ infisical gateway start my-gateway
+ ```
+
+ </Accordion>
<Accordion title="Universal Auth">
The Universal Auth method is a simple and secure way to authenticate with Infisical. It requires a client ID and a client secret to authenticate with Infisical.
@@ -74,7 +114,7 @@ The Gateway supports multiple authentication methods. Below are the available au
</ParamField>
```bash
- sudo infisical gateway start --auth-method=universal-auth --client-id=<client-id> --client-secret=<client-secret> --name=<name>
+ infisical gateway start <name> --auth-method=universal-auth --client-id=<client-id> --client-secret=<client-secret>
```
</Accordion>
@@ -98,7 +138,7 @@ The Gateway supports multiple authentication methods. Below are the available au
```bash
- sudo infisical gateway start --auth-method=kubernetes --machine-identity-id=<machine-identity-id> --name=<name>
+ infisical gateway start <name> --auth-method=kubernetes --machine-identity-id=<machine-identity-id>
```
</Accordion>
@@ -119,7 +159,7 @@ The Gateway supports multiple authentication methods. Below are the available au
```bash
- sudo infisical gateway start --auth-method=azure --machine-identity-id=<machine-identity-id> --name=<name>
+ infisical gateway start <name> --auth-method=azure --machine-identity-id=<machine-identity-id>
```
</Accordion>
@@ -140,7 +180,7 @@ The Gateway supports multiple authentication methods. Below are the available au
```bash
- sudo infisical gateway start --auth-method=gcp-id-token --machine-identity-id=<machine-identity-id> --name=<name>
+ infisical gateway start <name> --auth-method=gcp-id-token --machine-identity-id=<machine-identity-id>
```
</Accordion>
@@ -162,7 +202,7 @@ The Gateway supports multiple authentication methods. Below are the available au
</ParamField>
```bash
- sudo infisical gateway start --auth-method=gcp-iam --machine-identity-id=<machine-identity-id> --service-account-key-file-path=<service-account-key-file-path> --name=<name>
+ infisical gateway start <name> --auth-method=gcp-iam --machine-identity-id=<machine-identity-id> --service-account-key-file-path=<service-account-key-file-path>
```
</Accordion>
@@ -181,7 +221,7 @@ The Gateway supports multiple authentication methods. Below are the available au
</ParamField>
```bash
- sudo infisical gateway start --auth-method=aws-iam --machine-identity-id=<machine-identity-id> --name=<name>
+ infisical gateway start <name> --auth-method=aws-iam --machine-identity-id=<machine-identity-id>
```
</Accordion>
@@ -203,7 +243,7 @@ The Gateway supports multiple authentication methods. Below are the available au
</ParamField>
```bash
- sudo infisical gateway start --auth-method=oidc-auth --machine-identity-id=<machine-identity-id> --jwt=<oidc-jwt> --name=<name>
+ infisical gateway start <name> --auth-method=oidc-auth --machine-identity-id=<machine-identity-id> --jwt=<oidc-jwt>
```
</Accordion>
@@ -227,7 +267,7 @@ The Gateway supports multiple authentication methods. Below are the available au
```bash
- sudo infisical gateway start --auth-method=jwt-auth --jwt=<jwt> --machine-identity-id=<machine-identity-id> --name=<name>
+ infisical gateway start <name> --auth-method=jwt-auth --jwt=<jwt> --machine-identity-id=<machine-identity-id>
```
</Accordion>
@@ -243,7 +283,7 @@ The Gateway supports multiple authentication methods. Below are the available au
</ParamField>
```bash
- sudo infisical gateway start --token=<token> --name=<name>
+ infisical gateway start <name> --token=<token>
```
</Accordion>
@@ -259,19 +299,32 @@ The Gateway supports multiple authentication methods. Below are the available au
```bash
# Example
- sudo infisical gateway start --target-relay-name=my-relay --name=my-gateway --token=<token>
+ infisical gateway start my-gateway --target-relay-name=my-relay --token=<token>
```
**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).
</Accordion>
- <Accordion title="--name">
- The name of the gateway instance.
+ <Accordion title="--name (deprecated)">
+ The name of the gateway instance. Deprecated in favor of the positional argument.
+
+ ```bash
+ # Preferred (positional argument)
+ infisical gateway start my-gateway --token=<token>
+
+ # Deprecated (flag)
+ infisical gateway start my-gateway --token=<token>
+ ```
+
+ </Accordion>
+
+ <Accordion title="--enroll-method">
+ The enrollment method to use. When set to `static`, the `--token` flag is treated as a one-time enrollment token instead of a machine identity access token.
```bash
# Example
- sudo infisical gateway start --name=my-gateway --token=<token>
+ infisical gateway start my-gateway --enroll-method=static --token=<enrollment-token> --domain=<domain>
```
</Accordion>
@@ -281,7 +334,7 @@ The Gateway supports multiple authentication methods. Below are the available au
```bash
# Example
- sudo infisical gateway start --domain=https://app.your-domain.com --name=<name>
+ infisical gateway start <name> --domain=https://app.your-domain.com
```
</Accordion>
@@ -289,10 +342,14 @@ The Gateway supports multiple authentication methods. Below are the available au
</Accordion>
<Accordion title="infisical gateway systemd install">
- Install and enable the gateway as a systemd service. This command must be run with sudo on Linux.
+ Install and enable the gateway as a systemd service. This command must be run with sudo on Linux. Supports both enrollment token and machine identity authentication.
```bash
-sudo infisical gateway systemd install --token=<token> --domain=<domain> --name=<name>
+# Enrollment token
+sudo infisical gateway systemd install my-gateway --enroll-method=static --token=<enrollment-token> --domain=<domain>
+
+# Machine identity
+sudo infisical gateway systemd install my-gateway --token=<machine-identity-token> --domain=<domain>
```
### Requirements
@@ -304,12 +361,22 @@ sudo infisical gateway systemd install --token=<token> --domain=<domain> --name=
### Flags
<AccordionGroup>
+ <Accordion title="--enroll-method">
+ The enrollment method to use. When set to `static`, the `--token` flag is treated as a one-time enrollment token.
+
+ ```bash
+ # Example
+ sudo infisical gateway systemd install my-gateway --enroll-method=static --token=<enrollment-token> --domain=<domain>
+ ```
+
+ </Accordion>
+
<Accordion title="--token">
- The machine identity access token to authenticate with Infisical.
+ The authentication token. When `--enroll-method=static` is set, this is a one-time enrollment token. Otherwise, it is a machine identity access token.
```bash
# Example
- sudo infisical gateway systemd install --token=<token> --name=<name>
+ sudo infisical gateway systemd install my-gateway --token=<token>
```
You may also expose the token to the CLI by setting the environment variable `INFISICAL_TOKEN` before executing the install command.
@@ -321,16 +388,19 @@ sudo infisical gateway systemd install --token=<token> --domain=<domain> --name=
```bash
# Example
- sudo infisical gateway systemd install --domain=https://app.your-domain.com --name=<name>
+ sudo infisical gateway systemd install my-gateway --domain=https://app.your-domain.com
```
</Accordion>
- <Accordion title="--name">
- The name of the gateway instance.
+ <Accordion title="--name (deprecated)">
+ The name of the gateway instance. Deprecated in favor of the positional argument.
```bash
- # Example
+ # Preferred (positional argument)
+ sudo infisical gateway systemd install my-gateway --token=<token>
+
+ # Deprecated (flag)
sudo infisical gateway systemd install --name=my-gateway --token=<token>
```
@@ -343,7 +413,7 @@ sudo infisical gateway systemd install --token=<token> --domain=<domain> --name=
```bash
# Example
- sudo infisical gateway systemd install --target-relay-name=my-relay --token=<token> --name=<name>
+ sudo infisical gateway systemd install <name> --target-relay-name=my-relay --token=<token>
```
**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).
diff --git a/docs/documentation/platform/gateways/gateway-deployment.mdx b/docs/documentation/platform/gateways/gateway-deployment.mdx
index 0d81367754..0e2b8c30cb 100644
--- a/docs/documentation/platform/gateways/gateway-deployment.mdx
+++ b/docs/documentation/platform/gateways/gateway-deployment.mdx
@@ -6,9 +6,100 @@ description: "Complete guide to deploying Infisical Gateways including network c
Infisical Gateways enables secure communication between your private resources and the Infisical platform without exposing inbound ports in your network.
This guide covers everything you need to deploy and configure Infisical Gateways.
-## Deployment Steps
+## Deployment Methods
-To successfully deploy an Infisical Gateway for use, follow these steps in order.
+Infisical supports two methods for deploying gateways. Choose the one that fits your workflow:
+
+- **Enrollment Token (Recommended):** Create the gateway from the Infisical UI and run a single CLI command on the target machine. No machine identity setup required.
+- **Machine Identity:** Provision a machine identity in advance and use its credentials to authenticate the gateway. Useful for automated/programmatic deployments.
+
+---
+
+## Method 1: Enrollment Token
+
+The enrollment token method lets you create and deploy a gateway without provisioning a machine identity. You create the gateway in the Infisical UI, which gives you a one-time CLI command to run on the target machine.
+
+<Steps>
+ <Step title="Set Up a Relay Server">
+ Ensure a relay server is running and accessible before you deploy any gateways. You have two options:
+ - **Managed relay (Infisical Cloud, US/EU only):** If you are using Infisical Cloud in the US or EU regions, you can use the provided managed relay.
+ - **Self-hosted relay:** For all other cases, you must deploy your own relay server. See the [Relay Deployment Guide](/documentation/platform/gateways/relay-deployment).
+ </Step>
+ <Step title="Create the Gateway in the UI">
+ 1. Navigate to **Organization Settings > Networking > Gateways**.
+ 2. Click **Create Gateway**.
+ 3. Enter a name for your gateway and select a relay (or use "Auto Select Relay").
+ 4. Choose your deployment method (CLI or systemd).
+ 5. Copy the generated CLI command. The command includes a one-time enrollment token that expires in 1 hour.
+ </Step>
+ <Step title="Install the Infisical CLI">
+ Make sure the Infisical CLI is installed on the target machine. See the [CLI Installation Guide](/cli/overview) for instructions.
+ </Step>
+ <Step title="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.
+
+ <Tabs>
+ <Tab title="Linux Server (Production)">
+ For production deployments on Linux, install as a systemd service:
+ ```bash
+ sudo infisical gateway systemd install my-gateway \
+ --enroll-method=static \
+ --token=<enrollment-token> \
+ --domain=<your-infisical-domain>
+ sudo systemctl start infisical-gateway
+ ```
+ </Tab>
+ <Tab title="Development & Testing">
+ For development or testing, run directly in the foreground:
+ ```bash
+ infisical gateway start my-gateway \
+ --enroll-method=static \
+ --token=<enrollment-token> \
+ --domain=<your-infisical-domain>
+ ```
+ </Tab>
+ </Tabs>
+
+ <Info>
+ The enrollment token can only be used once and expires after 1 hour. If it expires, use the **Re-enroll** option in the gateway's context menu to generate a new one.
+ </Info>
+ </Step>
+ <Step title="Verify Your Gateway Deployment">
+ After deployment, verify your gateway is working:
+ 1. **Check logs** for "Gateway started successfully" message.
+ 2. **Verify registration** in the Infisical UI. Navigate to **Networking > Gateways** and confirm the gateway shows a "Healthy" status.
+ 3. **Test connectivity** by creating a resource that uses the gateway to access a private service.
+ </Step>
+</Steps>
+
+### Gateway Lifecycle States
+
+After creating a gateway, it will transition through the following states in the UI:
+
+| State | Description |
+| --- | --- |
+| **Pending** | Enrollment token created, waiting for the CLI command to be run. |
+| **Expired** | Enrollment token expired before being used. Use **Re-enroll** to generate a new one. |
+| **Unregistered** | Gateway enrolled but has not connected yet (e.g., waiting for first heartbeat). |
+| **Healthy** | Gateway is connected and responding to health checks. |
+| **Unreachable** | Gateway was previously connected but the last health check failed. |
+| **Re-enrolling** | A re-enrollment token has been created. The existing gateway continues running until the new machine enrolls. |
+
+### Re-enrollment
+
+To move a gateway to a different machine or regenerate its credentials:
+
+1. Click the context menu (three dots) next to the gateway and select **Re-enroll**.
+2. Copy the new CLI command and run it on the new machine.
+3. The existing gateway continues running until the new machine enrolls. Once the new machine connects, the old machine's credentials are automatically revoked. This enables zero-downtime machine migrations.
+
+---
+
+## Method 2: Machine Identity
+
+The machine identity method uses pre-provisioned credentials to authenticate the gateway. This is useful for automated deployments where you manage identities programmatically.
+
+### Deployment Steps
<Steps>
<Step title="Provision a Machine Identity">
@@ -122,7 +213,7 @@ To successfully deploy an Infisical Gateway for use, follow these steps in order
<Tab title="Linux Server (Production)">
For production deployments on Linux servers, install the Gateway as a systemd service so that it runs securely in the background and automatically restarts on failure or system reboot:
```bash
- sudo infisical gateway systemd install --token <your-machine-identity-token> --domain <your-infisical-domain> --name <gateway-name>
+ sudo infisical gateway systemd install <gateway-name> --token <your-machine-identity-token> --domain <your-infisical-domain>
sudo systemctl start infisical-gateway
```
@@ -173,7 +264,7 @@ To successfully deploy an Infisical Gateway for use, follow these steps in order
For development or testing environments:
```bash
- sudo infisical gateway start --token <token> --name=<gateway-name>
+ infisical gateway start <gateway-name> --token <token>
```
<Info>