> ## Documentation Index
> Fetch the complete documentation index at: https://infisical.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Accept SOCKS5 connections on an Agent Vault proxy

> Let sandbox providers such as E2B connect to the proxy over SOCKS5.

Some sandbox providers, such as [E2B](https://infisical.com/docs/documentation/platform/agent-vault/guides/e2b.md), send a sandbox's traffic to a SOCKS5 proxy from outside the sandbox, instead of setting `HTTPS_PROXY` in the sandbox. To support them, turn on the proxy's SOCKS5 port, which only accepts SOCKS5 over TLS.

## Turn on the SOCKS5 port

Pass `--socks5-port` with the port number, and `--socks5-tls-name` with the DNS name or IP address that clients connect to:

```bash theme={"dark"}
INFISICAL_AGENT_VAULT_PROXY_TOKEN=<proxy-token> \
infisical agent-vault proxy \
  --listen-host 127.0.0.1 \
  --socks5-port 1080 \
  --socks5-tls-name proxy.example.com
```

* **Interfaces:** the SOCKS5 port listens on all interfaces, on a different port from `--port`
* **Who can reach it:** only the clients that connect to the SOCKS5 port need to reach it, so limit the port to their addresses with a firewall, a private network, or a VPN where you can
* **The HTTP port:** on a public machine, keep the HTTP port (`17323` by default) off the internet, such as with `--listen-host 127.0.0.1`, because agents send their session token to it unencrypted
* **Environment variables:** each flag has an environment variable, listed in the [CLI reference](https://infisical.com/docs/cli/reference.md#agent-vault-proxy)

When the port is ready, the proxy logs `agent-vault: SOCKS5 listening`. Log lines about SOCKS5 sign-ins and requests have the field `door` set to `socks5`.

## Certificate for the SOCKS5 port

With `--socks5-tls-name`, the proxy makes the port's certificate from its CA and renews the certificate before it expires. Clients check the certificate with the proxy's CA, which you can [download from Infisical](https://infisical.com/docs/documentation/platform/agent-vault/certificate-trust.md#download-the-certificate-authority), or with your own CA's certificate if you [use your own](https://infisical.com/docs/documentation/platform/agent-vault/certificate-trust.md#use-your-own-certificate-authority).

To serve your own certificate instead, such as one from a publicly trusted CA, pass `--socks5-tls-cert` and `--socks5-tls-key` in place of `--socks5-tls-name`:

* **Formats:** each value can be the PEM text, the PEM encoded as base64, or the path to a PEM file
* **Key types:** RSA, ECDSA, or Ed25519
* **Expired certificates:** the proxy doesn't start if the certificate has expired
* **Renewal:** the proxy reads the certificate only when it starts, so restart the proxy each time you renew the certificate (the proxy warns in its log when fewer than 14 days are left)

## Sessions on the SOCKS5 port

Clients sign in with a SOCKS5 username and password. The proxy ignores the username, so you can use any value, such as `x-agent-vault`. Set the password to the session token. After sign-in, the proxy handles requests the same way it handles them on the HTTP port, including the [traffic policy](https://infisical.com/docs/documentation/platform/agent-vault/proxies#traffic-policy) and the limits in [Supported connections](https://infisical.com/docs/documentation/platform/agent-vault/proxies#supported-connections).

* If the session isn't valid, the proxy refuses the sign-in and logs the reason, so the client reports a failed sign-in (if the password isn't a session token, the proxy logs the reason only with `--log-level debug`)
* If the proxy can't check the session, such as when Infisical is unreachable, it accepts the sign-in and refuses the connection with a general failure, so the client can try again later
* If you revoke a session while a connection is open, the next request on that connection gets a 403 with `the session is no longer valid, or it belongs to a different Agent Vault project than this proxy` (within one [poll interval](https://infisical.com/docs/documentation/platform/agent-vault/proxies#poll-interval))

## Requests to private addresses

The SOCKS5 port refuses requests to private, loopback, link-local, and other internal addresses, such as a cloud metadata endpoint or the proxy's own network interfaces, under either traffic policy. The client gets a 403:

```text theme={"dark"}
HTTP/1.1 403 Forbidden

the destination is a private or internal address
```

The proxy still lets the request through if a service in the session's access bundle names the host. [Exceptions](https://infisical.com/docs/documentation/platform/agent-vault/proxies#exceptions) don't count, so an exception for an internal host is refused on the SOCKS5 port. If the proxy runs in a container, it can't see the host's own addresses, so block those with a firewall rule on the host. The HTTP port doesn't refuse these addresses. To turn the check off for the SOCKS5 port, pass `--socks5-allow-private-destinations`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.