Install and operate a self-hosted OpenCTEM
platform on one Ubuntu VM: a hardened host, OpenCTEM (web console, API,
gateway, PostgreSQL, Redis) from signed release images pinned by digest,
Cloudflare Tunnel and Access in front, and encrypted daily backups with a
tested restore. Every stage is opt-in, rehearsable with --check --diff, and
keeps your site data outside this repository.
- Target: Ubuntu 26.04 LTS (24.04 works for every role except the pinned
Docker packages) or Rocky / Alma / RHEL 9, on any hypervisor or cloud VM.
Raise either floor with
openctem_min_ubuntuoropenctem_min_rhel. - Controller: Linux or macOS with Python 3.11–3.13 and ansible-core 2.18.
- Sensors are not installed here: they run elsewhere and connect to the platform through the same public URL.
flowchart LR
user(["People (browser)"]) -->|"HTTPS + Access login"| cf
sensor(["Sensors"]) -->|"HTTPS, Access bypass: /api/v2/sensor/*"| cf
ci(["CI pipelines"]) -->|"HTTPS, Access bypass: /api/v1/ci/..."| cf
cf["Cloudflare edge: TLS, Access, WAF rate limit"]
subgraph vm["Ubuntu VM: no inbound port except SSH from admin CIDRs"]
cfd["cloudflared"] -->|"tunnel network: http://gateway:80"| gw["gateway (plane routing)"]
gw -->|"origin network"| web["web console"]
gw -->|"origin network"| api["API"]
web --> api
api -->|"data network, TLS"| pg[("PostgreSQL")]
api -->|"data network, TLS"| rd[("Redis")]
end
cfd -.->|"outbound tunnel, port 7844"| cf
- Prerequisites
- Quickstart (15 minutes)
- Full runbook
- First administrator
- Backups and restore drill
- Upgrade and rollback
- Troubleshooting
- Security model and hardening checklist
- Repository layout and tests
No Ansible on the target? ansible-playbook scripts/render-standalone.yml
renders a directory that server runs with docker compose alone, and writes a
NEXT-STEPS.md into it saying what this kit does that the plain stack does not.
Detailed references: Installation scenarios · Private registry · Deploy without Ansible · Cloudflare Tunnel and Access · Firewall · Mail relay · docs site page.
Step-by-step guides on the documentation site (they cover the same ground with more context, for both ways of serving OpenCTEM):
- Install with Ansible: VM, controller, inventory, stages, backups, upgrade and rollback.
- Deploy with Cloudflare Tunnel and Access: no inbound port.
- Deploy without Cloudflare: your own TLS proxy, public (Let's Encrypt) or private (internal CA).
| Minimum | Notes | |
|---|---|---|
| VM | 4 vCPU, 8 GB RAM (7 GB usable), 80 GB disk | The default limits fit this size with ~1.5 GB left to the OS (below). |
| OS | Ubuntu 26.04 LTS or Rocky/Alma/RHEL 9, fresh install, SSH reachable | A sudo user (ubuntu), your SSH public key in its authorized_keys. |
| Console | hypervisor console access to the VM | for recovery if SSH breaks; take snapshots |
| DNS | a zone on Cloudflare (any plan) | one host name, e.g. ctem.example.com |
| Cloudflare | Zero Trust (free tier is enough) with your identity provider | docs/CLOUDFLARE-ACCESS.md |
| Backups | an age key pair, kept OFF the server | recommended; without it backups stay local and unencrypted |
Memory budget (4 vCPU / 7 GB): PostgreSQL 2 GB (shared_buffers 512 MB), API
1.5 GB, web 768 MB, Redis 512 MB, gateway 256 MB, cloudflared 256 MB (job
signer 128 MB): about 5.4 GB for containers. Change the openctem_mem_* and
openctem_pg_* values in your inventory for a bigger host.
Without Cloudflare (optional): set openctem_ingress: loopback. The
gateway then listens on 127.0.0.1:8080 (plain HTTP) for a TLS reverse proxy
you run on the host (Caddy, nginx). You own TLS, client-address forwarding
(the proxy must set X-Forwarded-For) and access control. For a proxy on
another host, publish the port where it can reach it with
openctem_loopback_bind and name that proxy in openctem_trusted_proxies:
the port is plain HTTP, so the network is then the only thing in front of
the application, and without the second setting every client address the
platform records becomes the proxy's. Opening 443 in the
firewall is then your change. Also set monitoring_external_probes: false
(those probes assume Cloudflare). The guide
Deploy without Cloudflare
has a Caddyfile for a public host (Let's Encrypt) and for a private network
(internal CA), the firewall rules and the checks.
Controller, not server. Run every ansible and ansible-playbook command on
a controller (your workstation or an admin box), never on the VM you install:
Ansible connects to the VM over SSH, and a firewall or SSH stage would cut your
own session. The controller needs Python 3.11 to 3.13 and git, and must be
able to SSH to the VM with a key.
On the controller:
git clone https://github.com/openctemio/openctem-ansible.git && cd openctem-ansible python3 -m venv .venv && . .venv/bin/activate pip install 'ansible-core>=2.18,<2.19' ansible-galaxy collection install -r requirements.yml -p ./collections # No python3-venv on the controller (minimal Ubuntu, no sudo)? Create the venv # without pip and install into it from outside: # python3 -m venv --without-pip .venv # pip3 install --python .venv/bin/python 'ansible-core>=2.18,<2.19' # then call .venv/bin/ansible-playbook and .venv/bin/ansible-galaxy # Your site data lives OUTSIDE the repository. mkdir -p ~/.config/openctem-ansible && cp -r inventories/example ~/.config/openctem-ansible/inventory mv ~/.config/openctem-ansible/inventory/group_vars/all.yml.example ~/.config/openctem-ansible/inventory/group_vars/all.yml $EDITOR ~/.config/openctem-ansible/inventory/hosts.ini # your VM address and user $EDITOR ~/.config/openctem-ansible/inventory/group_vars/all.yml # host name, admin CIDRs, age public key INV=~/.config/openctem-ansible/inventory/hosts.ini
-i must name the file hosts.ini (as INV does), not the inventory
directory: a directory gives No inventory was parsed. group_vars/ beside the
file is still read. -K below (--ask-become-pass) asks once for the sudo
password of the SSH user on the VM (BECOME password:); it stays in
Ansible's memory and is never written anywhere. Leave -K out when that user has
passwordless sudo. Check the connection first: ansible -i $INV openctem -m ping.
In Cloudflare: create the tunnel and copy its token (§1). On the VM (console or SSH), store the token:
sudo install -d -m 0700 -o root -g root /opt/openctem/secrets sudo sh -c 'umask 077; cat > /opt/openctem/secrets/cloudflared_tunnel_token' # paste, Enter, Ctrl-D sudo chown 65532:65532 /opt/openctem/secrets/cloudflared_tunnel_token && sudo chmod 0400 /opt/openctem/secrets/cloudflared_tunnel_token
Then, from the controller (-K asks for the sudo password):
ansible-playbook -i $INV playbooks/00-preflight.yml -K # read-only ansible-playbook -i $INV site.yml -K --check --diff \ -e apply_os=true -e apply_ssh=true -e apply_docker=true -e apply_firewall=true ansible-playbook -i $INV site.yml -K \ -e apply_os=true -e apply_ssh=true -e apply_docker=true -e docker_daemon_restart=true \ -e apply_firewall=true -e apply_openctem=true -e apply_backup=true -e apply_monitoring=true
Finish the Cloudflare side (§2–§5), create the first administrator (§4), and run the acceptance tests (§3.10). For a production host, follow the full runbook instead: it applies one stage at a time with a snapshot and a dry run in between.
Every command below runs from the repository root on the controller with
INV=~/.config/openctem-ansible/inventory/hosts.ini. Each stage changes the
host only when its apply_* flag is true. Without it, the play prints that it
was skipped.
ansible -i $INV openctem -m ping ansible-playbook -i $INV playbooks/00-preflight.yml -K
Checks the OS, sudo, CPU/RAM/disk, the tunnel token's owner and mode (metadata
only: the token is never read), Docker, listeners, ufw, time sync (fails when
the clock is unsynchronised or more than 5 s off, because sensor signatures
allow only about 2 minutes of skew; fix with sudo chronyc makestep, see
"Time synchronisation" in docs/self-hosting-with-ansible.md) and the
effective sshd settings. Fix anything unexpected before going on.
Take a hypervisor snapshot of the VM, and keep its console open for the SSH and firewall stages. A snapshot is a change checkpoint, not a backup: delete it after the change is accepted.
ansible-playbook -i $INV site.yml -K --check --diff -e apply_os=true -e apply_ssh=true \
-e apply_docker=true -e apply_firewall=true--check cannot predict everything: package installs, the DevSec roles'
internal checks and Docker-dependent tasks are skipped or approximate on a host
without Docker yet. Read the diff; then apply stage by stage.
ansible-playbook -i $INV playbooks/10-os.yml -K -e apply_os=trueDevSec OS hardening (kernel/sysctl, file permissions, login defaults; IPv4
forwarding kept on for Docker), unattended security upgrades (no automatic
reboot unless os_baseline_unattended_reboot: true), chrony (steps the clock whenever it is
more than 1 s off), auditd with
rules for identities, sudoers, SSH, Docker and /opt/openctem/secrets
(reads included), and a persistent journal capped at 1 GB / 1 month. Each part
can be turned off (roles/os_baseline/defaults/main.yml); tags os_devsec,
os_updates, os_time, os_audit, os_journal.
ansible-playbook -i $INV playbooks/20-ssh.yml -K -e apply_ssh=true # stage 1 ansible-playbook -i $INV playbooks/20-ssh.yml -K -e apply_ssh=true -e ssh_stage=2 # stage 2
Stage 1 applies DevSec SSH hardening (no root login, no forwarding, strong algorithms) and keeps password login as a fallback. It also installs fail2ban for sshd (admin CIDRs never banned). Open a new SSH session with your key before stage 2. Stage 2 first proves a key-only login from this controller, refuses otherwise, then turns passwords off and proves the key login again.
ansible-playbook -i $INV playbooks/30-docker.yml -K -e apply_docker=true -e docker_daemon_restart=trueDocker Engine and the compose plugin from Docker's apt repository. The key is
checked by hash and fingerprint, versions are pinned in versions.yml and
held (apt-mark hold). The role stops with a clear message if Docker
publishes no repository for the host's release. daemon.json: log rotation,
live-restore, userland-proxy: false, no-new-privileges. Nobody is
added to the docker group (it is root-equivalent); use sudo docker ....
ansible-playbook -i $INV playbooks/35-firewall.yml -K -e apply_firewall=trueufw: deny inbound except SSH from admin_cidrs. Refuses to run if this
controller is outside them. Read docs/FIREWALL.md for why
Docker-published ports bypass ufw and how this deployment avoids publishing any.
The same stage can also close the stack's outbound side: with
openctem_egress_policy: restricted (the default for a hosted service,
openctem_signup_mode: open) the API and the tunnel connector cannot reach
private, link-local/metadata, CGNAT, loopback or host-local addresses, only the
internet. Operator-approved internal destinations (an internal SMTP relay, an
on-premises Jira) go in openctem_egress_allow. Inside a corporate network
whose only way out is an HTTPS proxy, openctem_feed_proxy sends the
platform's own feeds through it (nothing an organization configures). See
docs/FIREWALL.md.
Place the tunnel token first (see the quickstart), then:
ansible-playbook -i $INV playbooks/50-openctem.yml -K -e apply_openctem=trueWhat it does, in order:
- checks that the tunnel token is present, owned by uid 65532 and mode 0400 (metadata only), and that the release is pinned by digest;
- copies the release's gateway configuration and database-roles SQL (vendored
here, verified against
SHA256SUMSon the controller); - generates every secret on the host (
/usr/local/sbin/openctem-secrets,openssl rand): database superuser, migrator and app passwords, Redis password,APP_ENCRYPTION_KEY,FINGERPRINT_KEY, metrics token. Files are 0400 in/opt/openctem/secrets(0700, root). Values never leave the host or reach Ansible output; a second run changes nothing; - verifies every OpenCTEM image digest with cosign against the release
workflow's keyless identity
(
https://github.com/openctemio/openctem/.github/workflows/docker-publish.yml@refs/tags/<version>), before pulling; - renders
/opt/openctem/compose.yml(+compose.cloudflared.yml), pulls, starts with--wait: database roles and migrations run as one-shot jobs before the API starts; - runs
/usr/local/sbin/openctem-verify: every service healthy, no port published, the gateway routes the console, the API, the sensor and CI planes correctly, internal endpoints closed, other host names refused.
Containers run with cap_drop: ALL (Postgres and Redis keep only what their
entrypoints need to drop to their own users), no-new-privileges, read-only
root filesystems where the image allows, memory/CPU/PID limits, health checks,
restart: unless-stopped and rotated logs.
From the release that ships openctem-console (console_service in
versions.yml), the platform console runs as its own service on its own site
(recommended in production: its own host name, openctem_admin_site: host,
behind its own Cloudflare Access application; the default is a second port,
8443, on the loopback ingress). It is never published through the tunnel
without that zero-trust layer; see
docs/self-hosting-with-ansible.md.
The platform e-mail needs one SMTP server. If you run none and want no online provider, the kit can install a send-only Postfix relay beside OpenCTEM. Off by default; see docs/MAIL-RELAY.md (security properties, the settings, the DNS records, troubleshooting).
# inventory: openctem_mail_relay: true, openctem_mail_relay_from, mail_relay_hostname, mail_relay_sender_domains ansible-playbook -i $INV playbooks/52-mail-relay.yml -K -e apply_mail_relay=true # before the OpenCTEM stage
Follow docs/CLOUDFLARE-ACCESS.md:
the public hostname route to http://gateway:80 (in the dashboard, or with
cloudflared_management: local for a locally managed tunnel); one Access application for
people (IdP + MFA); Bypass applications on exactly /api/v2/sensor/*,
/api/v3/sensor/*, /api/v1/ci/oidc/exchange and /api/v1/ci/runs/*; a WAF
rate limit on them; WebSockets on.
Sensors and CI use the same URL as people: https://<openctem_app_host>.
On the host: sudo openctem-verify. From outside: the commands and the
expected results in docs/CLOUDFLARE-ACCESS.md §6
and the matrix in docs/FIREWALL.md. Then
the exposure audit and the general audit:
ansible-playbook -i $INV playbooks/85-exposure-audit.yml -K ansible-playbook -i $INV playbooks/80-audit.yml -K
ansible-playbook -i $INV playbooks/55-backup.yml -K -e apply_backup=true -e backup_run_now=true ansible-playbook -i $INV playbooks/60-monitoring.yml -K -e apply_monitoring=true
Then run a restore drill (§5).
OpenCTEM has no default account. Create the first platform administrator and its break-glass backup on the server's console or an interactive SSH session. The one-time credentials are printed once, to that terminal only. The wrapper refuses to run without a terminal, so it can never print into Ansible output or a log file.
sudo openctem-bootstrap-admin [email protected] [email protected] # optionally the first organization and its owner: sudo openctem-bootstrap-admin [email protected] [email protected] \ -org-name="Example Security" [email protected]
Sign in at https://<app host>/login with the printed temporary password,
change it, and enroll an authenticator (TOTP), which the admin console
requires. Store the break-glass credentials offline. Organizations are created
by the platform administrator: public sign-up is off (openctem_signup_mode: disabled, the API's SIGNUP_MODE), and no console change can open it. Configure
e-mail in the admin console (System → E-mail) so invitations can be sent.
openctem_signup_mode sets the API's sign-up ceiling (SIGNUP_MODE):
| Value | Who can create an account | Who creates organizations |
|---|---|---|
disabled (default) |
the platform administrator, an invitation, or an organization's SSO | the platform administrator |
domain |
also anyone whose address is on an organization's verified domain; they join that organization | the platform administrator |
open |
anyone (hosted service) | anyone, within the console policy and the limits |
The admin console (System → Sign-up) can keep sign-up closed or pause it below
the ceiling, never above it. domain and open verify every self-registered
address, so the API refuses to start until the platform e-mail is set: run
openctem-bootstrap-admin with BOOTSTRAP_SMTP_* first, or deploy once with
disabled, set System → E-mail, then change the mode and deploy again.
Hosted-service sign-up (open on the internet) also needs Cloudflare
Turnstile, or the API refuses to start in production:
openctem_signup_mode: open openctem_captcha_turnstile_site_key: "0x4AAAA..." # public site key
and the secret on the server (never in the inventory), which the secrets
script adds to api.env:
printf '%s' '0x4AAAA...secret' | sudo install -m 0400 /dev/stdin /opt/openctem/secrets/captcha_turnstile_secret
Upgrading from a kit that set openctem_tenant_creation_mode: remove it.
admin_only is openctem_signup_mode: disabled (the default); self_service
is open. The play stops while the old variable is set.
The client ID and the switches are ordinary settings in openctem_api_env; the
client secret stays on the server (never in the inventory) and the secrets
script adds it to api.env. Example for Google (callback URL to register with
Google: https://<your host>/auth/callback/google):
openctem_api_env: OAUTH_ENABLED: "true" OAUTH_GOOGLE_ENABLED: "true" OAUTH_GOOGLE_CLIENT_ID: "1234-abc.apps.googleusercontent.com"
printf '%s' 'GOCSPX-...' | sudo install -m 0400 /dev/stdin /opt/openctem/secrets/oauth_google_client_secret
GitHub and Microsoft use OAUTH_GITHUB_* / OAUTH_MICROSOFT_* and the files
oauth_github_client_secret / oauth_microsoft_client_secret. Then run
playbooks/50-openctem.yml -e apply_openctem=true (the API restarts with the
new api.env). A provider appears on the sign-in page only when it is enabled
and both its client ID and secret are set. Removing the file and the settings
turns it off at the next run.
The platform console keeps a hash-chained audit log of the platform administrators' actions in the database. The sink writes a copy outside the database, so a database-level rewrite is detectable.
Which releases have it:
- Releases from v0.22.0 on (
admin_audit_sink_removedinversions.yml): the audit stream is not included in the release's own images. Leaveopenctem_admin_audit_sinkunset;MANAGED_SERVICEneeds no sink. A server refuses to start while anADMIN_AUDIT_SINK*setting is present, and the kit's checks stop the run earlier, before changing anything (see the upgrade note below). The variables below then apply only with a custom server image that includes the stream. - Earlier releases that require it (
admin_audit_sink_required): a managed service (MANAGED_SERVICE: "true"inopenctem_api_env) must have a sink; the server refuses to start without, andplaybooks/50-openctem.ymlfails in its checks, before changing anything.
| Variable | Default | Meaning |
|---|---|---|
openctem_admin_audit_sink |
'' (off) |
file, or an https:// URL |
openctem_admin_audit_sink_head_interval |
'' (API default, 15m) |
interval of the signed chain-head records, e.g. 5m |
openctem_admin_audit_sink_dir |
/opt/openctem/admin-audit |
file mode: host directory |
openctem_admin_audit_sink_provided |
false |
true only with a custom server image that includes the audit stream (see the upgrade note below) |
-
file: the kit createsopenctem_admin_audit_sink_dir(owner uid 1000, the API's user, mode 0750), mounts it into the API at/var/lib/openctem-admin-auditand setsADMIN_AUDIT_SINK=file:///var/lib/openctem-admin-audit/admin-audit.jsonl.openctem-backuparchives the directory asadmin-audit.tar.gz, so the copy leaves the host with the (age-encrypted, off-host) backups. Restore it withtar -xzfinto the directory. -
https://host/path: the API posts each record, signed with an HMAC key, to a receiver you run. Create the key on the server first (the kit never puts it in the inventory; the API has no_FILEvariant, so the generatedapi.envcarries it like the other secrets):sudo sh -c 'umask 077; openssl rand -hex 32 > /opt/openctem/secrets/admin_audit_sink_secret'The file must be at least 32 bytes and mode 0600 or 0400; give the same key to the receiver, which verifies the signature with it. The backup includes the key in
secrets.tar.gz. -
syslog+tls://is not supported by this kit yet (the API needs CA and client certificate files mounted into the container); the checks refuse it.
Upgrade note, releases flagged admin_audit_sink_removed. The images
of such a release do not include the audit stream (it is provided by an
optional module) and refuse to
start while ADMIN_AUDIT_SINK (or any ADMIN_AUDIT_SINK_*) is set;
MANAGED_SERVICE=true no longer needs a sink. For such a release the checks
refuse a non-empty openctem_admin_audit_sink (failing before the host is
touched, not at container start) unless openctem_admin_audit_sink_provided: true, which you set only when openctem_custom_api_image is an API image that
includes the stream (the checks refuse the flag without one; see
Custom server image: that keeps the sink, its mount and
its position across the upgrade). To upgrade a server that uses a sink with
the release's own images, unset openctem_admin_audit_sink; the kit
then renders no ADMIN_AUDIT_SINK* variable and no mount. The existing file
copy under openctem_admin_audit_sink_dir and the backup of it stay on disk;
nothing is deleted. scripts/vendor-release.sh prints the flag from the
release's own source; every release from v0.22.0 on carries it, and the checks
refuse such a versions.yml entry without it (or with
admin_audit_sink_required as well). Before such a release the checks also
read the server: a compose override file (compose.override.yml,
docker-compose.override.yml, .yaml too) in openctem_root, or an env file
in openctem_root or openctem_secrets_dir other than the generated
api.env, that still sets an ADMIN_AUDIT_SINK* variable fails the run with
the file names (never their content), before anything changes. Remove those
lines first.
Threat model. The file sink is on the same host as the database: it protects
against rewrites inside the database and leaves the host with the backups, but
anyone with root on the host can still edit both. An https receiver run by a
different party (or at least on a different host and account) is the real
off-box copy: use it for a hosted service. Neither mode stores a secret in the
inventory, the compose file or git.
An installation can run a custom build of the platform API: an image that is
this release's core with extensions compiled in (for example one that
provides a feature not included in the release's own image, such as the
administrators' audit stream from a release flagged admin_audit_sink_removed).
It replaces the image of the api service only; web, console, gateway,
migrations, the job signer and the first-admin tool keep the release's
signed images.
openctem_custom_api_image: registry.example.com/org/server:v0.22.0@sha256:<64 hex> openctem_custom_api_cosign_identity: https://github.com/<org>/<repo>/.github/workflows/<workflow>.yml@refs/tags/v0.22.0 # openctem_custom_api_cosign_issuer: https://token.actions.githubusercontent.com # the default # Its own migrations, if it has any (an argv list; never a password in it): # openctem_custom_api_migrate_command: ["/app/<tool>", ..., "-database", # "postgres://openctem_migrator@postgres:5432/openctem?sslmode=require", "up"] # openctem_admin_audit_sink_provided: true # only if this image includes the audit stream # openctem_registry_docker_config_dir: /root/.docker # a private registry (below)
| Variable | Default | Meaning |
|---|---|---|
openctem_custom_api_image |
'' (the release's image) |
image reference pinned by digest; used as given (openctem_registry_mirror does not rewrite it) |
openctem_custom_api_cosign_identity |
'' |
exact keyless certificate identity of the workflow that signs it; required with the image |
openctem_custom_api_cosign_issuer |
GitHub Actions OIDC | certificate issuer of that identity |
openctem_custom_api_migrate_command |
[] |
the image's own migrations, run once per deploy as the one-shot migrate-extension |
What the kit enforces:
- Pinned and verified. The reference must end in
@sha256:<64 hex>. Before anything is pulled (also in--check), cosign verifies its keyless signature againstopenctem_custom_api_cosign_identityand the issuer, and the release's own images against the release identity as always. A custom image cannot run unverified:openctem_verify_signatures: falseis refused with it. - Built on this release. The signature must carry the annotation
io.openctem.core.version=<openctem_version>(cosign sign -a io.openctem.core.version=vX.Y.Z). An image built on another release fails the check, so upgradingopenctem_versionwithout a new custom image stops before the host changes. - Migrations. With
openctem_custom_api_migrate_command, the one-shot servicemigrate-extensionruns the custom image with that argv (first element as the entrypoint) aftermigrateand before the grants and the API, with the migrator's role andmigrate.env(PGPASSWORD), on the data network, read-only. In releases that rerun the least-privilege SQL after the migrations (db-grants, every release flaggedconsole_db_role), that rerun waits for it too and covers any schema its migrations created. A password in the arguments is refused. - The check prints which API image this deploy uses and with which identity.
- Rollback (
playbooks/71-rollback.yml, and the automatic rollback of a failed deploy) restores the previous compose file, which holds the previous API image by digest, and starts it without one-shot jobs (migrate-extensionincluded). A schema the custom image's migrations created stays, unused, in the database.
Private registry. docker compose pull uses root's Docker login on the host,
and the cosign check runs in a container that needs the same login:
# on the host, as root, with a read-only (pull) token of that registry sudo docker login <registry host> -u <user> --password-stdin < token-file
then set openctem_registry_docker_config_dir: /root/.docker (mounted
read-only into the cosign container). The cosign check runs as the owner of
that config.json (root's is readable by root only), still with a read-only
file system and no capabilities; a directory without config.json stops the
run before anything changes. Use a token that can only read packages, and
rotate it like the other host secrets.
tests/custom-image.sh covers the refusals, the rendered compose file
(api image, migrate-extension, the sink and its mount kept) and the cosign
commands, including an image built on another release.
By default the images come from ghcr.io/openctemio and the role pulls from the public
registries. To run from your own registry (Harbor, Nexus, a GitLab registry), mirror the
images with scripts/mirror-to-registry.sh — the walkthrough is
docs/CORPORATE-REGISTRY.md — and set, in group_vars:
openctem_registry_mirror: registry.example.com/openctem # replaces ghcr.io/openctemio openctem_third_party_registry_mirror: registry.example.com/mirror # replaces the host of the others # openctem_registry_docker_config_dir: /root/.docker # the host's `docker login` for the cosign check # openctem_registry_ca_file: /etc/ssl/certs/registry-ca.pem
- OpenCTEM images (
openctem-server, published asopenctem-apiup to v0.22.x,openctem-web,openctem-gateway,migrations,openctem-console): the prefix is swapped, the repository name and the digest stay, soghcr.io/openctemio/openctem-server@sha256:...becomesregistry.example.com/openctem/openctem-server@sha256:.... The digest is the integrity anchor: a mirror that serves other bytes fails the pull. - Signatures. The cosign check runs against the mirror reference with the same
certificate identity and issuer as before, so the mirror must hold our signatures. They
are OCI referrers of the digest: copy them with the image
(
cosign copy <src>@sha256:... <mirror>/<name>ororas cp -r). If the signature is not on the mirror the run stops before anything is pulled; there is no way to skip it exceptopenctem_verify_signatures: false, which you should not use. - Third-party images (PostgreSQL, Redis, rclone, cloudflared, cosign): the registry host
is replaced and the path kept, so
docker.io/library/postgresis read fromregistry.example.com/mirror/library/postgres,docker.io/rclone/rclonefrom.../rclone/rclone,docker.io/cloudflare/cloudflaredfrom.../cloudflare/cloudflaredandghcr.io/sigstore/cosign/cosignfrom.../sigstore/cosign/cosign. Digests are unchanged. These variables cannot be overridden one by one ingroup_vars(versions.ymlis loaded with higher precedence); use the mirror variable. - Registry access. The host runs
docker login <registry>once (root's Docker config); for the cosign check, which runs in a container, setopenctem_registry_docker_config_dirto the directory holding thatconfig.json(mounted read-only). A private CA is trusted by the Docker daemon through/etc/docker/certs.d/<host>/ca.crt, and by the cosign check throughopenctem_registry_ca_file(mounted read-only). Plain-HTTP registries are not supported. - Nothing changes while both mirror variables are empty (the rendered files are identical).
Both are validated by the preflight (a host and optional path: no scheme, no digest).
tests/registry-mirror.shrenders both ways and checks the cosign command that would run.
OpenCTEM (v0.9.6 and later, with fixes in v0.9.7) keeps each organization's assets covered on its own: a background loop takes the assets that are due for a capability (subdomain discovery, DNS, ports, HTTP probe, templates; never an intrusive one), passes them through the scope gate and runs them on the organization's "Continuous coverage" scans. That needs a sensor able to run those tools.
-
On by default for every organization. It stays off for an organization whose scan approval mode is Strict, until that organization turns it on.
-
Per organization: console → Scoping → Settings → Automatic coverage. Changing it needs the scope-approver permission and a recent re-authentication; it is audited and every administrator is notified.
-
Platform-wide (operator):
ASSET_COVERAGE_ENABLED: "false"turns the loop off, andASSET_COVERAGE_DAILY_BUDGETcaps attempts per organization per 24 hours (default 5000). Set them in your inventory:openctem_api_env: ASSET_COVERAGE_DAILY_BUDGET: "2000"
then rerun
playbooks/50-openctem.yml.openctem_api_envaccepts non-secret settings only; the role refuses the ones it manages itself.
Review each organization's scope (Scoping) before onboarding its assets: with automatic coverage on, in-scope assets are scanned without a manual trigger.
openctem-backup runs daily (systemd timer, 03:15 UTC) and on demand
(sudo systemctl start openctem-backup). One backup is a directory under
/var/backups/openctem/<UTC time>/ (0700, root) with:
openctem.dump:pg_dump -Fc, checked withpg_restore --list;api-data.tar.gz: uploaded attachments and evidence;signer-*.tar.gz: the job signer's key and state, when the signer is on;secrets.tar.gz: the generated secrets.APP_ENCRYPTION_KEYdecrypts the stored integration credentials, so a dump without it is unusable. The tunnel token is not included: re-issue it in Cloudflare;deployment.tar.gz,VERSION,SHA256SUMS.
Retention: backup_keep_days (14).
Two modes:
backup_age_recipient |
Mode |
|---|---|
| empty | local: plaintext files, root-only, on this host only. An off-host copy is refused, and every run logs that the backups are not off-host. |
age1... (public key) |
age: every file is encrypted on the host to your public key (*.age + MANIFEST.sha256); the plaintext staging copy is deleted. Off-host copy allowed. |
Create the key on your workstation, never on the server:
age-keygen -o ~/openctem-backup-identity.txt # keep it offline (password manager, hardware token) age-keygen -y ~/openctem-backup-identity.txt # prints age1...: put it in backup_age_recipient
Off-host copy: set backup_offsite_command to a command that receives the
new backup directory as $1, e.g. rclone copy --config /root/.config/rclone/rclone.conf "$1" offsite:openctem/$(basename "$1"). Keep
the remote's credentials in a root-only file on the host. Only encrypted
backups are copied.
Off-host backups are encrypted, signed and cannot be deleted from the host.
The role refuses an off-host copy without backup_age_recipient. Every backup
manifest (MANIFEST.sha256), WAL segment and base-backup meta.json is signed
with an ed25519 key generated once on the host (/etc/openctem/backup-signing,
root 0400); age alone proves nothing about the author, because the recipient
key is public. The backup play prints the public key as an allowed_signers
line: store it off the host and pass it to restores,
--allowed-signers=FILE (or set backup_signing_allowed_signers, which also
puts a copy on the host for the drill). Restore, drill and point-in-time
recovery refuse an unsigned or badly signed backup unless you pass
--allow-unsigned (logged to the journal). Backups made before this change are
unsigned: restore them with --allow-unsigned once. The bucket credential on the host should be
write-only, with versioning and object lock on the bucket and pruning by a
lifecycle rule: see docs/BACKUP-PITR.md; the host
deletes from the bucket only with backup_wal_prune: true.
Restore drill (monthly at least): restores into a throwaway PostgreSQL with no network and compares row counts with the running database, without touching the stack.
# local mode sudo openctem-restore-drill # age mode: copy the identity to the host for the drill only, then delete it scp ~/openctem-backup-identity.txt vm:/tmp/id.txt ssh -t vm 'sudo install -m 0600 /tmp/id.txt /root/drill.key && rm /tmp/id.txt && \ sudo openctem-restore-drill /var/backups/openctem/<UTC time> /root/drill.key; sudo rm -f /root/drill.key'
Full restore over the running stack (stops cloudflared, gateway, web and API while it runs, replaces the database and the uploaded files, re-applies the database roles, starts what was running, verifies):
sudo openctem-restore /var/backups/openctem/<UTC time> [/root/drill.key] --yes --allowed-signers=/path/to/allowed_signers
It refuses a backup of another release than the one running
(--allow-version-mismatch), saves the current database to
/var/backups/openctem/pre-restore-<time>.dump[.age] before dropping it
(--skip-pre-restore-dump only if it cannot be dumped; delete the file once
you are satisfied, it is never pruned), and logs who ran it
(journalctl -t openctem-restore).
Continuous archiving and point-in-time recovery (off by default; needs an
S3-compatible bucket and its access key, which only you can provide): the
database ships every WAL segment, encrypted, to the bucket, and
openctem-restore --pitr "<UTC time>" recovers to a time. RPO about 6
minutes. See docs/BACKUP-PITR.md.
On a new host, deploy the backup's release first (VERSION), then add
--with-secrets: it restores the generated secrets (so APP_ENCRYPTION_KEY
matches the data) except the new host's own Postgres superuser password. Rerun
playbooks/50-openctem.yml afterwards to reset file owners.
The job signer (openctem_job_signer: true, the default) signs every job the
API hands a sensor. It runs as its own container (user 1001, no network), with
its key and state in their own volumes (signer-keys, signer-state); the key
volume is never mounted into the API, which reaches the signer only through a
Unix socket on a shared volume. The first deploy creates the key and prints its
id and public key; record them. The API refuses to start without the signer
(APP_ENV=production); the preflight stops an inventory with
openctem_job_signer: false unless openctem_api_env sets
SIGNER_DANGEROUS_ALLOW_UNSIGNED_JOBS: "true" (not recommended).
openctem_signer_ledger (default audit) is the signer's scope-ledger mode:
audit records what enforce would refuse and still signs, which is the safe
mode when upgrading an installation that already signed jobs. Bootstrap the
ledger (docs/architecture/job-signing.md, "Scope ledger" in the OpenCTEM
repository), then set openctem_signer_ledger: enforce.
Feed relay. With feed relay the OpenCTEM API makes no outbound feed
requests: a platform-owned shared sensor downloads the signed feed files from
allowlisted https origins (GET only) and uploads them. This kit installs no
sensor (see "Sensors are not installed here"), so it has no sensor variables
and no -feed-relay step: the sensor runs elsewhere and relays by default
when it is a shared sensor with a pinned job-signing key
(SENSOR_FEED_RELAY=0 turns it off there; that is host policy and only
narrows). The kit's only part is the signer's allowlist:
openctem_sensor_feed_relay_origins (default [], full https download
prefixes, matched exactly by the signer, such as
https://mirror.example.com/vulnfeed-bundles/releases/latest/download for a
mirror whose VULNFEED_BASE_URL is
https://mirror.example.com/vulnfeed-bundles/releases). When set, the kit
renders SIGNER_FEED_ORIGINS on the signer container as the official origins
(openctem_feed_relay_official_origins) followed by these: a set
SIGNER_FEED_ORIGINS replaces the signer's built-in official list. Add a mirror there and in that sensor's
SENSOR_FEED_RELAY_ORIGINS; an origin missing on either side is refused. A
new database created by this kit does not store relay mode (that needs
bootstrap-admin sensor-token ... -feed-relay with a bundled sensor), and an
existing installation stays direct because its feed delivery setting already
exists. Choose the delivery mode in the console.
Key backup. Losing the key makes every paired sensor refuse new jobs; a leaked key lets its holder sign any job. So the key is backed up only encrypted:
- Create an age key pair on your own workstation (
age-keygen -o ctem.age); keep the identity file offline (password manager or hardware token), never on this host. - Put the public key (
age1...) inbackup_age_recipient, runplaybooks/55-backup.yml.openctem-backupthen writessigner-keys.tar.gz.ageandsigner-state.tar.gz.agewith the other files; copy them off the host together with the database backup (see the off-host backup section). The plainsigner-keys.tar.gzof an unencrypted backup stays on this host and must not be copied anywhere. - Test the restore on a scratch host at least once:
age -d -i ctem.age signer-keys.tar.gz.age | tar -tz.
Releases this kit can run are listed in versions.yml (openctem_releases,
digests per image). To upgrade:
git pull # a kit version that lists the release ansible-playbook -i $INV playbooks/50-openctem.yml -K -e apply_openctem=true -e openctem_version=vX.Y.Z
Then set openctem_version in your inventory. The play:
- verifies the new images' signatures;
- runs a backup first and stops if it fails (the backup role must be
installed;
-e openctem_backup_before_upgrade=falseonly after a backup you took yourself); - keeps the running compose file as
compose.prev.ymland the previous release's gateway files under/opt/openctem/releases/<version>; - pulls and starts the new release; migrations run before the API starts;
- verifies. On any failure it restores
compose.prev.yml, starts the previous release and verifies again.
Manual rollback, for example a problem found after the upgrade:
ansible-playbook -i $INV playbooks/71-rollback.yml -K -e apply_rollback=trueGoing back starts the previous release without its migration job: an
older migration job refuses a database a newer release already migrated, and
an older API runs on the newer schema (tested: v0.9.6 on the v0.9.7 schema).
Migrations are not reversed. If the previous release misbehaves on the
migrated database, restore the pre-upgrade backup with openctem-restore
while the previous release runs.
Read before the first apply of the kit version that lists v0.10.1. v0.10.0 was tagged but its images were never published, so the kit does not list it: go from v0.9.x straight to v0.10.1. Everything below that says v0.10.0 holds for v0.10.1 too.
FINGERPRINT_KEYis required (at least 32 characters). It keys the fingerprint of every stored secret finding. The kit manages it on the host like the encryption key (/opt/openctem/secrets/fingerprint_key, 0400, root, never printed, never in Ansible output):- on an existing install the first apply copies the stored
app_encryption_keyintofingerprint_key, because that is the key the existing fingerprints were made with. It never generates a new random one for an install that already has an encryption key: a different value gives every known secret a new identity and reopens each as a new finding; - a new install gets its own random key, independent of the encryption key;
- the play refuses to deploy while the file is missing, shorter than 32
characters or not 0400. Never set
FINGERPRINT_KEYthroughopenctem_api_env(refused); - back it up with the database:
openctem-backupincludes it, andopenctem-restore --with-secretsrestores it (a backup taken before this kit version has none: this server's stays). - Verify after the apply:
sudo stat -c '%a %U %s' /opt/openctem/secrets/fingerprint_keyprints400 root 65(or more), andsudo cmp /opt/openctem/secrets/fingerprint_key /opt/openctem/secrets/app_encryption_keyis silent on an upgraded install (identical). Do not print either file.
- on an existing install the first apply copies the stored
TENANT_CREATION_MODEis gone (the API refuses to start while it is set). The kit never renders it;openctem_signup_mode(defaultdisabled) becomesSIGNUP_MODE.openctem_api_envrefusesTENANT_CREATION_MODEand the other names v0.10.0 removed (openctem_api_env_removed). If your inventory still setsopenctem_tenant_creation_mode, remove it (the play already stops on it).- Other v0.10.0 settings, checked against the release's environment
registry (
api/internal/config/env_registry.yaml):- the other variables required in production (
DB_PASSWORD,REDIS_PASSWORD,REDIS_TLS_ENABLED,APP_ENCRYPTION_KEY,DB_SSLMODE,AUTH_COOKIE_SECURE) are already set by the kit; - the administrators' audit sink (
ADMIN_AUDIT_SINK) is configured by the kit throughopenctem_admin_audit_sink(section "Administrators' audit sink" below). A release that requires it (admin_audit_sink_requiredinversions.yml) refuses to start withMANAGED_SERVICE=trueand no sink, and the preflight stops before the host is touched. Do not setADMIN_AUDIT_SINK*throughopenctem_api_env(refused); - v0.10.1 ships the platform console as its own service (image
openctem-console, cosign-verified with the other images) and the gateway's console site, soversions.ymlflags itadmin_plane,console_db_roleandconsole_service. The kit renders theconsoleservice,ADMIN_LISTEN_ADDRandADMIN_ALLOWED_CIDRSfor it. Leaveopenctem_admin_hostempty unless you set up the console host (behind Cloudflare Access, docs/CLOUDFLARE-ACCESS.md; see docs/self-hosting-with-ansible.md); - sensors over mTLS (
api:9443, passed through by the gateway at layer 4) are off in the kit's gateway (sensors/off.wrappers); enrolling sensors needs a kit change of its own; - the kit sets
OPENCTEM_CLIENT_IP_HEADERS=Cf-Connecting-Ipon the gateway (visitor address behind the tunnel, docs/CLOUDFLARE-ACCESS.md); only v0.10.1's gateway reads it (v0.9.7's ignores it, so the API sees the tunnel's address there); - there is no
INTERNAL_API_*variable in v0.10.0; - the SMTP variables are removed (platform e-mail is set in the console, System > E-mail); the kit never rendered them.
- the other variables required in production (
- Database role for the console. The v0.10.1 least-privilege SQL has the
console identity role (
admin_user; v0.9.7's has none), soscripts/vendor-release.shflags the releaseconsole_db_role: trueand the kit rendersDB_ADMIN_USER/DB_ADMIN_PASSWORDfor it. The password (db_console_password) is already generated on every install. This path has not run on a live release before: check thatopenctem-verifypasses and the API starts after the upgrade. - Take the usual pre-upgrade backup (the play does), then:
git pull
ansible-playbook -i $INV playbooks/50-openctem.yml -K -e apply_openctem=true -e openctem_version=v0.10.1Rollback to v0.9.7 keeps working (an older API ignores FINGERPRINT_KEY);
see the rollback notes below.
Read before applying the kit version that lists v0.23.0. The kit's release entry needs no inventory change.
- The server image is renamed. From v0.23.0 the API image is
ghcr.io/openctemio/openctem-server(openctem-apikeeps its tags up to v0.22.x and gets no new ones). The entry inversions.ymlpins the new name by digest under the same keyapi, so the older entries (and a rollback to v0.22.x) keep theiropenctem-apidigests. The signature identity is unchanged (docker-publish.yml@refs/tags/<version>). Nothing to change in the inventory, with one exception: a private registry (openctem_registry_mirror) must holdopenctem-server(mirror the release with its ownmirror-images.sh) and allow-lists namingopenctem-apineed the new name too. - Database migrations (applied by the release's migration job before the
API starts): nine, listed in the pull request of the release entry. One
backfills data (
asset_ip_addresses, batches of 2000 assets, minutes on a large inventory; a range filter can miss an older asset until it ends); the rest are schema only. - The least-privilege SQL changes: the app role loses write access to the migration tracking tables in every application schema. The kit re-runs the script on apply; it needs no setting.
- PostgreSQL 17.12 (a security release) is a separate kit setting already in the kit; apply it before or with this release.
v0.21.1 fixes sign-in for people who use a Google, GitHub or Microsoft
account in an organization that requires two-factor authentication. It is for
installs that stay on v0.21.x; v0.23.0 remains the newest release. Images
only: no database migration, and the gateway files and least-privilege SQL are
the same as v0.21.0. No inventory change besides openctem_version; rollback
to v0.21.0 with playbooks/71-rollback.yml.
| Symptom | Cause and fix |
|---|---|
install: invalid user '65532' (Ubuntu 26.04) |
Ubuntu 26.04 ships the Rust uutils coreutils, whose install -o needs a passwd entry. Use chown 65532:65532 (numeric ids work) or Ansible's file/copy with numeric owners, as this kit does. |
A GNU flag of stat/date/sed -i behaves differently |
uutils replaces coreutils (not sed, grep, find or tar, which stay GNU). This kit's scripts use only flags tested on 26.04 (tests/smoke.sh runs them there). |
sudo behaves differently / Ansible become fails |
26.04 defaults to sudo-rs. Classic sudo is /usr/bin/sudo.ws: set ansible_become_exe=/usr/bin/sudo.ws in the inventory. |
| Python warnings about the interpreter | set ansible_python_interpreter=/usr/bin/python3.14 (26.04) in the inventory. |
| A port is reachable although ufw denies it | a container publishes it: Docker bypasses ufw (docs/FIREWALL.md). playbooks/85-exposure-audit.yml lists them. |
| Containers have no internet after hardening | net.ipv4.ip_forward was turned off, or iptables: false was set in daemon.json. The OS role pins forwarding on; remove iptables: false. |
A new host name (for example the console's openctem_admin_host) still answers 404 after Access although /opt/openctem/cloudflared.yml has it |
The connector read the route file when it started. A locally managed tunnel's file is bind-mounted as a single file that the play replaces, so the connector must be recreated. Kit versions with the Recreate cloudflared handler do it in the same run; with an older kit run sudo docker compose -p openctem -f /opt/openctem/compose.yml -f /opt/openctem/compose.cloudflared.yml up -d --no-deps --force-recreate cloudflared (the tunnel drops for a few seconds). A remotely managed tunnel keeps its routes in Cloudflare and is not affected. |
No inventory was parsed |
-i names a directory. Name the file: -i ~/.config/openctem-ansible/inventory/hosts.ini. |
python3 -m venv fails with ensurepip is not available |
python3-venv is missing: python3 -m venv --without-pip .venv, then pip3 install --python .venv/bin/python 'ansible-core>=2.18,<2.19'. |
Tunnel "Down" / cloudflared unhealthy |
outbound 7844/udp and 7844/tcp blocked upstream, or a wrong token: sudo docker logs openctem-cloudflared-1 (tokens are not printed), re-place the token, sudo docker compose -p openctem -f /opt/openctem/compose.yml -f /opt/openctem/compose.cloudflared.yml up -d cloudflared. |
503 for every path through the tunnel, connector logs No ingress rules were defined |
the tunnel has no route. Remotely managed tunnel: add the public hostname in the dashboard. Locally managed tunnel (the dashboard says routes come from the local configuration file): set cloudflared_management: local and re-run playbooks/50-openctem.yml (docs/CLOUDFLARE-ACCESS.md §1). |
--check stops at a read-only check |
every read-only command task runs under --check (check_mode: false); tasks that depend on packages a previous stage installs (auditd, fail2ban) report "not found" in check mode before that stage ran. Run the stages in order. |
| Firewall stage refuses: "Controller address … is not inside admin_cidrs" | the lockout guard: the address you connect from is not in admin_cidrs. Add your network (several CIDRs are fine) before enforcing. |
| 404 for every page through the tunnel | the route sends another host name, or an HTTP Host Header override: the gateway serves only openctem_app_host. |
| Sensors or CI get an HTML login page | the Access Bypass application for that path is missing or its path is wrong (docs/CLOUDFLARE-ACCESS.md §3). |
| Sensors get 429 | the WAF rate limit is too low for the number of sensors behind one address. |
Audit log shows 172.30.81.10 (or another internal address) for every request; one client's sign-in or CI throttling hits everyone |
the API sees the tunnel connector instead of the visitor: the gateway image predates the client-address fix. Deploy a release that has it and re-run playbooks/50-openctem.yml; the gateway must have OPENCTEM_CLIENT_IP_HEADERS=Cf-Connecting-Ip (sudo docker inspect openctem-gateway-1 --format '{{.Config.Env}}'). Check: docs/CLOUDFLARE-ACCESS.md, Client address. |
CI jobs get 429 from Cloudflare on /api/v1/ci/oidc/exchange |
a per-IP edge limit sized for one machine: hosted runners share egress addresses across customers. Use 600 per minute per IP (docs/CLOUDFLARE-ACCESS.md §4). |
| Uploads over 100 MB fail | Cloudflare's request body limit (Free/Pro). |
docker compose "no configuration file" |
always name the project and files: sudo docker compose -p openctem -f /opt/openctem/compose.yml -f /opt/openctem/compose.cloudflared.yml ps (or cd /opt/openctem first, where .env sets them). |
| Deploy stops at "Verify the release signatures" | the image digest is not signed by the release workflow at that tag, or sigstore is unreachable. Do not disable openctem_verify_signatures to get past it; investigate. |
| Backup "off-host copy refused" | backups are in local (unencrypted) mode: set backup_age_recipient. |
API log shows GET /api/v2/sensor/hello 401, POST /api/v1/ci/oidc/exchange 400 and GET /api/v1/me every 5 minutes with no sensor installed |
expected: the monitor (openctem-monitor, through the tunnel) and openctem-verify (inside the gateway) probe that sensors and CI reach the API and that people are challenged by Access. Their user agents are openctem-monitor and openctem-verify. A 404 on /api/v1/me with an alert "without a Cloudflare Access challenge" means the Access application is not enforcing yet. |
journalctl -t openctem-monitor shows alerts |
each line names the failing check: health, routing, disk, backup age, tunnel path, certificate, Access, client address. |
Logs: sudo docker compose -p openctem -f ... logs <service>, journalctl -u openctem-backup, journalctl -t openctem-monitor, sudo ausearch -k openctem_secrets (who read the secrets).
Trust boundaries. The internet reaches the VM only through Cloudflare:
TLS, Access (people) or a Bypass on the exact machine paths, then the WAF rate
limit. Inside, cloudflared reaches only the gateway. The gateway routes by API
plane and refuses other host names and the internal endpoints (/metrics,
/ready, /debug). Only the API reaches PostgreSQL and Redis, over TLS, with
least-privilege database roles (the API's role has DML only; migrations run as
a separate schema owner). Machine paths are authenticated by OpenCTEM itself:
sensor keys and optionally signed jobs, and CI OIDC exchanged for a short-lived
run token.
Secrets. Generated on the host; files 0400 in a 0700 root directory,
passed to containers as environment files or mounted files, never as command
arguments. The tunnel token is placed by you and only its metadata is checked.
Ansible tasks that touch secrets use no_log. auditd records every read of
the secrets directory. Backups contain the secrets: encrypt them (age).
Supply chain. OpenCTEM images by digest with keyless cosign verification against the release workflow and tag; third-party images (PostgreSQL, Redis, cloudflared, cosign) by digest; Docker packages by version with a fingerprint-checked key; collections by exact version; vendored release files by SHA-256.
Checklist (after deployment):
- Snapshot taken before each stage and deleted after acceptance
-
00-preflightclean; OS is Ubuntu 26.04 with security updates - SSH stage 2 applied:
sshd -Tshowspasswordauthentication no,permitrootlogin no - ufw active: only 22/tcp from admin CIDRs;
85-exposure-auditpasses - Nobody in the
dockergroup -
sudo openctem-verifypasses; no published port - Cloudflare: Access app with IdP + MFA; Bypass apps only on the four machine paths; WAF rate limit; WebSockets on; no origin JWT check on the route
- Outside acceptance tests pass (console and
/api/v1/mechallenged; sensor 401; CI exchange 400) - First administrator created on the console, TOTP enrolled, break-glass stored offline
- E-mail configured; sign-up policy
disabled(the defaultopenctem_signup_mode) - Automatic coverage reviewed per organization (Scoping → Settings) and the daily budget set
- Backups in age mode, off-host copy configured, restore drill passed
- Monitoring timer active, webhook tested (
sudo systemctl start openctem-monitor) - Hypervisor-level backups or snapshots of the VM per your policy
- Calendar: monthly restore drill, OpenCTEM upgrades, rotation of the tunnel token and the age key yearly
Not covered here: OS-level CIS certification (DevSec hardening is not CIS compliance), host intrusion detection, central log shipping, and a compromised hypervisor or root on the host. A Docker internal network is no boundary against root on the host.
site.yml every stage in runbook order (each gated by apply_*)
playbooks/ 00-preflight 10-os 20-ssh 30-docker 35-firewall 50-openctem 52-mail-relay
55-backup 60-monitoring 71-rollback 80-audit 85-exposure-audit
roles/ os_baseline ssh docker firewall openctem cloudflared mail_relay backup monitoring
(+ openctem_common: shared defaults, loads versions.yml)
versions.yml every pinned version and digest
requirements.yml exact collection versions
inventories/example/ example inventory; copy it outside the repository
docs/ Cloudflare, firewall, docs-site page
scripts/vendor-release.sh add an OpenCTEM release (reads server/deploy, or api/deploy in releases from before the backend directory rename; the server image is openctem-server from v0.23.0, openctem-api before, both under the key api)
tests/ render.yml, vendor-release-layout.sh, console.sh, mail-relay.sh, audit-sink.sh, custom-image.sh, signer.sh, registry-mirror.sh, cloudflared-restart.sh, smoke.sh (stack in Docker-in-Docker), role-e2e.sh (roles in DinD)
Tests never touch your workstation's containers: tests/smoke.sh and
tests/role-e2e.sh create one uniquely named Docker-in-Docker container and
run everything inside it. CI (.github/workflows/ci.yml) runs yamllint,
ansible-lint (production profile), syntax checks, shellcheck, template render
with docker compose config, a gitleaks scan, the smoke test and the roles
end to end on Ubuntu 26.04.
License: Apache-2.0. Security reports: SECURITY.md. Contributions: CONTRIBUTING.md.