Skip to content

Self-hosted monitoring for homelabs: host and container metrics and uptime checks from all your machines in one dashboard, with an optional AI agent that diagnoses incidents and suggests fixes.

docs: attach the frontend to the proxy's network, never the proxy to front (#221)

Karlo Kajba Šimanić7d6993377155
diff --git a/SECURITY.md b/SECURITY.md
index f02d31d..4064e34 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -330,7 +330,8 @@ What this still depends on:
- The backend trusts the `X-Collector-Via` header nginx sets. That is safe only while nothing
untrusted can reach the backend directly (the backend's port is not published in the server stack; don't
- add other containers to its network).
+ add other containers to its network, `front`, and that includes your reverse proxy: attach the frontend to
+ the proxy's network instead, see [Other reverse proxies](docs/deployment.md#other-reverse-proxies)).
- Anyone on your VPN can reach the gate. With a valid join token they can request to join, and an
admin still has to approve them; ingest additionally needs a server's token.
- Rotating a collector token means re-adding that server.
diff --git a/docker-compose.server.yml b/docker-compose.server.yml
index 7f5ff29..0ba5158 100644
--- a/docker-compose.server.yml
+++ b/docker-compose.server.yml
@@ -1,5 +1,7 @@
# Server stack, published over HTTPS by the reverse proxy you already run (Traefik, Caddy, nginx, ...).
-# Your proxy reaches the dashboard on 127.0.0.1:5173, or over the `front` network if it runs in Docker.
+# Your proxy reaches the dashboard on 127.0.0.1:5173. A proxy in Docker can reach frontend:8080 instead, with the
+# frontend attached to the proxy's network (as deploy/traefik.yml does); never attach the proxy to this stack's
+# `front` network, where the backend and the collector gate trust whatever reaches them.
# Set COMPOSE_FILE in .env, adding the ready-made file for your proxy from deploy/ if there is one
# (see docs/deployment.md), then run a plain `docker compose up -d --build`:
# COMPOSE_FILE=docker-compose.server.yml:deploy/traefik.yml (Traefik)
diff --git a/docs/deployment.md b/docs/deployment.md
index 9a8884f..b845289 100644
--- a/docs/deployment.md
+++ b/docs/deployment.md
@@ -179,10 +179,29 @@ compose project). Collectors started from `collector-compose.yml` need
- **Another reverse proxy (nginx, Caddy, HAProxy, a tunnel connector, ...):** use the **server stack**
(`docker-compose.server.yml`) on its own, not the development stack, and point your proxy at its dashboard
- port (`127.0.0.1:5173` by default). A proxy that runs in Docker can instead join the stack's `front` network
- and reach `frontend:8080`. The server stack is the one that keeps the collector endpoints off the
+ port (`127.0.0.1:5173` by default). The server stack is the one that keeps the collector endpoints off the
public side, registration closed and the session cookie HTTPS-only. Terminate HTTPS in your proxy, have it
send `X-Forwarded-For`, and set `TRUSTED_PROXIES` to its address (see below).
+- **A proxy that runs in Docker** can reach `frontend:8080` over a Docker network instead of the published
+ port. Attach the **frontend to the proxy's network**, as `deploy/traefik.yml` does. Save this next to it
+ (for example as `deploy/proxy.yml`) and add it to `COMPOSE_FILE` after the server file:
+
+ ```yaml
+ services:
+ frontend:
+ networks:
+ - proxy
+
+ networks:
+ proxy:
+ external: true
+ name: <your-proxy-network>
+ ```
+
+ **Never attach the proxy to the stack's own `front` network.** The backend and the collector gate's internal
+ listener are on it, and they trust whatever reaches them there: a proxy on `front` could call the backend
+ past nginx, claim any client address, and register a collector without a join token. The proxy is the part
+ most exposed to the internet, so it gets to see the frontend and nothing else.
- **Caddy profile (`--profile https`, development stack): private use only.** It publishes the development
stack's single listener, which serves the collector endpoints on the same address as the dashboard, so it
is not suitable for a dashboard that is open to the internet. Use it on a LAN or behind a VPN.