Security
Kaio authenticates no one: it has no accounts, no passwords and no login page, and it never will. Whatever drives its API drives the Docker daemon, which is root-equivalent on that host. What Kaio does decide is whom it trusts to say who is calling, and it refuses to start when that question has no answer. This page is the canonical account of that model, and every other page points here.
Pick your case
Section titled “Pick your case”Most installations need one line in /etc/kaio/kaio.env, and
kaio-server setup writes it for you: it shows the change, asks before writing,
keeps the previous file beside it, and says whether the server will start.
| Your case | Run on the server | It writes |
|---|---|---|
Only you, on this host or through ssh -L |
nothing, it is the default, or kaio-server setup local |
KAIO_ADDR=127.0.0.1:8080 |
| A LAN, a tailnet or a VPN you trust | kaio-server setup lan, or kaio-server setup lan 100.64.0.0/10 |
KAIO_ALLOWED_NETWORKS=<this host's network> |
| A reverse proxy that signs people in | kaio-server setup proxy <proxy IP>, then the proxy side |
KAIO_TRUSTED_PROXIES, and a shared secret in /etc/kaio/proxy-secret |
| A node of a cluster | nothing: kaio-cli join |
the control plane’s key, in the database |
Then systemctl restart kaio, and kaio-cli whoami from where you work says
how the server sees you. The rest of this page explains why each line is enough,
and the variables for the cases the table does not cover.

setup lan finds this host’s network from its default route. --env-file
points at another file than /etc/kaio/kaio.env, and --yes skips the
question for a script.
What the port gives away
Section titled “What the port gives away”| Capability | Why it matters |
|---|---|
| Deploy a stack | Compose pulls and runs arbitrary images: this is remote code execution on the host, by design |
| Open a shell | /api/containers/{id}/shell runs commands inside any container |
| Delete or prune | Containers, images, volumes and networks, with no confirmation at the API level |
| Read the environment | Secrets are masked in responses, but the containers running with them are reachable through the shell |
The socket is mounted read-only in the reference Compose file. That limits nothing: the Docker API takes its commands over the protocol spoken on the socket, not through writes to the file. Access to the socket is equivalent to root on the host.
Safe by default
Section titled “Safe by default”Out of the box, Kaio listens on 127.0.0.1:8080 and answers the loopback only.
Since 0.6.0, an address off the loopback refuses to start until you say who
may reach it:
Refusing to listen on http://0.0.0.0:8080: Kaio authenticates no one, and whoeverreaches this address would control the Docker daemon. Pick one: - KAIO_TRUSTED_PROXIES=<proxy IP or CIDR>, to accept only the reverse proxy that authenticates for you - KAIO_ALLOWED_NETWORKS=<CIDR>, to accept a private network you trust (a tailnet, a WireGuard peer list) - KAIO_I_UNDERSTAND_NO_AUTH=yes or --i-understand-no-auth, to keep the old open behaviourA server that has joined a cluster starts without either:
it then answers its own loopback and calls signed by its control plane, and
nothing else. KAIO_ADDR=unix:/run/kaio/kaio.sock serves a Unix socket instead
of a port, which only processes allowed to open the file can reach.
KAIO_I_UNDERSTAND_NO_AUTH brings back the behaviour of every version before
0.6.0. It is logged as a warning at startup and every hour after, and
kaio-server doctor reports it as a danger.
Who is calling
Section titled “Who is calling”Every request goes through one check, in kaio-core, before any handler runs.
It sorts the caller into one of four kinds, in this order:
| Kind | How it is recognised | Level |
|---|---|---|
cluster |
A valid signature from the control plane this server joined | The level the signature carries, capped by KAIO_CLUSTER_LEVEL |
proxy |
From an address in KAIO_TRUSTED_PROXIES, with the shared secret when KAIO_PROXY_SECRET_FILE is set |
From the groups the proxy sends, see below |
local |
From the loopback or the Unix socket | KAIO_LOCAL_LEVEL, admin by default |
network |
From an address in KAIO_ALLOWED_NETWORKS |
KAIO_NETWORK_LEVEL, admin by default |
Anything else gets 403 and a message naming the variable to set.
flowchart TD
req(["Request"]) --> origin{"Cross-site write<br/>or WebSocket?"}
origin -- yes --> deny403(["403<br/>naming the line to add"])
origin -- no --> signed{"Cluster signature?"}
signed -- valid --> cluster["cluster<br/>signed level, capped by<br/>KAIO_CLUSTER_LEVEL"]
signed -- invalid --> deny401(["401"])
signed -- none --> proxy{"From KAIO_TRUSTED_PROXIES,<br/>with the shared secret?"}
proxy -- yes --> viaproxy["proxy<br/>Remote-User, Remote-Groups<br/>mapped to a level"]
proxy -- no --> local{"Loopback or<br/>Unix socket?"}
local -- yes --> vialocal["local<br/>KAIO_LOCAL_LEVEL"]
local -- no --> network{"From<br/>KAIO_ALLOWED_NETWORKS?"}
network -- yes --> vianet["network<br/>KAIO_NETWORK_LEVEL"]
network -- no --> open{"Route with its own proof?<br/>health, register, metrics"}
open -- yes --> none["no level"]
open -- no --> deny403
cluster --> level{"Level reaches<br/>the route?"}
viaproxy --> level
vialocal --> level
vianet --> level
none --> level
level -- no --> deny403
level -- yes --> handler["Handler"]
handler --> audit[("Audit log<br/>for sensitive actions")]
deny403 -.-> auditGET /api/health, which
publishes the version and the server’s identity, POST /api/cluster/register,
which a join token gates, and /metrics once KAIO_METRICS_TOKEN is set.
Identity headers are only believed from the proxy
Section titled “Identity headers are only believed from the proxy”Remote-User and Remote-Groups (or the names KAIO_IDENTITY_USER_HEADER and
KAIO_IDENTITY_GROUPS_HEADER give) are read only from a request that
qualifies as proxy. From anywhere else, the loopback included, they are
ignored, and in every case they are stripped from the request before a handler
sees it. A client that sends Remote-User: admin straight to the port gets the
level of its address, never the one it claims.
flowchart LR
subgraph people ["People and machines"]
browser["Browser"]
cli["CLI, TUI,<br/>CI runner, agent"]
peer["Tailnet or<br/>LAN peer"]
stranger["Anything else"]
end
subgraph front ["Your layer"]
idp["Authelia, Authentik,<br/>oauth2-proxy"]
proxy["Reverse proxy<br/>adds Remote-User,<br/>Remote-Groups, secret"]
end
subgraph host ["Kaio host"]
kaio["kaio-server<br/>127.0.0.1:8080"]
docker[("Docker daemon")]
end
node["Node<br/>answers its control<br/>plane only"]
browser --> proxy
cli --> proxy
proxy <-.-> idp
proxy -- "trusted, with identity" --> kaio
peer -- "allowed, no identity" --> kaio
stranger -. "403" .-> kaio
kaio --> docker
kaio == "signed: user and level" ==> nodeTwo lists exist on purpose. KAIO_ALLOWED_NETWORKS lets a peer connect;
KAIO_TRUSTED_PROXIES lets it vouch for someone. A tailnet peer has the first
right and never the second.
The shared secret
Section titled “The shared secret”A proxy’s address is not proof on its own: another container on the same network, or another process on the proxy’s host, can reach Kaio from that address too. Set a secret the proxy adds to every request it forwards:
openssl rand -hex 32 > /etc/kaio/proxy-secretchmod 600 /etc/kaio/proxy-secretKAIO_PROXY_SECRET_FILE=/etc/kaio/proxy-secretWhen the proxy runs on the same host and no secret is set, any process on that
host can send Remote-User from the loopback too. Kaio therefore holds a user
named that way to KAIO_LOCAL_LEVEL, what a local call gets anyway, and treats
a loopback call naming no user as plain local. Tailscale Serve, which cannot send
a secret, works under that rule; any proxy that can send one should.
A request from a trusted proxy without it, or with the wrong one, is then not a proxy request: its identity headers are dropped, and unless its address is also local or on an allowed network, it is refused. The secret is compared in constant time, stripped before any handler, and never logged. It is a static header rather than a per-request signature because Caddy, Traefik and nginx can all add a fixed header and none of them can sign a request without a plugin.
One ladder for every interface
Section titled “One ladder for every interface”The levels are the ones /mcp always had, and they now apply to every caller,
whether it uses the web UI, the CLI, the TUI or an agent:
| Level | What it reaches |
|---|---|
read |
The dashboard, events, lists, logs, Compose files, versions, masked environments, scan results |
write |
Deploy, apply, update, start, stop, restart, pause, recreate, rollback, scan, check for updates, copy a stack, edit the environment |
admin |
Every deletion and prune, deleting a version, the shell, nodes and the cluster, the audit log, the diagnosis |
A route the table does not know needs admin. The shell sits at admin because
it is arbitrary execution, above anything write reaches. The web UI and the
TUI read GET /api/whoami to show who you are and grey out what your level does
not reach, but the server is the only judge.
Groups map to levels with KAIO_GROUPS_READ, KAIO_GROUPS_WRITE and
KAIO_GROUPS_ADMIN; a user in several gets the highest, and a group can raise
a user above KAIO_PROXY_LEVEL but never lower them below it. With no mapping
at all, a user the proxy let through gets admin, which is what a proxy in
front of Kaio meant before 0.6.0. With a mapping, KAIO_PROXY_LEVEL defaults to
off, so a user in none of its groups can load the page, see who they are and
do nothing else.
The browser is part of the attack surface
Section titled “The browser is part of the attack surface”A web page open in your browser can send requests to any address your browser
reaches, http://127.0.0.1:8080 included. Two defaults close that:
- the API answers with no CORS headers unless
KAIO_ALLOWED_ORIGINSnames an origin, so a page elsewhere cannot read a response; - a request that changes something, and every WebSocket upgrade, is refused
with
403when the browser marks it cross-site (Sec-Fetch-Site), or when itsOriginnames another host than the one it was sent to, unless that origin is named inKAIO_ALLOWED_ORIGINS.KAIO_ALLOWED_ORIGINS=*opens reading to every page and names none, so it never lets a write through.
Before 0.6.0 a page you visited could POST to http://localhost:8080/api/...
and restart, deploy or delete. It now gets 403 before anything runs.
/mcp keeps guards of its own: unset, KAIO_MCP_ALLOWED_ORIGINS refuses every
request carrying an Origin header, and KAIO_MCP_ALLOWED_HOSTS refuses any
Host you did not name.
An agent on the port is the port
Section titled “An agent on the port is the port”Setting KAIO_MCP puts the MCP endpoint on the same port
as the API, and an MCP client is one more caller, sorted like any other.
KAIO_MCP is now the highest rung any caller gets at /mcp: each one sees and
runs the tools of KAIO_MCP or of its own level, whichever is lower. An agent
behind a proxy that maps it to read lists read tools only, on a server where
you run with admin.
What changes with an agent is who is holding the controls. It decides which tool to call from text it was given, and that text may come from a container name, a log line or a compose file. Keep that bounded:
KAIO_MCPdefaults tooff. Left onread, no tool at/mcpcan change anything, whatever an agent is talked into calling.writeadds deploys, updates, lifecycle calls and rollbacks. None of them is a delete call and every deploy is a numbered version you can roll back, but do not read that as a sandbox:kaio_stack_deploytakes an arbitrary Compose file and runs it, so a service dropped from that file is removed with--remove-orphans, andprivileged: true, a host namespace or a bind mount of the Docker socket is granted as written.writeis worth exactly what a call to/apiis worth, which is root on the host.adminis where the calls with no undo live: removing a stack, a version, a container, an image, a volume, a network, and pruning. It is the rung to grant last, and the one whose tools a client should confirm.- Every tool carries the annotation its rung implies, read-only, non-destructive or destructive, so a client that asks before a destructive call has something to ask about.
- Every
writeandadmintool call is written to the audit log, refused ones included. - There is no shell tool, so
/mcpnever becomes arbitrary execution inside a container.
The audit log
Section titled “The audit log”Every sensitive action is recorded with who asked for it: deploys, applies,
updates, lifecycle calls, rollbacks, every deletion and prune, environment
edits, imports and exports, opening a shell, cluster and node operations, and
write or admin MCP tool calls. A refusal on any of them is recorded too.
| Column | Holds |
|---|---|
actor |
The user the proxy or the control plane named, else the source address, else unix |
source, via |
The address the request came from, and the kind of caller |
level |
The level the caller had |
action, target |
What was asked, stack.delete on blog for instance |
outcome, status |
ok, denied or failed, and the HTTP status |
No request body, no environment value and no header is ever written to it. Read
it with kaio-cli audit, under Manage → Audit in the web UI, in the TUI’s
Audit tab, with the MCP tool kaio_audit, or from GET /api/audit, all at
admin. Entries older than
KAIO_AUDIT_RETENTION_DAYS, 90 by default, are dropped.
A node records the user its control plane signed for, so an action taken through
the control plane reads alice on the node, not the control plane’s address.
Diagnose it
Section titled “Diagnose it”kaio-server doctor reads the server’s own configuration, on the machine it
runs on, without starting it, and names what leaves the daemon open:
sudo sh -c 'set -a; . /etc/kaio/kaio.env; exec kaio-server doctor'warn proxy-without-secret Identity headers are trusted from the proxy's address alone: anything else on that address can claim to be anyone fix: Generate a secret with `openssl rand -hex 32`, set KAIO_PROXY_SECRET_FILE, and have the proxy send it as X-Kaio-Proxy-Secretinfo trivy-unpinned The scanner image aquasec/trivy:latest is a moving tag, and it is handed the Docker socket fix: Pin KAIO_TRIVY_IMAGE to a digest: aquasec/trivy@sha256:...kaio-cli doctor asks a running server the same question, at admin, and adds
what it sees on its own side, such as credentials sent over plain HTTP. Both exit
with 1 when one finding is a danger, so either fits a CI job or a monitoring
check. The server also logs the findings at startup.
| Code | Severity | What it means |
|---|---|---|
public-bind-open |
danger | Listening off the loopback with KAIO_I_UNDERSTAND_NO_AUTH and nothing else |
socket-without-proxy |
danger | The Docker socket mounted in a container whose port is open with no trusted proxy |
mcp-any-host |
danger | KAIO_MCP_ALLOWED_HOSTS=* on a port off the loopback |
proxy-wide-range |
danger or warn | A trusted proxy range of 0.0.0.0/0, or wider than a /24 |
proxy-without-secret |
warn | Trusted proxies with no shared secret: on the loopback, any local process can name a user, up to KAIO_LOCAL_LEVEL |
secret-short |
warn | A shared secret under 32 characters |
mcp-admin |
warn | KAIO_MCP=admin |
cors-permissive |
warn | KAIO_ALLOWED_ORIGINS=*, which lets any page read the API |
metrics-open |
warn | /metrics on with no token |
data-readable |
warn | The data directory readable by its group or by others |
cluster-plain-http |
warn | A node reached over plain HTTP, outside the loopback and any overlay |
cli-plain-credentials |
warn | KAIO_ADDR sends credentials over plain HTTP, from kaio-cli doctor |
secret-in-env |
info | The shared secret read from the environment rather than a file |
trivy-unpinned |
info | The scanner image is a tag, not a digest |
Secrets
Section titled “Secrets”Variables flagged as secret are never returned by the API and are masked in the UIs. That protects the screen, not the storage:
- values are stored in clear text in SQLite;
- they are written to
data/stacks/<name>/.env, mode0600; - every stack version snapshots them, so deleted secrets survive in the history.
Treat data/ as a secret-bearing directory: same file permissions, same backup
handling, same disposal rules as a private key.
One route hands secrets back in the clear:
GET /api/stacks/{name}/env/export, which exists so a server can move a stack
to another server. It answers 401 unless the call is signed by the control
plane this server joined (see below), and it records an event against the
stack each time it answers. The node gateway forwards none of the signature
headers, so nothing reaches the export through
/api/nodes/{name}/proxy/{*path}. A signature proves who asks, it hides
nothing: over plain HTTP the secrets still cross the wire readable by anything
on the path. Put the cluster behind TLS or on a network you trust before you
move a stack across it.
A cluster widens what one port is worth
Section titled “A cluster widens what one port is worth”A server that keeps a cluster stores only the SHA-256 of
each join token it minted, and spends a token on the one join it lets through,
or drops it after 24 hours. A copy of its database therefore gives no way in.
Anyone who reaches its port can still mint a token and enrol a machine: that is
no worse than what the open port already allows, since they could drive the
daemon directly, but worth knowing. A token enrols and authorises nothing
afterwards, so kaio-cli cluster token --rotate retires a leaked one without
touching the servers already enrolled.
Every server also keeps the private half of an Ed25519 key in the same table.
On a control plane, that key is what its nodes trust: whoever holds it can sign
the calls that read secrets and volume data out of every node. It is one more
reason to treat data/ as the secret it already is.
A server that joined a cluster keeps no secret of the cluster: only its
control plane’s public key, which can check a signature and cannot make one. A
compromised node therefore leaks nothing that opens its siblings, and the join
token never reached it. kaio-cli cluster leave forgets the key, and the node
trusts no one again.
Since 0.6.0 the control plane signs every call it sends a node: the ones the gateway relays for the web UI, the CLI and the TUI, the shell’s WebSocket, and the calls a copy makes. A node therefore needs no open port to be driven: it answers its loopback, the addresses its own variables allow, and its control plane, by signature, from wherever it calls. This is the per-node credential: each node trusts one public key, each control plane signs with its own private key, and no shared token travels anywhere. Mutual TLS would add a PKI and a certificate rotation for the same guarantee.
Each signed call names the node it is meant for, its method, its path and
query, the SHA-256 of its body, a time, a random nonce, and the caller it acts
for: the user name and the level the control plane gave them. The node holds
the call to that level, capped by its own KAIO_CLUSTER_LEVEL, and writes the
user in its audit log. A copy is the one call that carries no level: the control
plane already held the caller to write for the whole operation, so its calls
name the user and leave the level to KAIO_CLUSTER_LEVEL, which lets a copy’s
export, import and clean-up through. A node refuses a signature made for another node, one
more than five minutes away from its own clock, one it has already seen, which
it remembers in SQLite so a restart does not reopen the window, and one whose
level or user was changed on the way. A body cannot be swapped on the way
either. The one body left unsigned is a volume archive, streamed as it is read,
and only the volume import route accepts one: on plain HTTP, whatever sits on
the path could replace it, as it can read the secrets that travel next to it.
TLS closes both.
Node rows hold no secret: a name, a URL, the result of the last probe, and the
public key the node joined with, which a later join under the same identity has
to sign with. And the registry is the control plane’s own: /api/nodes always
describes the server you are talking to, so a node cannot be used to enumerate
its siblings.
A control plane also reaches its nodes on your behalf. /api/nodes/{name}/proxy
forwards to any server in its registry, at the level the caller has on the
control plane, so whoever reaches the control plane with admin reaches every
node in it with admin. Its exposure should be the strictest of the set, not
the loosest.
Removing a node from the registry closes the path through the control plane,
and kaio-cli cluster leave on the node makes it stop trusting that control
plane’s signature.
A second consequence is outbound reach. Joining makes the server fetch an
address the caller chose: /api/cluster/register probes the advertise it is
given, and /api/cluster/join calls the control_plane_url it is given, with
the result reported back. Anyone who can reach the port therefore has a way to
ask the server to connect somewhere and learn whether it answered, including
addresses only that server can reach. It is not an escalation over the Docker
control the port already grants, but it is reach the port did not have before,
and it is worth knowing if Kaio sits somewhere with a privileged view of your
network.
The scanner runs privileged
Section titled “The scanner runs privileged”A vulnerability scan starts a throwaway Trivy container with the Docker socket
bound into it. Pin KAIO_TRIVY_IMAGE to a digest you trust rather
than leaving it on a moving tag, since that image is handed the daemon.
Telemetry
Section titled “Telemetry”Kaio sends nothing anywhere about you or your hosts. There is no analytics, no
crash reporting, no usage ping, no update check, no account or licence call, and
no opt-out to find, because there is nothing to opt out of. Neither binary
carries the address of a service this project runs, since this project runs
none. Everything the server records about your stacks, images, events and scans
stays in data/ on your own disk. See Data retention for how
long, and Backup and restore for what that directory is worth.
Traffic does leave the host, but only when you ask for something that needs it, and only toward hosts you chose:
| What goes out | Where it goes | What asks for it |
|---|---|---|
skopeo inspect on an image tag |
The registry that hosts that image | An update check, scheduled or from the dashboard |
| An image pull | The registry named in your Compose file | Deploying or updating a stack |
| The Trivy image, then its vulnerability database | Docker Hub, or wherever KAIO_TRIVY_IMAGE points, then Aqua’s database registry |
A vulnerability scan |
| Health checks, registration and proxied API calls | The node or control-plane URL you typed | A cluster you joined yourself |
| The release tarball and its checksum | kaio-labs.gaidot.net, or KAIO_BASE_URL |
You, running the install script once |
Nothing in that list is a report about you. Each one is the request that does the job you asked for, and the registry learns what any registry learns when you pull from it.
To hold any of this to account, deny the container egress to everything but your registry and watch what breaks. Update checks and scans stop, because those are the features that need the network. Deploying, reading logs, opening a shell and browsing the dashboard keep working, because nothing in them ever left the host.
What is guarded
Section titled “What is guarded”Stack names are validated against [a-z0-9][a-z0-9_-]* before touching the
filesystem, so a stack name cannot escape data/stacks/.
Hardening checklist
Section titled “Hardening checklist”Every line below has a worked setup, with the commands that prove it holds, in Hardening.
- Leave
KAIO_ADDRon127.0.0.1, or on a Unix socket, unless something in front of it authenticates. - Put a reverse proxy with authentication in front, name it in
KAIO_TRUSTED_PROXIES, give it a shared secret withKAIO_PROXY_SECRET_FILE, and expose only the proxy. See Reverse proxy. - Map your identity provider’s groups to levels, so that only the people who
need
adminhave it. - Never set
KAIO_I_UNDERSTAND_NO_AUTHon a network you do not control. - Give the container its own network rather than
network_mode: host. - Back up
data/as you would a credential store, and restrict who can read it. - Pin the Trivy image.
- If the server pilots nodes, treat its port as the union of every node’s port: guard it at least as strictly as the strictest node behind it.
- Leave
KAIO_MCPoff unless an agent needs it, and stop atreaduntil a write tool is something you want an agent reaching for. - If
KAIO_METRICSis on, setKAIO_METRICS_TOKEN./metricsreads nothing and changes nothing, but it names every stack and image you run and counts their CVEs, which is a map of what to attack. - Run
kaio-server doctorafter every change, and keep it at no danger.
What this project does not claim
Section titled “What this project does not claim”There are no users, passwords or sessions in Kaio, and there will not be: the
identity is the proxy’s, and Kaio only believes it from the proxy. Nothing in
Kaio rate-limits a caller either. The Host header of /api is not checked, so
DNS rebinding stays open to a browser on the same machine as an unproxied
loopback port.
Kaio, built by Régis Gaidot