Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
docs(gateways): address review feedback on the direct listen docs
bernie-g859d56be0937
diff --git a/docs/cli/commands/gateway.mdx b/docs/cli/commands/gateway.mdxindex d1171eea89..2c58d4fb5d 100644--- a/docs/cli/commands/gateway.mdx+++ b/docs/cli/commands/gateway.mdx@@ -22,10 +22,10 @@ The Infisical gateway runs inside your network and lets Infisical reach systemsThere are two ways the gateway and Infisical reach each other:-- **Direct listen.** The gateway listens on an address you register with `--listen-address`, and Infisical connects to it. No relay is needed. Self-hosted Infisical only.+- **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 `--relay` together runs both, and Infisical uses the direct address first, keeping the relay as a fallback. See [Network architecture](/documentation/platform/gateways/network-architecture) for the ports and traffic flow of each.+Passing `--listen-address` and `--relay` together runs both, and Infisical uses the listen address first, keeping the relay as a fallback. See [Network architecture](/documentation/platform/gateways/network-architecture) for the ports and traffic flow of each.## Subcommands & flags@@ -147,10 +147,6 @@ In direct listen mode it also: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](/documentation/platform/gateways/relay-deployment).- <Note>- This flag was previously named `--target-relay-name`, which still works but is deprecated.- </Note>-</Accordion><Accordion title="--listen-address">@@ -163,7 +159,7 @@ In direct listen mode it also:infisical gateway start my-gateway --listen-address=gateway.internal:8443 --enroll-method=token --token=<token> --domain=<domain>```- Pass it alongside `--relay` to run both modes, so Infisical uses the direct address first and falls back to the relay. This is how you switch an existing gateway between modes without an outage, and [Running both modes](/documentation/platform/gateways/network-architecture#running-both-modes) covers when to keep both:+ Pass it alongside `--relay` to run both modes, so Infisical uses the listen address first and falls back to the relay. This is how you switch an existing gateway between modes without an outage, and [Switching modes without an outage](/documentation/platform/gateways/gateway-deployment#switching-modes-without-an-outage) covers when to keep both:```bashinfisical gateway start my-gateway --listen-address=gateway.internal:8443 --relay=my-relay --enroll-method=token --token=<token> --domain=<domain>@@ -172,7 +168,7 @@ In direct listen mode it also:Can also be set with the `INFISICAL_GATEWAY_LISTEN_ADDRESS` environment variable.<Note>- Direct listen is available on self-hosted Infisical. Infisical Cloud runs outside your network and has no route into it, leaving no address it could dial. On Cloud, use `--relay` or omit both flags.+ Direct listen is only available on self-hosted Infisical.</Note></Accordion>@@ -277,14 +273,10 @@ sudo infisical gateway systemd install my-gateway --enroll-method=token --token=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](/documentation/platform/gateways/relay-deployment).- <Note>- This flag was previously named `--target-relay-name`, which still works but is deprecated.- </Note>-</Accordion><Accordion title="--listen-address">- The `host:port` address that Infisical dials to reach this gateway, which runs it in direct listen mode. The systemd unit captures the flag, so every restart advertises the same address.+ The `host:port` address that Infisical dials to reach this gateway, which runs it in direct listen mode.```bash# Example@@ -369,11 +361,6 @@ The gateway name is provided as a positional argument.<Accordion title="Which mode do I get if I pass no connection flags?">Relay mode, with a relay chosen automatically. Direct listen is opt-in: the gateway only listens for connections when you pass `--listen-address`.</Accordion>- <Accordion title="Do PAM sessions work in direct listen mode?">- Browser-based sessions work in either mode, because the platform brokers the connection. `infisical pam access` connects from your own machine instead, so it needs to reach the gateway's registered address.-- See [Gateway deployment](/documentation/platform/gateways/gateway-deployment#frequently-asked-questions) for what to give users outside the network.- </Accordion><Accordion title="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.</Accordion>diff --git a/docs/contributing/platform/pam-development.mdx b/docs/contributing/platform/pam-development.mdxindex 84e93e0b79..bf6ec15316 100644--- a/docs/contributing/platform/pam-development.mdx+++ b/docs/contributing/platform/pam-development.mdx@@ -1,9 +1,9 @@---title: "PAM local development"-description: "Set up relay and gateway servers for local PAM development."+description: "Set up a gateway for local PAM development."----This guide covers setting up the relay and gateway components for local PAM (Privileged Access Management) development. It assumes you already have the Infisical platform running locally.+This guide covers setting up a gateway for local PAM (Privileged Access Management) development. It assumes you already have the Infisical platform running locally.<Note>If you haven't set up the Infisical platform yet, follow the [local development guide](/contributing/platform/developing) first.@@ -11,7 +11,7 @@ If you haven't set up the Infisical platform yet, follow the [local development## Local development setup-In a local dev environment, the Infisical platform runs inside Docker while the relay and gateway run directly on your host machine:+In a local dev environment, the Infisical platform runs inside Docker while the gateway runs directly on your host machine. Use direct listen mode: the backend dials the gateway, so there's no relay to run.```mermaidgraph LR@@ -22,7 +22,6 @@ graph LRendsubgraph Host ["Host Machine (go run)"]- Relay["Relay Server<br/>(go run main.go relay)"]Gateway["Gateway<br/>(go run main.go gateway)"]end@@ -30,19 +29,17 @@ graph LRTarget[("Local DB / Server")]end- Backend <-->|"host.docker.internal"| Relay- Relay <-->|"SSH tunnel"| Gateway+ Backend <-->|"host.docker.internal:8443 · mTLS"| GatewayGateway <--> Target```| Component | Where it runs | What it does ||-----------|---------------|--------------|| **Infisical Platform** | Docker | Backend API, database, Redis |-| **Relay Server** | Host machine | Routes traffic between backend and gateway || **Gateway** | Host machine | Proxies connections to local resources |<Note>-The relay uses `host.docker.internal` so the Dockerized backend can reach it on your host machine.+The gateway listens on `host.docker.internal` so the Dockerized backend can reach it on your host machine.</Note>For more details on the production architecture, see:@@ -57,36 +54,40 @@ For more details on the production architecture, see:## Clone the CLI repository-The relay and gateway live in the [Infisical CLI repository](https://github.com/Infisical/cli). For local development, run them via `go run main.go` rather than the pre-built binary:+The gateway lives in the [Infisical CLI repository](https://github.com/Infisical/cli). For local development, run it via `go run main.go` rather than the pre-built binary:```bashgit clone https://github.com/Infisical/cli.gitcd cli```-## Start the Relay server+## Start the GatewayFrom the CLI repository root:```bash-go run main.go relay start \- --name=local-relay \+go run main.go gateway start \--token=<your-token> \--domain=http://localhost:8080 \- --host=host.docker.internal+ --listen-address=host.docker.internal:8443 \+ --name=local-gateway \+ --pam-session-recording-path=$(pwd)/session```-<Note>-Use `host.docker.internal` because the Infisical backend runs inside Docker and needs to reach the relay on your host machine.-</Note>--Verify registration at **Organization Settings** > **Networking** > **Relays**.+Verify registration at **Organization Settings** > **Networking** > **Gateways**.-For all available flags, see the [Relay CLI Reference](/cli/commands/relay).+For all available flags, see the [Gateway CLI Reference](/cli/commands/gateway).-## Start the Gateway+<Accordion title="Using a relay instead">+Direct listen needs nothing else running, so prefer it unless you're testing relay behaviour itself. For that, start a relay first and point the gateway at it with `--relay` instead of `--listen-address`:-In a new terminal, from the CLI repository root:+```bash+go run main.go relay start \+ --name=local-relay \+ --token=<your-token> \+ --domain=http://localhost:8080 \+ --host=host.docker.internal+``````bashgo run main.go gateway start \@@ -97,16 +98,14 @@ go run main.go gateway start \--pam-session-recording-path=$(pwd)/session```-Verify registration at **Organization Settings** > **Networking** > **Gateways**.--For all available flags, see the [Gateway CLI Reference](/cli/commands/gateway).+Verify the relay at **Organization Settings** > **Networking** > **Relays**. See the [Relay CLI Reference](/cli/commands/relay) for all flags.+</Accordion>## Quick reference| Component | Command ||-----------|---------|-| Relay | `go run main.go relay start --name=local-relay --token=<token> --domain=http://localhost:8080 --host=host.docker.internal` |-| Gateway | `go run main.go gateway start --token=<token> --domain=http://localhost:8080 --relay=local-relay --name=local-gateway --pam-session-recording-path=$(pwd)/session` |+| Gateway | `go run main.go gateway start --token=<token> --domain=http://localhost:8080 --listen-address=host.docker.internal:8443 --name=local-gateway --pam-session-recording-path=$(pwd)/session` |## Seed test resources@@ -148,18 +147,18 @@ You're not locked into this stack — PAM works against anything reachable from## Troubleshooting<AccordionGroup>-<Accordion title="Relay/Gateway cannot connect to Infisical">-Ensure the backend is fully started before running relay/gateway. Check logs:+<Accordion title="Gateway cannot connect to Infisical">+Ensure the backend is fully started before running the gateway. Check logs:```bashdocker compose -f docker-compose.dev.yml logs -f backend```</Accordion>-<Accordion title="Gateway cannot connect to relay">-- Verify relay is running and registered in the UI-- Check `--relay` matches relay's `--name`-- Ensure port 2222 isn't blocked+<Accordion title="Backend cannot reach the gateway">+- Check the gateway logs for "Direct gateway listener started"+- Ensure `--listen-address` uses `host.docker.internal`, not `localhost`, so the Dockerized backend can reach your host+- Ensure the port isn't already in use</Accordion><Accordion title="Cannot reach local resources through gateway">diff --git a/docs/documentation/platform/gateways/gateway-deployment.mdx b/docs/documentation/platform/gateways/gateway-deployment.mdxindex f4ccc8c337..05455f7ae2 100644--- a/docs/documentation/platform/gateways/gateway-deployment.mdx+++ b/docs/documentation/platform/gateways/gateway-deployment.mdx@@ -12,24 +12,23 @@ This guide covers everything you need to deploy and configure Infisical Gateways## Choose a connection mode-Before you deploy, decide which side opens the connection between Infisical and the Gateway.+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.| | Direct listen | Relay ||---|---|---|-| Who connects | Infisical connects to the Gateway | The Gateway connects out to a relay |-| Firewall | Inbound port open to the Infisical host | Outbound only |-| Relay required | No | Yes |-| Needs a stable Gateway address | Yes | No |-| PAM CLI from outside the network | No | Yes |+| Firewall change | Inbound port open to the Infisical host | None, outbound only |+| Relay to run | None | Managed on Cloud (US/EU), otherwise your own |+| Stable Gateway address | Required | Not needed || Infisical Cloud | Not available | Yes |+| PAM CLI from outside the network | No | Yes |-**Use direct listen** when Infisical can already reach the Gateway host at a stable address. This is the common case when you self-host Infisical in the same network as your resources, and it means there's no relay to deploy or operate.--**Use relay mode** when the Gateway sits behind NAT or a firewall you can't open, when you're on Infisical Cloud, or when PAM CLI users connect from outside the Gateway's network.--Direct listen isn't a paid feature you can turn on for Cloud. Cloud runs outside your network and has no route into it, leaving no address it could dial. Relay mode exists for exactly that case: the Gateway opens the connection from the inside.+The difference underneath is which side opens the connection, and that's what drives every row above.-You can also run both at once, which is how you move an existing Gateway from one mode to the other without an outage. Pass `--relay` and `--listen-address` together, and Infisical uses the direct address first and falls back to the relay when it stops answering. See [Running both modes](/documentation/platform/gateways/network-architecture#running-both-modes).+You can also run both at once, which is how you move an existing Gateway from one mode to the other without an outage. See [Switching modes without an outage](#switching-modes-without-an-outage).For the ports, certificates, and traffic flow behind each mode, see [Network architecture](/documentation/platform/gateways/network-architecture).@@ -76,14 +75,10 @@ For the ports, certificates, and traffic flow behind each mode, see [Network arcIf 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. One port has to be open to Infisical.-- | Protocol | Direction | Source or destination | Port | Purpose |- | -------- | --------- | --------------------- | ---- | ------- |- | TCP | Inbound | Infisical instance host | the port in your listen address | Platform connects to the gateway |- | TCP | Outbound | Infisical instance host | 443 | API communication and certificate requests |+ **Direct listen mode.** The Gateway accepts inbound connections. On the Gateway host, allow:- Scope the inbound rule to the Infisical instance host rather than opening the port broadly.+ - **Inbound** on the port in your listen address, from the Infisical instance host only+ - **Outbound TCP 443** to the Infisical instance host<Tip>For the full connection model, a complete port reference, and firewall details (including self-hosted relays and HTTP forward proxies), see the [Network Architecture](/documentation/platform/gateways/network-architecture) page.@@ -322,7 +317,7 @@ For the ports, certificates, and traffic flow behind each mode, see [Network arc</Step><Step title="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 address it's advertising and the port it bound.+ 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.</Step>@@ -339,6 +334,22 @@ From the gateway's detail page (select the gateway row in the list):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.+## Switching modes without an outage++A Gateway can run both modes at once. Pass `--relay` 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. The Gateway stays healthy while either one works.++Running both is mainly how you switch an existing Gateway between modes without an outage. A Gateway declares its transports every time it registers, so the move is a flag change and a restart:++| Flags | Mode |+|---|---|+| `--relay=my-relay` | Relay only |+| `--relay=my-relay --listen-address=gateway.internal:8443` | Both |+| `--listen-address=gateway.internal:8443` | Direct only |++Stop at the middle step and check the Gateway's health. A wrong address costs you nothing there: operations keep completing over the relay, and the Gateway page reports the direct path as unreachable. Drop `--relay` once direct is healthy, or drop `--listen-address` to go back.++Running both permanently only helps clients that can reach the listen address. PAM CLI sessions dial the Gateway from the user's own machine. 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<AccordionGroup>@@ -370,12 +381,10 @@ Direct listen is also unavailable on Infisical Cloud, which runs outside your ne</Accordion><Accordion title="Do PAM sessions work in direct listen mode?">-Only from a machine that can reach the gateway's registered 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.+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.-Using direct listen also requires a current Infisical CLI. An older CLI can't connect to a gateway that only listens directly, and reports that the gateway needs a newer CLI.-</Accordion><Accordion title="How do I test network connectivity from the gateway?">@@ -407,12 +416,12 @@ If the gateway can't connect to the 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 registered address:+2. From the Infisical instance host, test the listen address:```bashnc -zv gateway.internal 8443```3. Check the inbound firewall rule allows the Infisical instance host on that port-4. Confirm the registered address resolves from the Infisical host, not just from your own machine+4. Confirm the listen address resolves from the Infisical host, not just from your own machineIf 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.</Accordion>@@ -458,7 +467,7 @@ Yes. Each gateway stores its credentials in a separate config file scoped by namThe 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 direct address stops answering, and returns to direct connections once it recovers+- **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](/documentation/platform/gateways/gateway-pools) will automatically route through a healthy memberdiff --git a/docs/documentation/platform/gateways/network-architecture.mdx b/docs/documentation/platform/gateways/network-architecture.mdxindex 328e39620e..568119b041 100644--- a/docs/documentation/platform/gateways/network-architecture.mdx+++ b/docs/documentation/platform/gateways/network-architecture.mdx@@ -6,17 +6,9 @@ description: "Ports, egress requirements, and the two ways the Gateway and InfisThe Gateway is deployed inside your private network, alongside the resources Infisical needs to reach. Infisical never touches those resources directly. It sends every request through the Gateway, which forwards it to the database or internal API on the other side.-There are two ways the Gateway and Infisical reach each other, and they differ in one thing: which side opens the connection.+There are two ways the Gateway and Infisical reach each other, and they differ in one thing: which side opens the connection. Both carry the same mutually authenticated TLS between Infisical and the Gateway, with certificates issued by your organization's own certificate authorities. In relay mode the relay routes bytes without holding the keys to read them.-- **Relay mode.** The Gateway dials out to a [relay server](/documentation/platform/gateways/relay-deployment/overview) and keeps that tunnel open. Infisical connects to the relay, and its requests travel back down the tunnel the Gateway already established. The Gateway accepts no inbound connections at all.-- **Direct listen mode.** The Gateway listens on an address you register, and Infisical connects to it. There's no relay to deploy, but the address has to be reachable from wherever Infisical runs.--Both modes carry the same mutually authenticated TLS between Infisical and the Gateway, with certificates issued by your organization's own certificate authorities. In relay mode the relay routes bytes without holding the keys to read them.--<Info>- Direct listen is available on self-hosted Infisical. Cloud runs outside your network and has no- route into it, leaving no address it could dial, so Cloud gateways use relay mode instead.-</Info>+<Info>Direct listen is only available on self-hosted Infisical.</Info>## Relay mode@@ -59,18 +51,18 @@ With the default **Auto Select Relay** option there is no single relay address tflowchart LRsubgraph customer["Customer Private Network"]direction TB+ PLAT["Infisical Platform"]GW["Infisical Gateway"]RES[("Private Resource")]+ PLAT -->|"listen address · mTLS"| GW+ GW -->|"TCP 443 · HTTPS"| PLATGW -->|"TCP or HTTP forwarding"| RESend- PLAT["Infisical Platform"]- GW -->|"TCP 443 · HTTPS"| PLAT- PLAT -->|"listen address · mTLS"| GW```| Connection | Source | Destination | Port | Protocol | Purpose ||---|---|---|---|---|---|-| Gateway listener | Infisical Platform | Gateway's registered address | the port you set with `--listen-address` | TCP + mTLS | Platform connects to the gateway to serve every operation. **Ingress** on the Gateway host |+| Gateway listener | Infisical Platform | Gateway's listen address | the port you set with `--listen-address` | TCP + mTLS | Platform connects to the gateway to serve every operation. **Ingress** on the Gateway host || Infisical API | Gateway | Infisical instance host | 443 | TCP (HTTPS) | API communication and certificate requests. **Egress** || Resource access | Gateway | Private resource | the resource's own port (e.g. 5432) | TCP or HTTP | Gateway forwards platform requests to the internal service. **Local** |@@ -79,26 +71,10 @@ On the Gateway host, allow:- **Inbound** access on the port you set with `--listen-address`, from the Infisical instance host only- **Outbound TCP 443** to the Infisical instance host-The address you register is the one Infisical dials, 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 deploy command so the Gateway is issued a certificate for the new address.+The listen address is the one Infisical dials, 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 updating `--listen-address` and restarting the Gateway, so it's issued a certificate for the new address.By default the Gateway binds the port from `--listen-address` on every interface. To bind somewhere else, such as one interface or a different local port behind a load balancer, pass `--bind` as well.-## Running both modes--A Gateway can run both modes at once. Pass `--relay` and `--listen-address` together, and Infisical uses the direct address first, falling back to the relay when that address stops answering. Health checks probe each mode separately. The Gateway stays healthy while either one works.--Running both is mainly how you switch an existing Gateway between modes without an outage. A Gateway declares its transports every time it registers, so the move is a flag change and a restart:--| Flags | Mode |-|---|---|-| `--relay=my-relay` | Relay only |-| `--relay=my-relay --listen-address=gateway.internal:8443` | Both |-| `--listen-address=gateway.internal:8443` | Direct only |--Stop at the middle step and check the Gateway's health. A wrong address costs you nothing there: operations keep completing over the relay, and the Gateway page reports the direct path as unreachable. Drop `--relay` once direct is healthy, or drop `--listen-address` to go back.--Running both permanently only helps clients that can reach the direct address. PAM CLI sessions dial the Gateway from the user's own machine. 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.-## Self-hosted relay (optional)If you run a self-hosted relay, that host needs:@@ -117,16 +93,11 @@ If you run a self-hosted relay, that host needs:</Accordion><Accordion title="Which mode should I use?">- Use direct listen when Infisical can already reach the Gateway host at a stable address, which is the common case when you self-host Infisical in the same network as your resources. It needs no relay.+ Use direct listen when Infisical can already reach the Gateway host at a stable address, which is the common case when you self-host Infisical in the same network as your resources.Use relay mode when the Gateway sits behind NAT or a firewall you can't open, when you're on Infisical Cloud, or when PAM CLI users connect from outside the Gateway's network. See [Gateway deployment](/documentation/platform/gateways/gateway-deployment) for the full comparison.</Accordion>- <Accordion title="Do PAM sessions work in direct listen mode?">- Browser-based access is unaffected, because the platform brokers that connection. `infisical pam access` opens its own connection to the Gateway, so it works only from a machine that can reach the registered address.-- See [Gateway deployment](/documentation/platform/gateways/gateway-deployment#frequently-asked-questions) for what to give users outside the network.- </Accordion><Accordion title="Does the Gateway only proxy raw TCP?">No. Depending on the target resource, the Gateway forwards either raw TCP or HTTP. Most resources (for example databases like PostgreSQL on 5432) are proxied as raw TCP, while resources such as Kubernetes are reached over HTTP forwarding. In both cases the Gateway connects to the resource on its own port inside your private network.diff --git a/docs/documentation/platform/gateways/overview.mdx b/docs/documentation/platform/gateways/overview.mdxindex 03c7850235..71e5915e81 100644--- a/docs/documentation/platform/gateways/overview.mdx+++ b/docs/documentation/platform/gateways/overview.mdx@@ -5,11 +5,11 @@ sidebarTitle: "Networking"icon: "network-wired"----Some of the systems Infisical connects to aren't reachable from the internet: a database in a private subnet, an on-premises appliance, a server behind a corporate firewall. This section covers the two pieces that make those reachable, without opening an inbound port.+Some of the systems Infisical connects to aren't reachable from the internet: a database in a private subnet, an on-premises appliance, a server behind a corporate firewall. This section covers the two pieces that make those reachable.<CardGroup cols={2}><Card title="Gateways" icon="server" href="/documentation/platform/gateways/gateway-deployment">- A lightweight service you run inside your own network, next to the resources Infisical needs to reach. It only makes outbound connections, so no inbound firewall rules are needed.+ A lightweight service you run inside your own network, next to the resources Infisical needs to reach. It can connect out to a relay, or listen for Infisical to connect to it.</Card><Card title="Relays" icon="route" href="/documentation/platform/gateways/relay-deployment/overview">The routing layer between Infisical and your gateways. Passes encrypted traffic through without storing or inspecting it. Use the managed relays, or run your own closer to your infrastructure.@@ -27,7 +27,11 @@ If the target is already reachable and you would rather not run a gateway, you c## How it works-In relay mode the gateway uses an SSH reverse tunnel, so connectivity works without changing inbound firewall rules. In [direct listen mode](/documentation/platform/gateways/network-architecture#direct-listen-mode) Infisical connects to the gateway instead, and the steps below don't apply:+A gateway runs in one of two modes, and they differ in which side opens the connection. See [Choose a connection mode](/documentation/platform/gateways/gateway-deployment#choose-a-connection-mode) for picking between them.++### Relay mode++The gateway uses an SSH reverse tunnel, so connectivity works without changing inbound firewall rules.@@ -36,6 +40,14 @@ In relay mode the gateway uses an SSH reverse tunnel, so connectivity works with3. **Request routing.** When Infisical needs one of your resources, the request travels through the relay and into the tunnel that is already established.4. **Resource access.** The gateway receives the request and connects to your private resource on Infisical's behalf.+### Direct listen mode++Infisical connects to the gateway, so there's no relay in the path. Available on self-hosted Infisical only.++1. **Registration.** The gateway registers the listen address you set, and Infisical issues it a server certificate for that address.+2. **Listening.** The gateway accepts inbound connections on that address, from the Infisical host only.+3. **Resource access.** Infisical connects over mutually authenticated TLS, and the gateway connects to your private resource on its behalf.+## Health checksGateways send a heartbeat every 3 minutes, each carrying a TTL that says how long the gateway should be treated as healthy. If no heartbeat arrives before the TTL expires, the gateway is marked unhealthy. Relays send hourly heartbeats and are marked unhealthy if one is missed.diff --git a/docs/documentation/platform/gateways/relay-deployment/overview.mdx b/docs/documentation/platform/gateways/relay-deployment/overview.mdxindex 0b9e07a764..b8566a10c5 100644--- a/docs/documentation/platform/gateways/relay-deployment/overview.mdx+++ b/docs/documentation/platform/gateways/relay-deployment/overview.mdx@@ -11,15 +11,15 @@ Before diving in, work out whether you need a relay at all, and if you do, wheth## Do you need a relay at all?-If you self-host Infisical and it can reach your gateway host at a stable address, you can skip relays entirely. Deploy the gateway in [direct listen mode](/documentation/platform/gateways/gateway-deployment) instead, and Infisical connects to it.+If you self-host Infisical and it can reach your gateway host at a stable address, you can skip relays entirely. Deploy the gateway in [direct listen mode](/documentation/platform/gateways/gateway-deployment#choose-a-connection-mode) instead, and Infisical connects to it.A relay is what you need when:- The gateway sits behind NAT or a firewall you can't open for inbound connections-- You're on Infisical Cloud, which runs outside your network and has no route into it, so a gateway there can't be dialed and has to open the connection itself+- You're on Infisical Cloud, which runs outside your network and has no route into it, so a gateway there can't be dialed- PAM CLI users connect from outside the gateway's network, since the CLI dials the gateway from their own machine-A gateway can also run both, which is mainly how you switch an existing gateway between modes without an outage. See [Running both modes](/documentation/platform/gateways/network-architecture#running-both-modes).+A gateway can also run both, which is mainly how you switch an existing gateway between modes without an outage. See [Switching modes without an outage](/documentation/platform/gateways/gateway-deployment#switching-modes-without-an-outage).## Do you need to deploy your own relay?diff --git a/docs/documentation/platform/pam/architecture.mdx b/docs/documentation/platform/pam/architecture.mdxindex c756b00537..39dacac4a8 100644--- a/docs/documentation/platform/pam/architecture.mdx+++ b/docs/documentation/platform/pam/architecture.mdx@@ -34,16 +34,20 @@ The actor never sees the credentials. The database/server never sees the actor d## Network security-The Gateway uses outbound connections only:+In relay mode, the Gateway uses outbound connections only:- **No inbound ports** — your firewall doesn't need to allow any inbound traffic- **Outbound to Infisical** — for credential retrieval and session uploads- **Outbound to your infrastructure** — to connect to databases and servers+In [direct listen mode](/documentation/platform/gateways/gateway-deployment#choose-a-connection-mode), Infisical opens the connection instead, so the Gateway accepts inbound traffic on its listen address from the Infisical host.+<Tip>-Your databases and servers stay completely isolated from the internet. The Gateway sits inside your network and reaches out; nothing reaches in.+Your databases and servers stay completely isolated from the internet either way. Only the Gateway is reachable, and only from Infisical.</Tip>+Direct listen changes where a CLI session connects from. Browser-based sessions work in either mode, because the platform brokers the connection. `infisical pam access` connects from the user's own machine instead, so it needs to reach the Gateway's listen address. Users outside that network need a VPN into it, or a relay running on the Gateway alongside direct listen.+## EncryptionAll connections are encrypted:diff --git a/docs/self-hosting/helm-charts/gateway.mdx b/docs/self-hosting/helm-charts/gateway.mdxindex 14bbf6461e..fdcd2e6910 100644--- a/docs/self-hosting/helm-charts/gateway.mdx+++ b/docs/self-hosting/helm-charts/gateway.mdx@@ -141,13 +141,13 @@ helm install infisical-gateway infisical-helm-charts/infisical-gateway \--set gateway.domain=<your-infisical-domain>```-The chart takes the container port from `gateway.listenAddress`, points the Service at it, and exposes that same port, which keeps all three in step. A `host:port` value is required, and the chart fails the render if the port is missing. Set `service.port` only if you want the Service to answer on a different port than the gateway binds, in which case the address you register has to name the Service's port.+The chart takes the container port from `gateway.listenAddress`, points the Service at it, and exposes that same port, which keeps all three in step. A `host:port` value is required, and the chart fails the render if the port is missing. Set `service.port` only if you want the Service to answer on a different port than the gateway binds, in which case the listen address has to name the Service's port.The Service is created only in direct listen mode. A relay-mode gateway accepts no connections and needs none.The address has to be one Infisical can resolve and reach. An in-cluster Service DNS name works when you self-host Infisical in the same cluster. From outside the cluster, expose the gateway through an Ingress or a `LoadBalancer` Service and register that address instead.-Direct listen is available on self-hosted Infisical. Infisical Cloud runs outside your cluster and has no route into it, leaving no address it could dial. On Cloud, leave `gateway.listenAddress` empty and use a relay.+Direct listen is only available on self-hosted Infisical.## Default Helm values