docs/contributing/platform/pam-development.mdx
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.
<Note> If you haven't set up the Infisical platform yet, follow the [local development guide](/contributing/platform/developing) first. </Note>In a local dev environment, the Infisical platform runs inside Docker while the relay and gateway run directly on your host machine:
graph LR
subgraph Docker ["Docker (localhost:8080)"]
Backend["Infisical Backend"]
DB[("PostgreSQL")]
Redis["Redis"]
end
subgraph Host ["Host Machine (go run)"]
Relay["Relay Server
(go run main.go relay)"]
Gateway["Gateway
(go run main.go gateway)"]
end
subgraph Local ["Local Resources"]
Target[("Local DB / Server")]
end
Backend <-->|"host.docker.internal"| Relay
Relay <-->|"SSH tunnel"| Gateway
Gateway <--> 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 |
For more details on the production architecture, see:
docker compose -f docker-compose.dev.yml upThe relay and gateway live in the Infisical CLI repository. For local development, run them via go run main.go rather than the pre-built binary:
git clone https://github.com/Infisical/cli.git
cd cli
From the CLI repository root:
go run main.go relay start \
--name=local-relay \
--token=<your-token> \
--domain=http://localhost:8080 \
--host=host.docker.internal
Verify registration at Organization Settings > Networking > Relays.
For all available flags, see the Relay CLI Reference.
In a new terminal, from the CLI repository root:
go run main.go gateway start \
--token=<your-token> \
--domain=http://localhost:8080 \
--target-relay-name=local-relay \
--name=local-gateway \
--pam-session-recording-path=$(pwd)/session
Verify registration at Organization Settings > Networking > Gateways.
For all available flags, see the Gateway CLI 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 --target-relay-name=local-relay --name=local-gateway --pam-session-recording-path=$(pwd)/session |
docker compose -f docker-compose.dev.yml logs -f backend