diff --git a/deploy/docker/docker-compose.yml b/deploy/docker/docker-compose.yml index 12052b7b..46666e3e 100644 --- a/deploy/docker/docker-compose.yml +++ b/deploy/docker/docker-compose.yml @@ -24,10 +24,14 @@ services: TITANO_DB_NAME: titano TITANO_DB_USER: titano TITANO_DB_PASSWORD: ${TITANO_DB_PASSWORD:?set TITANO_DB_PASSWORD in .env} - # auto (self-signed), pem or proxy; behind a proxy, set TITANO_TRUSTED_PROXIES to its address or network (for a - # proxy container on this network, the network's subnet; only loopback is trusted otherwise) + # auto (self-signed), pem or proxy. Behind a proxy, set TITANO_TRUSTED_PROXIES to the proxy's own address (only + # loopback is trusted otherwise). Give a proxy container a fixed one (ipv4_address, on a network with an ipam + # subnet that this service joins too) and let it reach Titano on that network, not through a published port. + # Never list a subnet or the network's gateway (.1): Docker relays connections to the published ports (IPv6 + # clients, the host) from the gateway, and each of them could then choose its client address. For a proxy on the + # host itself, run this service with network_mode: host; the proxy then reaches Titano over loopback. TITANO_TLS_MODE: auto - # TITANO_TRUSTED_PROXIES: "172.18.0.0/16" + # TITANO_TRUSTED_PROXIES: "172.30.0.10" # TITANO_PUBLIC_HTTPS_PORT: "8443" TITANO_SERVER_NAME: Titano Server # Trace, Debug, Information, Warning or Error diff --git a/deploy/releases-repo/README.md b/deploy/releases-repo/README.md index 4f420809..41987b2f 100644 --- a/deploy/releases-repo/README.md +++ b/deploy/releases-repo/README.md @@ -91,9 +91,14 @@ admin panel shows under Settings so you can compare them. and set `TITANO_DB_HOST: 127.0.0.1`. - Behind a reverse proxy (`TITANO_TLS_MODE=proxy`), only the proxies listed in `TITANO_TRUSTED_PROXIES` may set `X-Forwarded-*` headers. By default that is loopback only: other machines on your network reach the HTTP port - directly, so they must not choose the address the sign-in limit and the audit log see. List your proxy's address, - or the subnet of the Docker network it shares with Titano (for example `172.18.0.0/16`). The admin panel shows *Not - via proxy* when a page did not come through a trusted proxy over HTTPS. + directly, so they must not choose the address the sign-in limit and the audit log see. List your proxy's own + address. Give a proxy container a fixed IP on a user-defined Docker network it shares with Titano (`ipv4_address` in + compose, *Fixed IP address* on Unraid), for example `172.30.0.10`, and let it reach Titano on that network rather + than through a published port. Never list a subnet, the network's gateway (`.1`) or Docker's default bridge + (`172.17.0.0/16`): Docker relays connections to published ports from the gateway (IPv6 clients, the host itself), + and on the default bridge every other container would count as your proxy too. For a proxy running on the Docker + host itself, run Titano with `network_mode: host`: the proxy then reaches it over loopback. The admin panel shows + *Not via proxy* when a page did not come through a trusted proxy over HTTPS. ## Titano Server on Unraid diff --git a/deploy/unraid/titano.xml b/deploy/unraid/titano.xml index f7baad1b..b7c059f1 100644 --- a/deploy/unraid/titano.xml +++ b/deploy/unraid/titano.xml @@ -35,7 +35,7 @@ prefer auto - + Titano Server Information 99 diff --git a/src/Titano.Server/Configuration/ServerOptions.cs b/src/Titano.Server/Configuration/ServerOptions.cs index f971f122..1ac0a6ec 100644 --- a/src/Titano.Server/Configuration/ServerOptions.cs +++ b/src/Titano.Server/Configuration/ServerOptions.cs @@ -234,7 +234,7 @@ public sealed class ServerOptions } catch (FormatException ex) { - throw new InvalidOperationException($"TITANO_TRUSTED_PROXIES must list IP addresses or networks such as 172.16.0.0/12: {ex.Message}", ex); + throw new InvalidOperationException($"TITANO_TRUSTED_PROXIES must list IP addresses (such as 172.30.0.10) or networks in CIDR form: {ex.Message}", ex); } if (ChunkSizeBytes is < 64 * 1024 or > 64 * 1024 * 1024) throw new InvalidOperationException("The chunk size must be between 64 KiB and 64 MiB.");