Diffinery

homeflare/celldpublic

celld/docs/security.md
101 lines · 4.5 KBRaw History
1# Security
2
3celld is an alpha. It is not safe for hostile multi-tenant use. Security fixes
4apply to the latest release only, so older alpha builds do not receive fixes.
5
6## Separate the public and internal listeners
7
8celld opens two HTTP listeners. The public listener serves the deployed Worker,
9and the internal listener serves the peer protocol and the operator API.
10
11Use `--listen` for the public listener. Expose only this listener through a load
12balancer, a reverse proxy, or a public firewall rule.
13
14Use `--internal-listen` for the internal listener. Its default address is
15`127.0.0.1:0`, so celld selects an available loopback port at each start.
16The startup output reports the selected address.
17
18Use `--advertise` to give peers the address of the internal listener. Bind the
19internal listener to a private interface, or protect it with a private overlay.
20Do not expose this listener to the public internet.
21
22An explicit advertised address requires an explicit internal-listener address.
23Set both command-line options, or use their equivalent environment variables.
24celld also rejects an explicit non-loopback public listener without an explicit
25internal listener. This rule identifies an obsolete one-listener configuration.
26
27celld cannot verify that an advertised hostname or a translated port reaches
28the internal listener. You must route the advertised address to the internal
29listener, and you must not route it to the public Worker listener.
30
31The public listener reserves only `/__celld/health`. A healthy node returns a
32200 response with `{"ok":true}`, and an unhealthy node returns a 503 response.
33The deployed Worker owns `/health` and every other public path.
34
35The internal listener does not pass an unknown path to the Worker. It returns a
36404 response, so an operator request cannot become an application request.
37
38## Protect the internal listener
39
40The operator API does not authenticate its requests. A client that can reach
41the internal listener can inspect state, start direct work, evict a cell, or
42stop the process. Therefore, a firewall or a private overlay must restrict
43access to trusted operators and fleet nodes.
44
45Peer requests on the same listener keep their protocol authentication. Each
46peer request has an HMAC, a body signature, a clock limit, and replay
47protection. The private network adds protection, but it does not replace the
48peer authentication.
49
50celld does not terminate TLS on the internal listener. Use an encrypted overlay
51such as WireGuard or Tailscale when the private network does not provide the
52required confidentiality.
53
54## Internal operator API
55
56The internal operator API is available in the released binary. The API is an
57alpha interface, so a release can change its paths or response formats.
58
59- `/state` reports the current occupancy, eviction, and restoration values. It
60 remains available while a graceful shutdown drains existing work.
61- `/cell/NAME` resolves or activates a cell for an operator check.
62- `/evict/NAME` evicts a resident cell.
63- `/do/NAME` sends a direct Durable Object request.
64- `POST /shutdown` starts a graceful ownership handoff.
65- `POST /shutdown?handoff=preserve` prepares a clean same-node reload and keeps
66 the ownership records.
67- `/__celld/probe` serves the signed diagnostic probe.
68
69The peer protocol also uses reserved internal paths. An operator must not call
70these paths directly, and celld continues to authenticate each peer request.
71
72## Protect the fleet bucket
73
74The fleet bucket is the root of authority for the fleet. It stores the
75deployments, the cell state, the ownership leases, the node leases, and the
76shared peer-authentication secret.
77
78A person who holds the bucket credentials controls the fleet. Give each
79credential access to one fleet bucket only, and replace a credential after a
80suspected disclosure.
81
82## Keep one writer for each cell
83
84Each cell is a SQLite database with one writer. One node owns a cell at a time,
85and an ownership epoch fences each cell.
86
87A node that loses its lease cannot modify the current cell state. The
88[ownership and fencing](fencing.md) page describes this mechanism.
89
90A fleet has no shared multi-tenant scheduler or shared placement layer. A
91defective cell can access only its own database, but it can consume resources
92on its fleet nodes.
93
94## Protect the public application
95
96celld does not authenticate the users of the deployed application. It also does
97not terminate public TLS. Put the required authentication and TLS in front of
98the public listener.
99
100Keep the internal listener private, and keep the bucket credentials secret.
101See the [limitations](limitations.md) page for the complete alpha boundary.