Skip to main content
An agent reaches a PostgreSQL connection in its vault through the gateway. The agent never receives the database password. It logs in to the gateway with its own agent credential, and the gateway logs in to the real database with the stored password.

How the login works

The agent connects to the gateway’s agent port (the same host:port as its proxy address, gateway:10255 by default). A standard PostgreSQL client works: The gateway requires TLS. A plain startup without TLS is refused, so the agent credential never crosses the network in clear text.

Choose the TLS mode

The gateway presents a certificate signed by your instance’s certificate authority, under the fixed name postgres.gateway.onecli. Download that CA from /v1/gateway/ca on your API. The connect script points PGSSLROOTCERT in agent.env at ca-bundle.pem, which holds the system roots and that CA.
Keep the credential in the environment, as above, rather than in the connection string, so it doesn’t land in shell history or process lists.
Don’t use sslmode=verify-full with the gateway. It fails by design. Use verify-ca with the instance CA instead.

When the database doesn’t answer

If the gateway cannot reach the real database within its login time limit, the agent sees:
Check that the gateway can reach the database host and port, and that the destination is allowed. A private or internal address needs a narrow entry in GATEWAY_ALLOW_PRIVATE_DESTINATIONS on a self-hosted instance. See Hardening.

Next steps