Archived
server: name the caller a vouched proxy carried, without arming the guard
An operator running radiance behind a reverse proxy sees one address in every log line: the proxy's. --trusted-proxy CIDR (repeatable) vouches for the networks whose sockets may say who they carried. An X-Forwarded-For from inside a vouched network is walked from the right: vouched hops are skipped, the first address no vouched CIDR covers is the caller, a chain of only vouched hops ends at its leftmost, and anything else falls back to the socket. From an unvouched socket the header names no one, because it has not been vouched for. Attribution is not authority, and the split that keeps them apart is mechanical. HttpRequest carries `peer`, the attributed caller, sanitized where it is built because a named address arrives in a header and the log keeps no client text otherwise -- and `raw_peer`, the socket as the kernel saw it, which is now the only address peer_is_loopback() reads. A proxy on loopback therefore hands the keyless loopback-only routes to none of its clients; it only names them where the proxy used to stand. transport_test pins both halves: the walk at the unit level, and over a real socket that a vouched proxy plus X-Forwarded-For leaves the loopback guard answering 200 and the cross-origin 403 untouched. httplib's own set_trusted_proxies -- new this side of the vendor bump -- is deliberately unarmed. It rewrites req.remote_addr, the very field the guards would read as the socket peer, so one over-broad vouched network would move the guard rather than the log line. Radiance reads the header itself, and ip_in_cidr refuses across families: a vouched ::ffff:0:0/96 vouches for no IPv4 socket. Config rejects anything but a numeric network with a prefix at startup, because a typo there would silently unvouch a proxy; the refusals the transport answers before the router log the attributed caller too, so the audit trail stays one line per request whoever the socket belongs to.
This commit is contained in:
1 parent
40e1b3073b
commit
b6acbd69e4
11 files changed
+352
-22
No files matched your search
@@ -2130,6 +2130,7 @@ by 0.002-0.003 nats.
|
||||
| `--api-key KEY` | none | require `Authorization: Bearer KEY` or `X-Api-Key: KEY` on every request but `/health`, `/v1/health`, `/ping` and the dashboard page (§6.6); the key must be non-empty |
|
||||
| `--api-key-env NAME` | — | read the API key from the environment variable `NAME` instead of the command line, where every process on the machine reads it in `ps`; an unset or empty `NAME` refuses startup like an empty `--api-key` |
|
||||
| `--allow-host NAME` | — | a `Host` name the keyless loopback-only routes accept besides the loopback names; repeatable (§6.6) |
|
||||
| `--trusted-proxy CIDR` | — | a network whose sockets may name the client behind them, via `X-Forwarded-For`, for the log; vouching changes attribution, never access; repeatable (§6.6) |
|
||||
| `--served-model-name NAME` | container's name | the model id `/v1/models` lists, the metrics carry and a response names when its request named none. A request may name any model; the loaded one serves it |
|
||||
| `--mm-max-patches N` | auto | patches one vision-encoder pass carries, and so the largest image (a patch is 16x16 pixels, 14x14 on GLM-5.3). `auto` is 16384 when the container carries a vision tower; 0 serves text only and keeps the tower off the card. A pass is not one tower invocation: inside it the tower batches at most 8 tiles per weight read, and the pass size may reduce that (4 tiles at the 64-pixel grid with the default 16384 patches); a picture contributes a separate pass per grid. See the concurrency notes for Unlimited-OCR (§5.17) |
|
||||
| `--override-chat-template PATH` | container's | a Jinja chat template file served in place of the container's. The reply format (reasoning markers, tool calls) is derived from it too, unless the architecture plugin declares one. An unreadable or empty file stops startup |
|
||||
@@ -3836,6 +3837,20 @@ tunnel pass. If you reach the box by another name from the box itself, list it:
|
||||
(repeatable). A local user on the server's own console is admitted either way — the boundary is
|
||||
against remote callers, not against whoever owns the machine.
|
||||
|
||||
Behind a reverse proxy every socket arrives as the proxy, and every log line names it instead of
|
||||
the caller. `--trusted-proxy 127.0.0.0/8` (repeatable; a numeric network with a prefix, like
|
||||
`::1/128`) vouches for those networks: a request whose socket belongs to a vouched network is
|
||||
attributed to the client it names, reading `X-Forwarded-For` from the right and skipping vouched
|
||||
hops — the first address no vouched network covers is the caller, a chain of only vouched hops
|
||||
ends at its leftmost, and anything else falls back to the socket. Attribution is not authority:
|
||||
the guards above read the socket and never the named address, so a proxy on loopback hands the
|
||||
loopback-only routes to none of its clients — it only puts their addresses in the log where the
|
||||
proxy's would stand. An `X-Forwarded-For` from an unvouched socket is never read: the header
|
||||
says nothing until the machine sending it has been named. (This is why the server parses the
|
||||
header itself rather than arming the HTTP library's own trusted-proxy support: that support
|
||||
rewrites the very address the handlers read as the socket peer, so one over-broad vouched
|
||||
network would move the guard, not just the log line.)
|
||||
|
||||
The key is not encrypted in transit. On a network you do not control, bind to localhost behind a
|
||||
TLS-terminating reverse proxy:
|
||||
|
||||
|
||||
Reference in new issue
Block a user