Skip to content

Security

github-actions[bot] edited this page Nov 13, 2026 · 3 revisions

Security

Secrets at rest

All sensitive values — Coolify API tokens, SSH/S3 credentials, tar encryption keys, and restic repository passwords — are AES-256-GCM encrypted at rest with your MASTER_KEY (falling back to BETTER_AUTH_SECRET if unset). That includes the jobs waiting for an agent: the credentials a job carries are stored encrypted, decrypted only when an agent takes it, and erased once it ended.

Back up your MASTER_KEY. It is the root of all stored secrets and (with the restic engine) your backup encryption. If you lose it, encrypted data is unrecoverable. If it leaks, rotate credentials.

Backup encryption

  • tar engine — optional AES-256-GCM encryption of each artifact (a random key per destination, stored encrypted with MASTER_KEY).
  • restic engine — the repository is always encrypted with a random per-destination password (also stored encrypted with MASTER_KEY).

SSH host keys

CBM checks the host key of SSH destinations and jump hosts: the first one seen is kept (trust on first use, at the destination's first test or job), then a different one is refused and the job fails with both fingerprints. An admin forgets the keys of a destination whose server really changed. Before 2.8.0, every key was accepted. See Destinations.

Protection against deletion

CBM holds every destination's credentials, so a compromised CBM could delete backups. Mark the destinations holding your second copy Protected (CBM never deletes there), and give S3 destinations a versioned bucket with a key that can't delete old versions — CBM checks it and alerts if it stops being true. See Retention → Protection against deletion.

Agents & enrollment

  • Agents authenticate to the controller with a bearer token, stored only as a sha256 hash in the database.
  • Install tokens (instance card → … → Install command → "Reveal install command") are per-instance, shown once, and matched by hash. One enrolls a single agent, within 24 hours, then stops working; revealing a new one also invalidates the previous one. Each agent keeps its own credential (in its work dir, readable by its owner only), so a used or rotated install token never affects it. A token revealed before 2.8.0 keeps working for any number of agents until a new command is revealed (agents older than 2.8.0 enroll again at every start).
  • Agents make outbound connections only (they poll the controller) — nothing needs to be opened on your hosts.
  • An agent only talks to its controller over HTTPS, or plain HTTP to a private address (the same host, a Docker network, a LAN). Its credential and the destination credentials and keys its jobs carry never cross the internet in clear; AGENT_ALLOW_HTTP=true overrides it for a link protected otherwise (VPN, tunnel).
  • Before a restore pins an image, the controller asks its registry (Docker Hub, ghcr.io…) whether the recorded digest still exists: an anonymous, read-only HEAD on the image manifest, nothing about your data. Without outbound access the digest is simply kept.

API tokens (MCP)

Machine tokens for the MCP server or any external agent are created in Settings → API tokens (MCP) → New token. Each carries its own role (viewer / operator / admin), is shown once at creation, and is stored only as a sha256 hash. Revoke a token from the same list; it stops working immediately. See MCP server.

Trust model

  • The agent mounts the Docker socket, which grants root-equivalent access to its host. Run agents only on hosts you trust, and treat the agent image like any privileged workload.
  • With the cgroup freeze method, the agent starts a short-lived privileged helper container (host PID namespace, the host's /sys/fs/cgroup, no network) for the time of a freeze; it only writes the freeze switch of the containers being copied. It adds no access the Docker socket doesn't already give.
  • An agent update from the controller only runs an image from the repository the agent already runs from (any other is refused by the agent itself), and only admins can start one. The updater container has no network.
  • The controller holds the metadata DB and the master key — protect it like any admin panel (TLS, restricted network, strong BETTER_AUTH_SECRET).
  • Backups can contain your application data and secrets; secure your destinations accordingly (encryption at rest, restricted access).

Client address

Sign-in, sign-up, password reset and the /api/v1 API are rate-limited per client address. Behind a reverse proxy the controller only sees the proxy, so it reads X-Forwarded-For from the right: each proxy appends the address it received the request from, and the first entry that isn't a trusted proxy (TRUSTED_PROXIES) is the client. The leftmost entry is whatever the client sent, never trusted. With one proxy that sets the header (Traefik in Coolify), nothing needs to be configured; with several, list the inner ones in TRUSTED_PROXIES; behind Cloudflare, set CLIENT_IP_HEADER=cf-connecting-ip.

Don't publish the controller's port directly on the internet: without a proxy in front, any client can write the header itself.

Accounts & roles

The first registered account is the administrator, after which public sign-up closes. Add OAuth providers (GitHub/Google/GitLab) if you prefer SSO — see Configuration.

Additional users join by invitation with a role — admin / operator / viewer. Role checks are enforced server-side on every mutating action (the UI only hides what a role can't use, as a convenience). Invitation links are single-use, expire after 48h, are bound to the invited email, and are stored only as a sha256 hash — the plaintext is shown once and never persisted. The last admin can't be demoted or removed. Full details: Accounts & roles.

Two-factor authentication (authenticator app + single-use backup codes) can be turned on per account and required by an admin for admins or for everyone. It is enforced after a password sign-in and after a GitHub / Google / GitLab sign-in (no session exists until the code is checked), wrong codes are rate-limited and lock the account for a while, and a code can't be replayed. TOTP secrets are encrypted with BETTER_AUTH_SECRET; backup codes are stored encrypted too. See Accounts & roles.

Email-bearing flows (password reset, verification, emailed invites) require SMTP; the SMTP password is encrypted at rest like every other secret. See Email.

Clone this wiki locally