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

# Proxy modes and TLS

> How RPC reaches your clients on a closed network, how nginx fronts the Hub and serves pools, and how the Agents trust your CA

On Cloud, each Agent runs its own TLS proxy and obtains certificates over ACME. A closed network has no ACME authority and no public DNS, so Self-hosted replaces that proxy with one of two **proxy modes**, and every certificate comes from **your internal CA**.

## Proxy modes

The mode is set on the Hub with `NVCL_PROXY_MODE` and on each Agent with `[proxy] mode`. **They must match**: every Agent of a Hub runs the Hub's mode. The Hub can't tell an Agent in the wrong mode except through the pool edge status, which an `off` Agent never reports.

| | `off` | `nginx` |
| - | - | - |
| **How RPC is served** | **Direct** ports on the Agent host, restricted by an nftables source allow-list | [Pools](https://docs.novacula.io/docs/nodes/pools.md) only, served by an nginx you run on each Agent host |
| **TLS** | Yours to put in front, if clients need HTTPS | Terminated by your nginx, with a pool certificate signed by your CA |
| **RPC keys and rate limits** | No — access control is the allow-list plus whatever your own nginx enforces | Yes, per pool, enforced by the Agent's gateway |
| **Domains** | None | One per pool |
| **Public domain** [exposure](https://docs.novacula.io/docs/nodes/rpc-exposure.md#public-domain) | Refused (`422`) | Refused (`422`) — a one-member pool gives a single node a domain |
| **Pools** | Refused (`422`); hidden in the console | Yes |
| **Hub settings** | `NVCL_PROXY_MODE=off`, `NVCL_ADDRESS_MONITOR_ENABLED=false` | `NVCL_PROXY_MODE=nginx`, the address monitor left on, the Agents' range in `NVCL_NETWORK_PRIVATE_CIDRS` |
| **Agent host needs** | `nftables` | nginx owning ports `80` and `443` on the host's advertised address |

Neither mode installs or starts the Cloud proxy. Set the mode on a fresh Hub: a node that already carries **Public domain** exposure can't be edited until that exposure is removed.

On every Agent, also set `advertised_host` under `[agent]` — the address the Hub, the peers, and your clients reach this host on. A private IPv4 (RFC 1918 or `100.64.0.0/10`) is accepted only outside the Cloud proxy mode, and only when written in the file: discovery never yields one.

```toml theme={null}
[agent]
data_dir = "/var/lib/nvcl"
advertised_host = "10.20.0.7"

[proxy]
mode = "off"   # or "nginx"
```

## Mode off

### Direct exposure with an allow-list

Give each node **Direct** [RPC exposure](https://docs.novacula.io/docs/nodes/rpc-exposure.md#direct) and fill in **Restrict access (CIDR)** with the sources allowed to reach it. The Agent binds the RPC port on all interfaces only when **every** RPC role of the node is direct (on Ethereum: the execution client and Lighthouse); otherwise it stays on loopback. The allow-list becomes nftables rules on the host.

> [!WARNING]
>
> Always set the allow-list. An empty list leaves the port open to every source that can route to the host.

### TLS in front of a direct port

When clients need HTTPS, terminate it on a host you control and allow only that host. For an nginx at `10.20.0.5` in front of a node RPC port `8545` on `10.20.0.7`, set the node's allow-list to `10.20.0.5/32` and:

```nginx theme={null}
server {
    listen 443 ssl;
    server_name rpc.internal.example;

    ssl_certificate     /etc/nginx/tls/rpc.internal.example.crt;
    ssl_certificate_key /etc/nginx/tls/rpc.internal.example.key;

    location / {
        proxy_pass http://10.20.0.7:8545;
    }
}
```

The host port is reported on the node's **RPC** tab. For a node serving WebSocket RPC, see nginx's [WebSocket proxying](https://nginx.org/en/docs/http/websocket.html).

## Pools behind nginx

In `nginx` mode the Agent serves pools through an nginx you run on the same host. The Agent never installs, starts, or stops nginx: it writes the pool certificates and one configuration file, tests the whole configuration with `nginx -t`, and asks the unit to reload.

```toml theme={null}
[proxy]
mode = "nginx"
# nginx_unit = "nginx"   # the systemd unit the Agent reloads
# nginx_reload = true    # false: the Agent only writes the files and you reload nginx yourself
```

Include the Agent's file once inside the `http` block of `/etc/nginx/nginx.conf`, then `nginx -t && systemctl reload nginx`:

```nginx theme={null}
http {
    include /var/lib/nvcl/nginx/nvcl.conf;
}
```

What the Agent writes:

* **`/var/lib/nvcl/nginx/nvcl.conf`** — one HTTPS server per pool this host serves, forwarding to the Agent's gateway on `127.0.0.1:9777` (which enforces the pool's keys and rate limits), plus an HTTP server on the advertised address that answers the Hub's health poll. **Don't edit it** — the Agent rewrites it.
* **`/var/lib/nvcl/pool-certs/`** — the pool certificates nginx reads. With AppArmor or SELinux, allow nginx to read `/var/lib/nvcl`.

The Agent runs as `root` after `install.sh`. If you run it as another user, allow it the two commands it runs, for example in `/etc/sudoers.d/nvcl` — sudo matches arguments exactly, so the unit must be the one set as `nginx_unit`:

```
nvcl ALL=(root) NOPASSWD: /usr/sbin/nginx -t, /usr/bin/systemctl reload nginx
```

**How changes land.** A certificate or a new pool reaches the include on the Agent's next sync, and the Agent asks nginx to reload. A configuration nginx rejects is rolled back and never reloaded; a stopped nginx is reported, not started; a change nginx doesn't take (another process holds port `80` or `443`, say) is retried once a minute. With `nginx_reload = false`, the reload is yours. Keys and guest limits never wait for nginx — the gateway enforces them, so a new key works from the Agent's next sync.

**Health poll.** The Hub polls `http://<advertised_host>:80/nvcl/health`, so port `80` on that address must be free for nginx, and `health_poll` must stay on under `[proxy]` (it's on by default). Only `/nvcl/health` is routed through nginx; scoped health paths aren't.

**Edge status.** After each change the Agent checks over `127.0.0.1:443` that nginx presents the pool's certificate and forwards to the gateway, and reports per pool whether it's served. The pool read (`GET /v1/organizations/<organization id>/pools/<pool id>`) lists the reporting members under `edgeHosts`, each with the configuration version written and served, the last error, and `reportedAt`. A member missing there, one with an `error`, or one whose `reportedAt` has stopped moving is the host to check. Right after a certificate write, a host's served version can stay behind the written one (empty for a first certificate) without an `error` until the next check; that isn't a fault. An `error` such as `the edge presents a different certificate than the pool's` means nginx still missed the pool on that next check: the Agent retries the reload every minute while the write is unconfirmed (with `nginx_reload = false`, the error stays until you reload nginx). An `error` that appears after the served version had caught up triggers no reload — nginx stopped serving the pool without a new write, for example after a change outside the Agent, and that's yours to investigate. The pool domain answers `421` while none of its members serves — for example while the only one is still syncing.

**Member addresses.** In `nginx` mode the Hub verifies a member's advertised address on a private IPv4 inside `NVCL_NETWORK_PRIVATE_CIDRS`, and pool members reach each other on those addresses over `https://<advertised_host>` (port `443`). Switching the Hub to another mode, or removing a range from the list, drops those members' peer addresses until they verify a usable one.

**DNS.** Point each pool domain at its members' advertised addresses in your internal DNS. The pool shows the records under **Create these records in your DNS** with the note that the Hub doesn't check DNS — publish them in the DNS your clients use.

### Pool certificates

Pool certificates are uploaded, because an ACME authority can't reach a closed network:

1. Creating the pool generates its private key and CSR in the Hub — the key never leaves it.
2. **Copy CSR** or **Download CSR** on the pool's **Certificate** tab and have your CA sign it.
3. Paste or choose the signed **full chain** (leaf followed by intermediates) and **Save certificate**.

**Automatic issuance** is refused with `422` in this mode (an order started before the switch isn't advanced — cancel it). A sound chain up to a CA no public root signs shows the `private_ca` warning — expected here; your clients must trust that CA. A chain with an expired or unlinked certificate still shows `chain_not_verified`. Renewing is the same upload. See [Certificate](https://docs.novacula.io/docs/nodes/pools.md#certificate).

## nginx in front of the Hub

The Hub speaks plain HTTP on `127.0.0.1:9090`; an nginx on the Hub host terminates TLS:

```
browsers, Agents ──https──▶ nginx :443 (your certificate) ──http──▶ Hub 127.0.0.1:9090
```

The Hub trusts `X-Forwarded-*`, so it must be reachable **only** through that proxy (`SERVER_ADDRESS=127.0.0.1` in `hub.env`), and nginx must **overwrite** the forwarded headers rather than pass on what a client sent. A minimal site, `/etc/nginx/conf.d/nvcl-hub.conf`:

```nginx theme={null}
server {
    listen 443 ssl;
    server_name hub.example.local;

    ssl_certificate     /etc/nginx/tls/hub.crt;   # leaf followed by intermediates
    ssl_certificate_key /etc/nginx/tls/hub.key;   # 0600, owned by root

    # Agents ship metrics and node logs through the Hub; the 1m default answers large batches with 413.
    client_max_body_size 16m;

    location / {
        proxy_pass http://127.0.0.1:9090;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-Proto https;
        # Overwrite, never append, and drop the forwarded headers the Hub would otherwise take from the client.
        # nginx does not pass a header set to "".
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header X-Forwarded-Host "";
        proxy_set_header X-Forwarded-Port "";
        proxy_set_header X-Forwarded-Prefix "";
        proxy_set_header Forwarded "";
    }
}
```

`NVCL_PUBLIC_URL` is the origin this site serves (`https://hub.example.local`). To rotate the certificate, replace the two files and run `nginx -s reload`; open connections finish on the old workers.

## Private networks the Hub may dial

By default the Hub dials public addresses only. `NVCL_NETWORK_PRIVATE_CIDRS` lists — comma-separated — the private ranges it may also dial: node RPC checks, [alert](https://docs.novacula.io/docs/notifications/alerts.md) webhooks, and address checks.

```bash theme={null}
NVCL_NETWORK_PRIVATE_CIDRS=10.20.0.0/16
```

* Each entry must lie inside `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`, `100.64.0.0/10`, or `fc00::/7`; the Hub refuses to start otherwise. Loopback and link-local addresses can never be configured in.
* Never include the range that holds the Hub itself or its telemetry stores.
* In `nginx` mode it **must** hold the Agents' addresses: a node verifies its address, and joins a pool, only inside it.

## CA trust

Two kinds of client run on each host, and they read trust from different places:

* **The OS trust store** — for `curl`, `aria2`, and the Agent's self-update. On Debian and Ubuntu:

  ```bash theme={null}
  cp nvcl-ca.crt /usr/local/share/ca-certificates/nvcl-ca.crt
  update-ca-certificates
  ```

  On the Hub host this is what lets Mimir's Alertmanager reach the Hub's incident feed and webhook receivers behind your CA.

* **`[tls] ca_file`** — for the Agent's Java runtime: Hub sync, telemetry, and snapshot downloads. The Agent ships its own Java runtime, which **doesn't read the OS store**. The file is added to the runtime's default roots, so public hosts still verify.

  ```toml theme={null}
  [hub]
  url = "https://hub.example.local"

  [tls]
  ca_file = "/etc/nvcl/hub-ca.pem"
  ```

  The Agent refuses to start when `ca_file` isn't an absolute path to a readable PEM certificate, or when it's set and the Hub is reached over `http://` (or `[hub] url` is missing).

`install.sh` sets this up for you: `NVCL_CA_FILE` is trusted for every download it makes (on top of the system roots), copied to `/etc/nvcl/hub-ca.pem`, and written to `[tls] ca_file`. It doesn't touch the OS trust store — do that as above. If the CA is already in the OS store, you can pass the system bundle, `NVCL_CA_FILE=/etc/ssl/certs/ca-certificates.crt`; the Agent then gets a copy taken at install time. To have it follow later changes to the OS store, set `ca_file = "/etc/ssl/certs/ca-certificates.crt"` instead and restart the Agent after the store changes.

`install.sh` also takes `NVCL_AGENT_URL`, which replaces the release's download URL (a `file:///` path is copied); the tarball is still checked against the sha256 registered with the release.

> [!NOTE]
>
> A CA in either place is trusted for **every** host the Agent dials, not only the Hub. Prefer a CA name-constrained to your internal domains.

The Hub's own Java runtime doesn't read the OS store either. For an SMTP relay behind your CA, see [Account email](https://docs.novacula.io/recipes/self-hosted/email.md#account-email).

## Related

* [Install](https://docs.novacula.io/recipes/self-hosted/install.md) · [Agent sources](https://docs.novacula.io/recipes/self-hosted/agent-sources.md)
* [RPC exposure](https://docs.novacula.io/docs/nodes/rpc-exposure.md) · [Pools](https://docs.novacula.io/docs/nodes/pools.md)


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