CRUCI/Fix — keeping your daemons in line. A dashboard for homelab and enterprise fleets that ingests audit results (firewalld today; pacemaker, fapolicyd and SELinux planned) from Ansible over an API, stores them with history, and presents them behind role-based access control.
1. Technical Documentation
2. Introduction
2.1. What it is
CRUCI/Fix collects audit results about the daemons that keep a Linux fleet secure and shows them on one dashboard.
Supported daemons are firewalld and SELinux (rejected and dropped traffic, zone-drifting findings), fed by the
dustinlee.firewall_audit Ansible role.
2.2. How data gets in
Ingest is API-only. Ansible runs its audit and POSTs the resulting JSON to POST /api/ingest/<daemon> with a
machine token. Nothing writes to the database directly, so the database can change (SQLite today, PostgreSQL or
TimescaleDB later) without touching the collectors.
2.3. Design goals
-
Plugin architecture — each daemon is a self-contained module; adding one requires no change to core code (see Adding a Daemon).
-
Deployment-defined taxonomy — environment names and system types are configuration, never code.
-
Business or PSPF profile — one switch makes data classification mandatory for Australian Government use.
-
One control plane — the Makefile is the single entry point for developers and for GitLab CI.
2.4. Status
Working: firewalld and SELinux plugins, generic ingest, SQLite storage, JWT machine tokens, local and OIDC login (Kanidm verified up to the
interactive credential step), RBAC roles, dev Kanidm fixture, 64 unit/regression tests and 2 integration tests.
Planned work is tracked in TODO.md in the repository root.
3. Installation
3.1. Prerequisites
-
Python 3.12 or newer and uv
-
Docker (only for the dev Kanidm, documentation builds and container images)
-
GNU Make
3.2. Install
make install
3.3. Verify
make check # lint + unit/regression tests
make run # http://127.0.0.1:8100
curl localhost:8100/api/health
The default port is 8100, not 8000, because 8000 is commonly occupied on lab hosts. Override with PORT=.
|
4. Configuration
All settings are environment variables prefixed CRUCIFIX_ (a .env file is also read). The complete list is in
Environment Variables. The most important:
| Setting | Purpose |
|---|---|
|
|
|
Signs machine tokens. Unset means token auth fails closed (HTTP 503). |
|
Default true: refuse machine tokens with no |
|
|
|
Default 0: network checks keep every result of every run, forever (the table grows with each run). N > 0 deletes the results of runs older than N days each time a run is stored; the run being stored is never touched. An admin can count first with |
|
Default 0.1. Time sync plugin: a host whose clock is off by at least this many seconds (absolute) is drifting (warning). |
|
Default 1.0. At or above this offset a host with a running time daemon is unsynchronised (bad). |
|
JSON object, default |
|
Default 7. A finding due within this many days is due soon (warning). |
|
|
|
Default 180. The furthest ahead an acceptance or false positive may expire. |
|
Signs the browser session cookie. Unset gives a random per-process key. |
|
|
|
JSON list of your environment names, in display order, e.g. |
|
JSON list of your system types, e.g. |
|
Optional JSON object mapping a system type to its allowed sub-domains, e.g. |
|
JSON object of identity providers with group-to-role maps (see Authentication and RBAC). |
|
JSON list of chat alert destinations (Mattermost, Slack, Teams, Telegram, signed JSON). Each URL is a credential. See Chat Alerts (Webhooks). |
|
The address people use; sign-in redirects and the link in chat alerts are built from it. |
4.1. Environments and system types are yours to define
Nothing in the code assumes dev/test/prod or any other set. A homelab can use two environments, an enterprise five.
Both lists are exposed at GET /api/taxonomy and are applied to hosts by Consul enrichment (see Host Enrichment (Consul)).
4.2. Classifications
| Profile | Allowed values |
|---|---|
|
|
|
|
5. Architecture
Ansible audit ──POST /api/ingest/<daemon> (JWT)──▶ ┌────────────────────────────┐
│ PyNest API (FastAPI) │
Browser ──OIDC / local login──▶ Dashboard (HTMX) ─▶│ audit core + daemon │──▶ SQLite
│ plugins + auth/RBAC │ (→ PostgreSQL/Timescale)
└────────────────────────────┘
5.1. Layout
The project follows the layout produced by pynest generate application: a src/ package with one folder per resource, each
containing <name>_module.py, _controller.py, _service.py, _model.py and _entity.py.
| Path | Role |
|---|---|
|
Application root, session middleware, table creation on startup. |
|
PyNest |
|
All |
|
Daemon-agnostic core: |
|
The firewalld plugin (own table |
|
Consul enrichment: |
|
Users, roles, local login, OIDC, PyNest guards. |
|
Login page, dashboard shell, and the one generic renderer that turns any plugin’s |
|
Dev identity provider scripts. |
5.2. Data model
Run (one ingest, idempotent by content hash) → HostResult (common columns plus a JSON data field) → Finding.
Plugins may add their own tables keyed on host_result.id; firewalld stores individual rejections in
firewalld_drop_event, whose occurred_at column is the natural TimescaleDB hypertable key. Those events are a per-host
time series independent of runs: an event already stored for that host and instant is skipped, so overlapping collection
windows and retries never double-count. (Identical events within the same second collapse into one row; the run’s
total_drops keeps the true count.)
5.3. Request flow for ingest
-
The
IngestGuardverifies a bearer JWT carrying theingestscope and records the token’s subject against the run. Browser sessions can never ingest. Placing hosts has its ownInventoryGuardandinventoryscope;ingest:<daemon>limits a token to one daemon, and revoked tokens are refused. -
AuditServicelooks the daemon up in the registry (404 if unknown), validates the classification, and asks the plugin toparse()the payload (422 onValueError). -
The run is stored in one transaction; the plugin’s
persist_extras()writes its own rows, then the core merges any host facts the plugin handed over onHostIn.factsintohost_fact(chapter 17). Re-posting identical content is a no-op.
6. API Reference
Interactive OpenAPI docs are served at /docs. Authentication: Bearer JWT (scopes ingest, inventory, read) or a browser session.
| Endpoint | Method | Auth | Description |
|---|---|---|---|
|
GET |
none |
Liveness probe. |
|
GET |
read |
Application name, version, profile. |
|
GET |
read |
Configured environments and system types. |
|
GET |
read |
Registered plugins with their |
|
GET |
read |
|
|
GET |
session |
The summary page and a daemon’s detail page ( |
|
GET |
none |
Public, cacheable app assets with no audit data. Every other response is |
|
GET |
read |
Enrichment state (enabled, tag count, last success/error, unknown values) and the cached tags. |
|
POST |
admin session |
Refresh tags from Consul now. |
|
POST |
|
Send each host’s placements (environment, domain, sub-domain) from the inventory; the push is diffed against what is open and changes become history. |
|
GET |
read |
Placements from the inventory; |
|
GET |
read |
A restricted plugin ( |
6h |
24h |
7d |
30d` narrows windowed views (422 if invalid), measured back from the newest event. |
|
GET |
read |
The payload that daemon’s ingest accepts, as JSON Schema, with |
|
POST |
|
Ingest a payload. |
|
GET |
read |
Fleet totals from the latest run. |
|
GET |
read |
Per-host results from the latest run. |
|
GET |
read |
One host, 404 if absent. |
|
GET |
read |
Same three read endpoints ( |
|
GET |
read |
Network connectivity checks from the latest run ( |
|
GET |
read |
Every stored result of the latest run, not only the failing ones. Filters: |
|
GET |
analyst session, or |
Stored CVE findings (chapter 16), open ones unless |
|
GET |
analyst session, or |
Triage decisions (chapter 16): per CVE ( |
|
POST (form) |
analyst session only; machine tokens are refused (403) whatever their scopes, viewers get 404 |
Set the triage of a CVE ( |
|
GET |
analyst session, or |
A remediation plan for the open, not accepted findings of |
|
GET |
read |
Host facts (chapter 17): every host with facts the caller may see, each field the newest value among the sources (daemons) the caller may read, with |
|
GET |
read |
One host’s facts, as above. 404 when the caller may see none (an unknown host and one only a restricted plugin describes answer alike). |
|
GET |
read |
SELinux posture from the latest run (runtime/configured mode, policy, recent AVC denials, findings). |
|
GET |
none |
Enabled login methods. |
|
GET |
none |
OIDC authorization-code flow with PKCE. |
|
POST (form) |
none |
Local username/password login. |
|
POST |
session |
End the session. |
|
GET |
viewer |
Current user and effective roles. |
|
GET |
session |
Dashboard shell, login page, HTMX panel per plugin. |
|
GET |
session |
The host facts page and its HTMX panel (chapter 17): the facts filters above plus |
Every listing, summary and panel endpoint accepts ?environment= and ?system_type= filters (- selects untagged hosts). environment may be repeated or comma-separated (?environment=lab&environment=prod or ?environment=lab,prod) to select several at once; a host matches if it is in any of them. Panel and summary endpoints also accept ?tz= (an IANA zone; 422 if invalid) which sets the zone that buckets and labels are rendered in; timestamps in data fields stay UTC.
Status codes used by guards (ingest also returns 404 unknown daemon, 413 payload too large, 422 payload does not fit the schema, bad classification/source, or strict-mode inventory problems): 401 no or invalid credentials, 403 authenticated but not permitted, 503 authentication not configured (fails closed).
6.1. What an ingest accepts
Each plugin publishes the shape it accepts at GET /api/schema/{daemon}. A body that does not fit (a wrong type, a missing hostname, a group_paths that is not a list) is rejected with 422 and one line per problem, for example web1.drops.total_drops: Input should be a valid integer. Unknown extra fields are always allowed, so a role can add data without breaking ingest.
How the inventory is laid out is checked separately and never stops an ingest by default. A response carries warnings for: hosts that sent no group paths while others did; hosts outside the configured CRUCIFIX_GROUP_ROOT; and hosts that sit under several top-level groups, which usually means a group name was reused under several environments (Ansible group names are global). The warnings are also logged. Set CRUCIFIX_INGEST_STRICT=true to reject such reports with 422 instead.
7. Deployment
Both compose files and the image have been run (health check, API ingest, data kept across down/up). The nginx front end and the CI postgres job have not.
|
7.1. Two ways to run it
| Laptop / demo | Normal deployment | |
|---|---|---|
Database |
SQLite file on a volume |
PostgreSQL with TimescaleDB |
Compose file |
|
|
Secrets |
Fixed and public: loopback only, never expose it |
Required from the environment |
Listens on |
|
|
7.1.1. Normal deployment (TimescaleDB)
make stack-env # optional, interactive: URL, port, profile, time zone, environments and system types
make stack-up # builds and starts; writes .env with random secrets first if there is none
make stack-env asks for the values people usually change and writes .env (git-ignored, mode 600). It is safe to re-run: Enter keeps
the current value, existing secrets are kept unless you ask for new ones, and the old file is saved as .env.bak. Keep .env: the
database password is fixed when the data volume is first created, so a new password with an existing volume cannot log in. To start over,
remove both (docker compose down -v; rm .env, or podman compose for Podman). Without make, create .env yourself with CRUCIFIX_JWT_SECRET,
CRUCIFIX_SESSION_SECRET and CRUCIFIX_PG_PASSWORD (openssl rand -hex 32) and run docker compose up -d --build.
Port clashes
The app is published on 127.0.0.1:${CRUCIFIX_PORT:-8000} (the demo stack on 8100). Before starting, make stack-up and make stack-demo-up run
dev/port-check.sh, which stops with a message naming what holds the port (a Docker container and its project directory, or a host process) and
suggests the next free one. A container from this same project does not count as a clash, so re-running make stack-up is fine.
make stack-env runs the same check and asks again; make stack-port-check [PORT=n] runs it on its own. Without make, a clash makes
docker compose up recreate the app container and then fail to bind, leaving it in the Created state.
The database service has a health check and the app waits for it. The schema is created and upgraded by Alembic when the app starts.
7.1.2. Laptop / demo (SQLite)
make stack-demo-up # http://127.0.0.1:8100
make stack-demo-down
make stack-demo-up ends by printing a login: the user demo (admin) with a new random password on every start. The demo is its own compose project (crucifix-demo) and publishes on CRUCIFIX_DEMO_PORT (default 8100), so it runs beside the normal stack. The SQLite file lives on the crucifix-demo volume, so it survives stack-demo-down. It starts empty: make stack-demo-data-load fills it with sample data for every daemon but Pacemaker (see TODO.md for what the sample data lacks).
7.1.3. Docker or Podman
Every container command in the Makefile and the dev/ scripts goes through one variable, CONTAINER: docker if it is installed, otherwise podman. Choose explicitly with CONTAINER=podman make stack-up (the same for stack-demo-up, stack-build, stack-pg-up, stack-idm-up, stack-consul-up and site). The compose files and the Dockerfile are plain OCI, and every image name carries its registry (docker.io/…) because Podman has no default search registry.
For Podman, podman compose hands the work to a compose provider. The simplest is the docker-compose binary talking to Podman’s socket, so enable the rootless socket once: systemctl --user enable --now podman.socket. (podman-compose also works if installed; the port check recognises both tools' project labels.) Rootless Podman publishes ports from your user, so ports below 1024 need extra setup; the defaults here are all above it. On an SELinux host, a bind mount may need the z option; the compose files use only named volumes.
To create or reset a login in the stack, use make stack-user NAME=alice and make stack-passwd NAME=alice (they run inside the container, so add CONTAINER=podman for a Podman stack); make user and make passwd change only the local development database. make stack-status shows, for each runtime installed, its version, whether the Podman user socket is running, the crucifix containers and volumes, and whether the app answers its health check on the stack’s port.
Verified with Podman 6.1 (rootless, docker-compose provider): the TimescaleDB test suite, the SQLite demo stack, the TimescaleDB stack with its migrations, creating a user in the container and logging in as it, the port check and the documentation build. Not verified: podman-compose, SELinux hosts, the dev Kanidm and Consul containers under Podman, and rootful Podman.
7.1.4. The published image
The pipeline builds the image on every push to main and on tags, and pushes it to the project’s container registry as registry.gitlab.com/dlee_aus/cf/crucifix. Tags: the short commit SHA on every build, latest for the default branch, and the git tag on tagged commits. compose.yaml points at that image, so a deployment host pulls instead of building:
docker login registry.gitlab.com # a personal access token or project deploy token with read_registry
docker compose pull # fetch :latest (or set CRUCIFIX_IMAGE_TAG to a commit SHA or tag to pin)
docker compose up -d
make stack-up (which passes --build) still builds from source for local work. The image carries its build reference and tag (shown in Settings, About).
The image runs uvicorn src.app_module:http_server --proxy-headers, keeps the SQLite file on the /data volume, and
publishes only on 127.0.0.1:8000 so a reverse proxy (nginx) can front it.
7.2. Behind nginx
Terminate TLS at nginx and forward X-Forwarded-*. Set CRUCIFIX_PUBLIC_URL to the external https:// URL (OIDC redirect URIs are built from it) and leave CRUCIFIX_SESSION_HTTPS_ONLY at its default true.
7.3. PostgreSQL, TimescaleDB and migrations
Select the backend with CRUCIFIX_DATABASE_BACKEND=postgresql plus CRUCIFIX_PG_HOST, _PORT, _DB_NAME, _USER and _PASSWORD.
The password is URL-escaped for you.
The schema is managed by Alembic (migrations/), on both backends. At startup the app runs alembic upgrade head under a PostgreSQL
advisory lock, so several workers starting together do not race. A database made by an earlier release (tables, no alembic_version) is
stamped at the baseline and then upgraded, so existing SQLite data is kept. Set CRUCIFIX_MIGRATE_ON_START=false to run the upgrade
yourself with make migrate (or python -m src.cli migrate). Back up before upgrading.
Revision 0002 turns firewalld_drop_event into a TimescaleDB hypertable on occurred_at (7-day chunks) and compresses chunks older than
30 days, segmented by host. It does nothing on SQLite or on PostgreSQL without the timescaledb extension, where the table stays ordinary.
To make Timescale require the partition column in every unique key, the primary key becomes (id, occurred_at); nothing references the id.
There is no retention policy: dropping old events is the operator’s call. For example, to keep a year:
SELECT add_retention_policy('firewalld_drop_event', INTERVAL '365 days');
Changing an entity needs a migration: make migration MSG="add run.warnings", review the generated file, commit it. A test fails when the
models and the migrations disagree. make stack-pg-up starts a dev TimescaleDB and make test-pg runs the whole suite on it.
Routes and services are still synchronous (psycopg2). PyNest’s AsyncOrmProvider (asyncpg) is a later, separate step: see TODO.md.
|
7.4. Installable app and HTTPS
Browsers only allow installing a web app, and registering its service worker, over HTTPS (or on localhost). Terminate TLS at your reverse proxy. The shell has no CDN dependencies, so the app also works on an air-gapped network. See Installing it as an app (PWA) for what is and is not stored on the device.
7.5. CI/CD
.gitlab-ci.yml calls the Makefile: lint, unit (coverage and JUnit), regression, a hooks job (pre-commit and the secret scan), GitLab’s SAST and Secret Detection templates, a manual kanidm-integration job and a container-image build on the default branch. The integration job is untested on a real runner.
8. Development
The Makefile is the control plane for both local work and CI. Run make for the categorised list.
| Target | Purpose |
|---|---|
|
lint + tests (exactly what CI runs) |
|
test tiers ( |
|
rebuild the logo set and app icons; generate demo firewalld traffic |
|
dev Kanidm |
|
dev Consul seeded with demo nodes (enrichment) |
|
scaffold a plugin with |
|
operational helpers |
8.1. Test tiers
| Marker | Meaning |
|---|---|
|
Fast, no external services. The default run. |
|
One test per bug that was fixed or deliberately closed off. Add one whenever you fix something, and record it in |
|
Drives a real Chromium through Playwright (installed on demand by |
|
Needs the dev Kanidm ( |
OIDC claim-to-role mapping and the callback are unit-tested with a stubbed provider; discovery, the PKCE redirect and client/redirect-URI acceptance are integration-tested against real Kanidm. The interactive credential step is not automated.
8.2. Documentation conventions
Out-of-band notes live in the repository root: TODO.md (open work), UPDATES.md (dated progress log, newest first) and FIXED.md (resolved problems with root cause). These docs live in docs/{chapters,appendices} as AsciiDoc; build with make docs.
9. User Guide
10. Getting Started
An end-to-end walkthrough on a developer machine.
-
Start the dev identity provider and the app:
make stack-idm-up make run -
Create a break-glass local admin:
CRUCIFIX_NEW_PASSWORD='a long passphrase' make user NAME=admin -
Mint an ingest token (the dev secret is in
dev/kanidm/data/dev.env):make token SUB=ansible SCOPE=ingest -
Push a report:
CRUCIFIX_INGEST_TOKEN=<token> make ingest FILE=path/to/firewall_analysis_*.json -
Open http://localhost:8100/ and sign in locally, or with Kanidm (dev) after setting a password with
make stack-idm-credential USER=aliceand opening the printed link.
11. Adding a Daemon
A daemon is a plugin. The generic ingest route, /api/daemons and the dashboard tab appear automatically once the plugin registers itself.
-
Scaffold, using the PyNest generator (it also registers the module in
app_module.py):make new-daemon NAME=fapolicyd -
In
src/fapolicyd/fapolicyd_service.pymake the service aDaemonPlugin:@Injectable class FapolicydService(DaemonPlugin): name = "fapolicyd" # URL slug and run.daemon value label = "fapolicyd" def __init__(self, registry: DaemonRegistry): registry.register(self) def parse(self, payload) -> list[HostIn]: ... # validate; raise ValueError on bad input def persist_extras(self, session, host_result, host_in): ... # optional own tables def panel(self) -> Panel: ... # stats, charts, tables - never HTML -
Build the panel from the neutral model in
src/audit/audit_panel.py:Stat`s (a number with a tone: neutral/good/warn/bad), `Chart`s (labels and values; use the `chart()helper) andTable`s (columns plus rows of `cell(value, tone)). There is no template to write: one generic renderer insrc/ui/draws every plugin’s panel, so plugins never import Plotly or emit markup. -
If the payload carries host facts (CPU, form, OS; a vm_audit report’s
particulars), setHostIn.factsto that dict andHostIn.facts_observed_atto the report’s time (audit_facts.parse_generated); the core keeps only the fields it knows (chapter 17). Plugins built onVmAuditPluginalready do. -
Import
AuditModuleinfapolicyd_module.py, and add read endpoints in the plugin’s controller if wanted (guard them withReadGuard). -
Add tests (copy
tests/test_plugins.py) and have Ansible POST to/api/ingest/fapolicyd.
The firewalld plugin in src/firewalld/ is the reference implementation, and tests/test_plugins.py proves the core stays daemon-agnostic by registering a throwaway plugin.
11.1. Panels are data
A plugin’s panel() returns a Panel. The bundled UI renders it (Jinja plus Plotly) at /ui/panel/<daemon>, and the same
object is served as JSON at GET /api/panels/<daemon> (read scope). A different front end, such as Dash or a single-page app, or a
report generator for emailed PDF/DOCX output, can consume that JSON without any plugin changing. Values that come from ingested
payloads (hostnames, findings) are escaped by the renderer. If a plugin needs a block kind that does not exist yet (a gauge, a
timeline), add it to audit_panel.py and teach each renderer, instead of letting the plugin emit HTML.
11.2. Restricting who sees a plugin
By default every viewer and every read token sees a plugin. For sensitive data set min_role on the class:
class VulnsService(DaemonPlugin):
name = "vulns"
label = "Vulnerabilities"
min_role = "analyst" # viewer (default) | analyst | admin
The core then hides the plugin from anyone below that role and from tokens without read:vulns (chapter 10,
Restricted plugins (min_role)): panels, pages, summary tiles and /api/daemons need no plugin code. Two things are the
plugin’s job:
-
Guard the plugin’s own controller with
ReadGuardand aPluginReadGuardsubclass naming the daemon, so/api/vulns/…answers 404 like a path that is not there:class VulnsGuard(PluginReadGuard): # from src.audit.audit_access daemon = "vulns" @Get("/hosts") @UseGuards(ReadGuard, VulnsGuard) def get_hosts(self): ... -
Keep host names and finding text out of anything that leaves the dashboard. Chat alerts already drop them for a restricted plugin; a future export or report must do the same.
11.3. Views and time windows
A plugin may offer several views of its data: set views = {"overview": "Overview", "analytics": "Traffic analytics"} (first is the default) and
branch on the view argument of panel(flt, view, window). Add the keys that honour a time window to windowed_views; the dashboard then
shows a window picker (1h to 30d, counted back from the newest event, so old audit data still displays). The switcher, picker and their state (kept across
the 60 second refresh) need no plugin code. firewalld has Overview and Traffic analytics.
A view about one thing picked from another view (one check out of hundreds) goes in subject_views instead: it can be opened with
?view= and ?subject= (an opaque string only the plugin reads; raise BadSubject if it makes no sense, which answers 422) but is not offered as a tab.
Link to it from a table by giving a cell an href, which must be a path inside the app (cell(value, tone, href="/p/netcheck?view=check&subject=…")). A link to an outside page (a vendor advisory) goes in link instead, and only as an https URL: check a host-supplied value with https_url() from src/audit/audit_panel.py and leave it as text when that returns None (the Cell model refuses anything else, and the renderer adds rel="noopener noreferrer nofollow").
A plugin with subject_views takes panel(flt, view, window, subject); every other plugin keeps panel(flt, view, window), as subject is only passed to subject views. Network checks use this for the page of a single check. A view may be in both views and subject_views: it is then a tab, and the subject is optional (the vulns action list takes its filter, state=…&owner=…, that way; the tab button clears it).
Two more blocks let a panel ask a person for something without the plugin writing markup. links is a row of buttons under
the title (PanelLink(label, href, download=False, current=False)): other views, filters (current=True marks the active
one), downloads. forms are forms that POST to a route of the app (Form(id, title, action, fields, submit, note) with
FormField(name, label, kind, value, options, required, max_length, help); kinds text, textarea, select, date,
hidden). Both take in-app paths only. The form describes inputs; the target route guards itself (for a person’s change,
SessionWriteGuard then the plugin’s guard then the role guard; tokens and cross-site requests are refused) and validates
every field again. The vulns plugin uses them for triage (chapter 16).
The chart kinds a panel can use are bar, hbar (labels top to bottom, largest first), donut and heatmap (labels are columns, y_labels rows,
matrix[row][col]); wide=True asks for the full panel width. The model validates shapes, so a malformed chart fails in the plugin, not in the browser.
11.4. Reference plugins
| Plugin | What it shows |
|---|---|
|
Plugin with its own table and two views (overview, traffic analytics) ( |
|
Data-only plugin (no table; everything in |
|
Data-only plugins on |
|
Data-only plugin built on |
|
Plugin with its own table with history ( |
Both are exercised by tests/test_plugins.py (core stays daemon-agnostic), tests/test_selinux.py and tests/test_hardening.py.
Run the plugin with make ingest FILE=report.json DAEMON=selinux.
12. Authentication and RBAC
12.1. Credentials
| Who | How |
|---|---|
Machines (Ansible) |
Bearer JWT with a scope: |
People, local |
Username and Argon2-hashed password. Intended as break-glass. |
People, SSO |
OIDC authorization-code flow with PKCE against any configured provider. |
Supported identity providers: Kanidm (native OIDC; the dev target), GitLab.com (OIDC; groups need mapping by group path or allowlist, not yet implemented), and FreeIPA — which has no native OIDC, so either front it with Kanidm or Keycloak, or add an LDAP bind (not built).
12.1.1. Machine tokens: scopes and who is on record
A token is the only credential a collector needs. There is deliberately no username and password for ingestion: passwords are for people, a second secret kept in the same place adds nothing, and a token can expire and be limited.
| Scope | Allows |
|---|---|
|
|
|
The same, for one daemon ( |
|
|
|
The read APIs, for every plugin open to viewers. Not a restricted plugin (see Restricted plugins ( |
|
Together with |
Give each pipeline its own token with a meaningful --sub and a short life (make collect mints a one-day token whose subject is the playbook, e.g. ansible-vm_audit). The subject is recorded: every run
shows by <subject> in its label and carries it as submitted_by, and every placement records who opened and who closed it (opened_by, closed_by). The source field, by contrast, is a label the sender chooses, so
treat it as a hint and the subject as the fact. Every token carries exp, iat and a unique id (jti); the server refuses a token with no expiry, and (unless CRUCIFIX_REQUIRE_TOKEN_ID=false, for replacing old tokens) one with no id. Tokens are signed with the shared secret (CRUCIFIX_JWT_SECRET). Always use HTTPS in front of the server (the lab’s plain http is for a loopback or private LAN only; nginx terminating TLS is the intended setup, not yet in the compose files).
12.1.2. Revoking a token
python -m src.cli token prints the token and, on stderr, its token id. Runs record that id (run.token_id), so a suspicious run can be traced to one token. To kill it before it expires:
python -m src.cli revoke-token --jti <token id> --reason "leaked in a CI log" python -m src.cli revoke-token --sub ansible-vm_audit # everything that subject held so far; later tokens work python -m src.cli list-revoked
or, as an admin session, POST /auth/tokens/revoke ({"jti": …} or {"sub": …}) and GET /auth/tokens/revoked. The deny-list is checked on every request, so a revoked token is refused at once (401, "token revoked"). Rotating the secret still revokes everything.
12.1.3. Anomaly guard
A valid token could still post a well-formed but false report: drop the failing hosts, rename the hosts, or mark everything clean. Each run is compared with the last accepted run of the same daemon. It is suspicious when fewer than CRUCIFIX_ANOMALY_SHRINK_RATIO (default 0.5) of the previous hosts are present, or when at least CRUCIFIX_ANOMALY_CLEAN_RATIO (0.5) of two or more previously flagged hosts now report no findings. Fleets smaller than CRUCIFIX_ANOMALY_MIN_HOSTS (4) are not judged.
CRUCIFIX_ANOMALY_MODE: off; flag (default: stored and shown, with ANOMALY: <reason> in the run label and the reason in the ingest response and log); quarantine (held, not shown, the previous run stays the latest). An admin session lists held runs at GET /api/runs/quarantined and decides with POST /api/runs/{id}/approve (stored and becomes the latest) or /reject (discarded). Held runs keep no host rows until approved. A real change (a fleet decommissioned, a bulk fix) will be held once; approve it.
12.2. Roles
| Role | Grants |
|---|---|
|
Read dashboards and read APIs. |
|
Everything |
|
Everything |
|
Standalone machine role; grants no dashboard access. |
12.2.1. Restricted plugins (min_role)
A plugin may require more than the viewer role to be seen at all: min_role = "analyst" on its DaemonPlugin class
(the CVE plugin vulns does; its data is a map of what is exploitable). Allowed values are viewer (the default),
analyst and admin; any other value is refused when the plugin registers.
Who sees a restricted plugin:
-
an interactive user whose effective roles include
min_role(an admin sees everything an analyst sees); -
a machine token with
readandread:<daemon>. The plainreadscope that the desktop clients andcrucifix.mcpcarry does not reach it.
Everyone else finds no trace of it, on every read path: /api/daemons and the navigation leave it out; the summary
page, /ui/summary and /api/summary leave out its tile, its roll-up column, its hosts and the finding text in the
summary hexagons; /api/panels/{daemon}, /api/schema/{daemon}, /p/{daemon} and /ui/panel/{daemon} answer
404 with the same body as a daemon that does not exist; the plugin’s own routes (/api/vulns/…, guarded by
PluginReadGuard) answer FastAPI’s plain 404, as for a path that does not exist; the public web-app manifest never
names it. A 404 rather than a 403 so that the answer does not confirm the plugin is there.
Chat alerts (chapter 15) for a restricted plugin carry the counts, the environments and a link to the dashboard,
never host names, finding text or the plugin’s headline, whatever the destination’s detail. The dashboard’s access
control then decides who follows the link.
Ingest is unchanged: a collector posts with ingest or ingest:<daemon> and needs no read scope. Reviewing held
runs stays an admin job, and admin ranks above every min_role.
A change a person makes in the browser (triage of a vulnerability, chapter 16) is guarded by SessionWriteGuard: a
signed-in session only, never a machine token (a request carrying an Authorization header is refused, 403, whatever
its scopes), and never a cross-site request (Sec-Fetch-Site other than same-origin, or an Origin that is not this
host or CRUCIFIX_PUBLIC_URL: 403). The session cookie is also SameSite=Lax, so a cross-site POST does not carry it in
the first place. The plugin’s guard follows (a role below its min_role gets the usual 404), then the role guard.
Users are created on first OIDC login. Their roles are re-derived from the identity provider’s groups on every login; a user with no mapped group is denied. Role and disabled-state changes take effect on the next request because the session is re-checked against the database each time.
12.3. Mapping IdP groups to roles
{"kanidm": {
"label": "Kanidm", "client_id": "crucifix", "client_secret": "...",
"server_metadata_url": "https://idm.example/oauth2/openid/crucifix/.well-known/openid-configuration",
"role_map": {"crucifix_admins": ["admin"], "crucifix_viewers": ["viewer"]}
}}
Kanidm returns group SPNs such as crucifix_admins@idm.example; matching also works on the short name.
12.4. Not yet built
Scoping roles by environment, system type or classification clearance (needed for PSPF), login rate limiting, token revocation, and an admin UI. See TODO.md.
13. Host Enrichment (Consul)
Reports say what a host is called; enrichment says what it is: its environment (lab, prod, …) and system type (web, db, …). CRUCI/Fix reads both from Consul node metadata, shows them in every panel, and lets you filter the dashboard by them.
13.1. Where tags come from
Two sources fill the same tags, and the dashboard treats them alike:
-
Consul node metadata (the sections below). Consul is the authority: where it describes a node, its answer is used.
-
The inventory, for hosts Consul does not describe (a lab, test VMs). Set two variables on groups in your Ansible inventory and send them with the
inventory_tags.ymlplaybook.
lab:
vars: {crucifix_environment: lab} # the environment group
children:
lab_db:
vars: {crucifix_system_type: db} # a domain group inside it
hosts: {audit-alma9: {}}
A host can also carry an optional sub-domain that refines its domain: a database engine under db (postgresql, mysql), or an SAP system id under sap (PRD, QAS).
Set crucifix_subdomain on a group inside the domain group (a child group inherits the domain from its parent).
lab_db:
vars: {crucifix_system_type: db}
children:
lab_db_postgresql:
vars: {crucifix_subdomain: postgresql}
hosts: {db1: {}}
lab_db_mysql:
vars: {crucifix_subdomain: mysql}
hosts: {db2: {}}
A sub-domain means nothing without a domain, so one sent without crucifix_system_type is reported and ignored. The vocabulary is free-form by default, because SIDs and product
names are not a fixed set, but it must look like a name (letters, digits, ., _, -, up to 64 characters). To restrict a domain to a list, set CRUCIFIX_SUBDOMAINS, for example
{"db":["postgresql","mysql","mssql"]}; a domain with no entry stays free-form. Consul can supply it too, in the node meta key subdomain.
13.1.1. Placements: several roles, and change over time
A placement is one coherent (environment, domain, sub-domain) triple, read from one chain of groups (lab → lab_db → lab_db_postgresql is (lab, db, postgresql)). A host holds a
set of placements:
-
Several roles at once. A server in both
lab_webandlab_db_postgresqlholds(lab, web)and(lab, db, postgresql). Values are never mixed across chains: Ansible’s own merged variables would pick one domain and one sub-domain independently and could label a web hostpostgresql. Filters match a placement as a whole, soenvironment=lab&system_type=dbfinds this host only if a single placement is(lab, db). A host in two environments (labanddev) appears in both on the summary and is counted once in the fleet total, and a host with two domains appears in each domain’s box on a hex map. A variable set on the host itself overrides every chain. -
Change over time. Each placement has
valid_fromandvalid_to. Every push is compared with what is open: a placement the host no longer holds is closed (kept, never deleted), a new one is opened, the rest are untouched. So a promotion from dev to prod, a move frommysqltopostgresql, a role added or dropped, is simply the record, with dates.GET /api/enrichment/placements?node=NAME&history=truereturns it newest first (withouthistory, only what holds now). A host that flaps back keeps the whole trail. -
Leaving the inventory. A full run of
inventory_tags.yml(no--limit) sendsprune: true, which closes the placements of hosts that are no longer in the inventory. A--limitrun never removes anything. Hosts Consul describes are never touched.
The inventory_tags.yml playbook runs playbooks/files/placements.py to read the inventory’s group tree, then posts the result to POST /api/enrichment/inventory (a machine token with the inventory scope, which is not the same as ingest):
{"hosts": [{"hostname": "srv1", "ip": "192.0.2.10",
"placements": [{"environment": "lab", "system_type": "web"},
{"environment": "lab", "system_type": "db", "subdomain": "postgresql"}]}],
"prune": true}
Values are checked against the vocabulary below and reported (unknown_values), not trusted; a bad value in one placement does not block the others. The old single-placement fields
(environment, system_type, subdomain on the host) still work. Existing inventory tags were carried across as open placements when this was introduced (migration 0004). The filter bar says
tags: from the inventory when Consul is off, and GET /api/enrichment/tags shows each tag’s source.
13.2. The vocabulary is yours
Nothing in the code assumes dev/test/prod or any other set. You declare the vocabulary in configuration, in display order:
CRUCIFIX_ENVIRONMENTS='["lab","dev","prod"]'
CRUCIFIX_SYSTEM_TYPES='["web","db","dns","idm"]'
A Consul value is matched case-insensitively and stored with your spelling (PROD becomes prod). A value outside a configured list is
ignored and reported (never trusted): it appears under unknown_values in GET /api/enrichment/status. If you configure no list at all, any
value is accepted as-is and the filters are built from whatever the tags contain.
13.3. Enabling it
Enrichment is off until CRUCIFIX_CONSUL_URL is set. Tag nodes in Consul with node metadata (the key names are configurable):
consul-agent: node_meta { environment = "prod", system_type = "db" }
# or, via the catalog API:
curl -X PUT $CONSUL/v1/catalog/register -d '{"Node":"db01","Address":"10.0.0.5","NodeMeta":{"environment":"prod","system_type":"db"}}'
| Setting | Purpose |
|---|---|
|
Base URL, e.g. |
|
ACL token, sent as |
|
TLS for a private CA, or |
|
Node-meta keys to read (default |
|
Background refresh interval (default 300); |
13.4. How hosts are matched
For each host in a report, in this order: exact node name (case-insensitive); the short name (web01 matches web01.lab.example, in either
direction) if it is unambiguous; then the host’s IP address if exactly one node has it. An ambiguous match is never guessed.
13.5. Behaviour you can rely on
-
Cached in the database. Tags live in the
host_tagtable, so the dashboard keeps its columns when Consul is down or the app restarts. A failed refresh keeps the last good tags and recordslast_errorin the status; it never blanks anything. -
Stamped at ingest, current at display. Each ingest records the host’s tags on the audit record (point-in-time evidence of what the host was when it was audited). The dashboard shows the current tags, falling back to the stamped ones for hosts Consul no longer knows.
-
Never on the ingest path’s critical route. Ingest reads the local cache; it does not call Consul.
-
Refresh. A background thread (started by PyNest’s
on_application_bootstraphook) refreshes on the interval.POST /api/enrichment/refresh(admin session) refreshes now. Tags for nodes that disappear from Consul, or lose their metadata, are removed.
13.6. Using it
The dashboard has environment and system type drop-downs (plus (untagged)); the choice applies to every plugin’s panel at once. The same filters
work on the API: GET /api/firewalld/hosts?environment=prod&system_type=db, GET /api/selinux/summary?environment=-, and
GET /api/panels/{daemon}?environment=lab. Panels gain env and type columns automatically when any listed host is tagged.
13.7. Not built yet
Role scoping by environment or system type (the tags now exist to build it on), Consul service tags or KV as alternative sources, and a per-host override for hosts that are not in Consul.
14. Troubleshooting
| Symptom | Cause and fix |
|---|---|
Every API call returns 503 |
|
|
Something else owns the port. 8000 is often taken; CRUCI/Fix defaults to 8100. |
Ingest returns 422 |
|
Ingest returns 404 |
The daemon slug is wrong or its module is not imported in |
Ingest returns |
Identical payload already ingested for that daemon. Intentional. |
OIDC login: |
The IdP’s server certificate must be a leaf ( |
OIDC login returns 403 |
The user is in no group listed in |
Session cookie not sent on plain http |
|
Environment/type columns are empty |
|
A host’s tag is missing though Consul has it |
The value is outside your configured taxonomy (see |
|
Consul is unreachable. Cached tags keep being used; fix the URL, TLS or token. |
|
PyNest’s |
15. Traffic Analytics (firewalld)
The firewalld plugin’s Traffic analytics view is ported from the "Traffic Analytics & Insights" tab of dustinlee.firewall_audit’s dashboard server. It works
over the deduplicated drop events stored per host (`firewalld_drop_event), so it covers every run ever ingested for the hosts in the latest run, not just the
newest snapshot.
| Chart | Shows |
|---|---|
Drops over time |
Drops per bucket (5 minutes for a window up to 6 hours, hourly up to 14 days, daily beyond). Empty buckets are drawn, so quiet periods look quiet. |
Activity by hour of day |
Date by hour (UTC) heat map. A hot column on several days is a scheduled scan or job. |
Top targeted ports |
Destination port and protocol, largest first. |
Top sources |
Source addresses, largest first. |
Direction and protocol |
Ingress/egress by protocol. Egress drops often mean something inside is trying to leave. |
Top source subnets |
IPv4 /24 and IPv6 /64 groups, to spot a whole network behind many addresses. |
A table lists possible port scanners: sources that tried five or more distinct destination ports. It is a triage heuristic, not a verdict (a busy client of a many-port service can look similar). The stats row and every chart respect the environment and system-type filters and the time window.
15.1. Limits to know
-
Aggregation runs in Python over at most 200,000 events (the most recent ones; the subtitle says when it truncated), so it behaves the same on SQLite and PostgreSQL. Beyond that volume, move it into SQL or TimescaleDB continuous aggregates.
-
Identical events within one second are stored once, so counts of bursts of identical packets are lower than the packet count; the run’s
total_dropskeeps the true figure. -
The original tab also showed bytes dropped and reverse-DNS names for sources. Packet length and the enrichment names are not stored yet.
15.2. Demo data
make demo-data writes about 2,400 events over three days in the firewall_audit report format, using documentation-only address ranges: a nightly port scan, SSH
brute-forcing from one /24, daytime web probes, DNS noise, egress blocks and some IPv6. It is deterministic for a given seed and end time. Ingest it with
make ingest FILE=data/demo-firewalld.json.
16. Dashboard, Display Settings and the Installable App
16.1. The summary: one pane of glass by environment
The landing page groups your estate by environment. A short fleet banner (hosts, hosts with findings, environments, stale daemons) sits above one section per environment. Each section holds a tile for every daemon that has hosts in that environment, and every tile is scoped to just those hosts.
| Tile part | Meaning |
|---|---|
Status dot |
The worst of the daemon’s own status (for example scan activity, permissive SELinux) and the data’s freshness. |
Headline numbers |
Two or three figures chosen by the plugin; a plugin that does not choose gets its first three overview stats automatically. |
One-line finding |
Plain words for what stands out: "possible port scan from 203.0.113.50: 355 ports tried", "1 permissive, 3 recent AVC denials". |
Sparkline |
A trend where the plugin has one (firewalld: drops per day over the last seven days, for that environment’s hosts). |
Freshness |
"ingested 31 min ago", with the exact time in the viewer’s zone as a tooltip. Older than |
Environments come from Consul (see Host Enrichment (Consul)) in the order you configured. An environment with no hosts is not shown. With no environment tags, the page is one
section titled All systems. Clicking a tile opens that daemon’s detail page, already filtered to the environment: /p/firewalld?environment=prod.
Choose which environments to show with the chips above the page: tick lab and prod to see just those two sections at once; all clears the selection. Quick successive clicks are
batched into one reload, and the choice lives in the URL (/?environment=lab&environment=prod), so it can be bookmarked or shared. The summary also remembers your last choice in this browser
and re-applies it when you open / with no environment in the URL; detail pages and deep links never inherit it, so a link always means what it says.
Detail pages are ordinary URLs, so they can be bookmarked and shared, and the browser’s Back button works. The environment and system-type filters apply to the summary and every detail page.
16.2. Hex map
Detail pages for firewalld, SELinux, fapolicyd and Pacemaker begin with a hex map: one hexagon per host, coloured by state. Hover (or keyboard-focus) a hexagon for the host name and the reason; the legend counts hosts per state. The map is plain SVG, so it scales from a few hosts to hundreds. The hexagons carry no text: the colour is the message.
| Colour | Meaning |
|---|---|
Green |
Healthy: running, enforcing, active. |
Orange |
A warning: stopped, permissive, findings to look at. |
Red |
Failed or disabled. |
Violet |
Not installed, or expected but not found (fapolicyd, Pacemaker). Neither healthy nor failing, so it has its own colour. |
Grey |
Not applicable, or unknown. |
SELinux colours by runtime state (enforcing, permissive, disabled, not applicable). fapolicyd and Pacemaker use the table above. firewalld colours by the service state when the audit role
reports meta.service_state (running, stopped, failed, disabled), and otherwise by findings; a stopped firewall stays red on purpose. A plugin supplies a HexMap in its Panel; the same data
is in GET /api/panels/{daemon} under hexmaps.
The colour-blind and High contrast themes put a symbol inside each hexagon as well (tick, triangle, cross, hollow circle, question mark), so state never depends on colour alone; the legend, the group headers and the tables carry the same symbols there.
16.2.1. Clusters by inventory group and by domain
When hosts carry their Ansible inventory paths, the hexagons are drawn as nested clusters that follow the inventory tree, for example lab containing servers, which contains web and db. Each cluster shows its host count and how many hosts are flagged, and its dot takes the worst status inside it. A host in two branches of the inventory appears in both; hosts with no path are gathered under (ungrouped).
The dustinlee.firewall_audit role sends the paths (meta.group_paths, from ansible-inventory --list). Set CRUCIFIX_GROUP_ROOT to the group the clusters should start below (for example firewall_targets); paths that do not run through it are ungrouped. Environments are unaffected: they still come from Consul or from the inventory tags (see the host enrichment chapter).
Hosts that carry no path (anything audited only by vm_audit: SELinux, fapolicyd, Pacemaker) are clustered by their domain instead, the system_type tag, so a map reads as web, db, cluster,
security and tools rather than one block. Inside a domain, hosts that have a sub-domain (a database engine, an SAP SID) are boxed by it, so db splits into postgresql and mysql, and a
host with a domain but no sub-domain sits in the domain’s own box. A host with several placements (a server that is both web and db) appears in each box, and the totals above count it once. A host with neither a path nor a domain stays under (ungrouped). The vm_audit plugins' tables and GET /api/{daemon}/hosts show the sub-domain too.
The same data is available as JSON from GET /api/summary: environments (the sections), fleet (the banner), tiles (one per daemon across the whole estate) and
rollup (hosts with findings per environment and daemon).
16.3. Display settings
The Settings menu in the header (also on the sign-in page) lets each viewer choose how the app looks. Choices are saved in that browser only and are applied before the first paint, so there is no flash of the wrong theme.
| Setting | Choices |
|---|---|
Theme |
Auto (follows the operating system, including when it changes at dusk), Dark, Light, High contrast, and two colour-blind-safe themes (dark and light). |
Text size |
Extra small, Small, Medium (default), Large, Extra large. Charts scale with it. |
Font |
System monospace, JetBrains Mono (self-hosted, regular and bold; ligatures are off so |
Density |
Comfortable or Compact. |
Time zone |
The browser’s zone, UTC, the server default, a list of common zones, or any IANA zone typed into the "Other…" box. |
?theme=, ?size=, ?font=, ?density= and ?tz= on any page URL preview a choice for that page view without saving it.
16.3.1. Colour and accessibility
-
Every theme meets WCAG AA text contrast (the high-contrast theme meets AAA); automated tests check each palette.
-
The colour-blind themes use blue for good instead of green. Warn and bad colours were chosen by search so that all three status colours stay clearly apart under simulated protanopia, deuteranopia and tritanopia, and the tests re-check that. In those themes and in High contrast every status also carries a symbol (a tick, a triangle, a cross or, for "not installed", a hollow circle), so colour is never the only cue.
-
Plotly charts are recoloured from the active theme whenever it changes.
16.3.2. Time zones
Data is always stored and exchanged in UTC (the ts, last_ingest and similar fields in the API stay UTC). The zone only changes what is rendered: chart buckets, the
date-by-hour heat map, "first/last seen", and run times. Because the heat map and timeline are aggregated by local date and hour, the zone is applied on the server, not in the browser.
It is passed as ?tz= to /api/panels/{daemon}, /api/summary and the page partials.
-
A viewer who has not chosen a zone gets the browser’s own.
-
Set
CRUCIFIX_DEFAULT_TIMEZONE(for exampleAustralia/Sydney) as the deployment default for API consumers and the "Server default" choice. -
Across a daylight-saving change the repeated hour merges into one bucket and the skipped hour is simply absent. No events are lost.
16.4. Installing it as an app (PWA)
CRUCI/Fix is an installable web app: use the browser’s install option, or Install app in the Settings menu when the browser offers it. It needs HTTPS (or localhost) for the browser to allow it.
The manifest includes launcher shortcuts for the summary and each daemon, and maskable icons.
16.4.1. What is stored on the device, and what is not
The service worker keeps only the static app shell: the stylesheet, scripts, fonts, logos, icons, an offline page, and the plotly.js library. It deliberately never stores pages, panels, summaries, API responses or sign-in responses. This is a security-sensitive application, possibly running under a classification profile, so nothing audit-related is left on a shared or lost device and there is nothing to clear at sign-out.
-
Every response except the static assets, the manifest and the service worker carries
Cache-Control: no-store, so the browser’s HTTP cache and any proxy keep nothing either. -
Offline, a page navigation shows a branded "You are offline" page; it does not show stale data.
-
The shell has no external dependencies: htmx is vendored and plotly.js is served from the installed Python package that draws the figures (so the two always match). The app works on an air-gapped network.
-
A new release replaces the cached shell automatically (the cache name is a hash of the shell files).
Tests enforce these rules: a static review of the worker’s code paths, checks that every precached URL resolves, no-store on every sensitive route, no CDN references, and real-browser
tests (make test-browser) that load the app, go offline, and list exactly what the service worker cached.
17. Chat Alerts (Webhooks)
CRUCI/Fix can tell a chat channel when something happens to an audit run: a run is accepted, looks unlike the one before it, is held for an admin, or is approved or rejected. It posts to Mattermost, Slack, Microsoft Teams (through a Workflows webhook), Telegram, or any receiver that takes a signed JSON body (ntfy, a small script, an AWX or GitLab trigger).
Alerts never hold up ingest. The server stores the run, answers the collector, and only then queues the alert; a separate thread for each destination sends it. A slow or unreachable destination delays nothing and fails nothing except its own alert.
17.1. Events
| Event | Sent when |
|---|---|
|
A run was stored and is now the latest for its daemon (flagged or not). |
|
The anomaly guard found the run unlike the previous one ( |
|
The run was held for an admin ( |
|
An admin approved a held run. |
|
An admin rejected a held run. |
Each event is separate.
A flagged run in flag mode is both run.accepted and run.anomaly; a held run is both run.quarantined and run.anomaly.
A destination that subscribes to both gets two messages; subscribe to the ones you want.
A re-posted identical report is a no-op and sends nothing.
17.2. Configuration
Destinations are deployment configuration, nothing else: no page or API route reads, accepts or returns them.
Set CRUCIFIX_WEBHOOKS to a JSON list, one object per destination.
| Field | Default | Meaning |
|---|---|---|
|
required |
Lower-case letters, digits, |
|
required |
|
|
required |
|
|
required |
A non-empty list from the table above. |
|
|
|
|
none |
HMAC-SHA256 key (16 characters or more) for the |
|
|
Lets a |
|
|
Check the destination’s certificate. |
|
|
Per attempt; above 0, at most 60. |
|
none |
Telegram only, and required there. |
|
none |
Honoured under |
CRUCIFIX_WEBHOOK_QUEUE_SIZE (default 100) is how many undelivered alerts each destination holds.
CRUCIFIX_PUBLIC_URL (already used for sign-in redirects) is the base of the "Open in CRUCI/Fix" link; set it to the address people use.
The app checks the whole list when it starts and refuses to start if anything is wrong, with a message that names the entry and the problem and never repeats the URL, for example:
src.settings.WebhookConfigError: CRUCIFIX_WEBHOOKS[1] ('ops-hook'): a generic destination needs a secret (or allow_unsigned: true)
It refuses: a URL that is not http(s); an unknown format, event or field; a generic destination with no secret and no allow_unsigned: true; a Telegram destination without chat_id or whose URL does not end in /sendMessage; a max_classification that is not a marking of the active profile; a name used twice; invalid JSON.
17.2.1. Examples
Every URL below is fake. Copy the shape, not the address.
{"name": "ops-receiver", "format": "generic",
"url": "https://alerts.example.invalid/crucifix",
"secret": "replace-with-a-long-random-string",
"events": ["run.anomaly", "run.quarantined"]}
{"name": "slack-ops", "format": "slack",
"url": "https://slack-hook.example.invalid/FAKE/FAKE/FAKE",
"events": ["run.anomaly", "run.quarantined", "run.approved", "run.rejected"]}
{"name": "mm-ops", "format": "mattermost",
"url": "https://mattermost.example.invalid/hooks/FAKE-HOOK-ID",
"events": ["run.accepted"], "detail": "full"}
{"name": "teams-ops", "format": "teams",
"url": "https://workflows.example.invalid/FAKE/triggers/manual/paths/invoke",
"events": ["run.quarantined"]}
{"name": "tg-ops", "format": "telegram",
"url": "https://telegram-api.example.invalid/botFAKE-TOKEN/sendMessage",
"chat_id": "-1000000000000", "events": ["run.anomaly"]}
For Telegram the real URL is https://api.telegram.org/bot<token>/sendMessage: the bot token is in the path, so the URL is the bot’s password.
In .env the whole list is one line:
CRUCIFIX_WEBHOOKS=[{"name":"slack-ops","format":"slack","url":"https://slack-hook.example.invalid/FAKE/FAKE/FAKE","events":["run.anomaly"]}]
The compose file passes CRUCIFIX_WEBHOOKS through to the app.
17.2.2. Checking a destination
make webhook-test NAME=slack-ops # local app settings (.env)
make stack-webhook-test NAME=slack-ops # inside the compose stack
This sends one harmless test message through the same code path as a real alert and prints the outcome by name, for example ✔ delivered to slack-ops: HTTP 200 after 1 attempt(s) or ✘ not delivered to slack-ops: HTTP 404 after 1 attempt(s).
It never prints the URL. A test message is not written to audit_event.
17.3. How much an alert says
A chat channel is outside the dashboard’s access control, so each destination chooses how much it is told.
summary(the default)-
The daemon, the environment(s), counts (hosts, hosts with findings), the headline the daemon’s tile shows, anomaly reasons, who reviewed a held run, and a link back to the dashboard. No host names and no finding text.
full-
Adds up to ten hosts with their findings (up to three each), then "and N more". The generic body’s
datathen also carriestopandtop_more.
The headline is the daemon’s own one-line summary and can contain data from audited machines: the firewalld headline names the source address of a suspected port scan.
A restricted plugin (one with a min_role above viewer, such as vulns; see chapter 10) is told less than summary
whatever detail says: the daemon, the environment(s), the counts, anomaly reasons and the link, plus the line
"Details are restricted: open the dashboard to see them." No headline (a plugin’s headline may name a CVE), no host
names, no finding text. The generic body’s data carries "restricted": true.
Under CRUCIFIX_PROFILE=pspf every message carries the run’s classification marking in front of the title, and a run classified above the destination’s max_classification is sent as a summary whatever detail says.
A destination with no max_classification is treated as cleared for the lowest marking only (UNOFFICIAL), so it gets summaries of everything else.
17.4. Formats
Each alert is built once as a neutral message (title, tone, up to five lines, the host list for full, a link) and each format renders it.
Tone is a symbol and a word, never colour alone: ✔ ok, ▲ warning, ✖ alert, ● info.
▲ warning · CRUCI/Fix: firewalld run 412 flagged (prod) 14 hosts, 3 with findings. possible port scan from one source: 212 ports tried Anomaly: only 14 of the 22 hosts in the previous run are present. https://crucifix.example.test/p/firewalld?environment=prod
generic-
POST, JSON{id, event, at, classification, data, links, text};textis the message as plain text, for receivers that only display it. slack-
{"text": …}in Slack mrkdwn, the link as<url|Open in CRUCI/Fix>. mattermost-
{"text": …}in Markdown. teams-
{"type": "message", "attachments": [Adaptive Card 1.2]}, the shape a Workflows webhook takes. Office 365 connector webhooks were retired in May 2026 and are not supported. telegram-
sendMessagewithparse_mode: HTMLand link previews off. The text is cut at whole host lines to stay within 4096 characters.
Host names, finding text, environment names and the headline come from audited machines or inventory, so a hostile value must not be able to mention a channel, add a link or change the formatting.
Each format escapes its own control characters (&<> for Slack and Telegram), shows such values as inline code where it has it (Slack, Mattermost, Telegram), and puts an invisible zero-width space after @, inside :// and, for Teams, after the Markdown characters, so @channel, <!here>, [text](url) and bare URLs stay plain text.
17.5. Request, signature and retries
Every request is a POST with Content-Type: application/json and these headers:
X-Crucifix-Event-
the event, e.g.
run.anomaly. X-Crucifix-Delivery-
the alert’s id (also
idin the generic body); the same for every attempt and destination. X-Crucifix-Signature-
sha256=and the hex HMAC-SHA256 of the raw body with the destination’ssecret. Sent whenever asecretis set, whatever the format.
To verify, compute the HMAC over the exact bytes received, before parsing them, and compare in constant time:
import hashlib, hmac
expected = "sha256=" + hmac.new(secret.encode(), raw_body, hashlib.sha256).hexdigest()
ok = hmac.compare_digest(expected, request.headers["X-Crucifix-Signature"])
A delivery is tried up to three times, waiting 2 s and then 4 s, after a network error or a 5xx.
A 4xx (including 429) or a redirect is not retried, and redirects are not followed.
Each destination holds at most CRUCIFIX_WEBHOOK_QUEUE_SIZE undelivered alerts in memory; when that is full the oldest is dropped.
Alerts still queued when the app stops are lost; with several worker processes, each sends the alerts for the ingests it handled.
A failed delivery and a dropped alert are logged and written to audit_event (actor webhook, action webhook.failed or webhook.dropped, detail destination=<name> event=<event>).
Successful deliveries are logged only: audit_event is the security trail, and a row per alert per destination would bury it.
17.6. Keeping the URLs secret
A Slack or Mattermost hook URL lets anyone post to that channel, and a Telegram URL contains the bot’s token.
CRUCI/Fix treats every destination URL, and every secret, as a credential:
-
they come only from
CRUCIFIX_WEBHOOKS; no route accepts or returns one, so the app cannot be made to post somewhere else (no request forgery); -
logs, error messages,
audit_eventandmake webhook-testname the destination, never the URL; delivery errors are reported as a status code or an error class, never the HTTP library’s message, which can contain the URL; -
the library’s own request logging (
httpx,httpcore) is turned down to warnings, because it logs every request URL; -
the setting is held as a secret value, so it does not appear if the settings object is printed.
Keep CRUCIFIX_WEBHOOKS where you keep CRUCIFIX_JWT_SECRET, and rotate a hook (create a new one, delete the old) if it leaks.
18. Vulnerabilities (vulns)
The vulns plugin answers "which hosts carry which CVEs, and how sure are we". It is restricted: only analysts and
admins see it, and machine tokens need read and read:vulns (chapter 10, Restricted plugins (min_role)). A list of
CVEs per host is a map of what is exploitable.
CRUCI/Fix tells you what to fix; you run it. It is read-only toward hosts: it reports, flags and writes down exactly what a person should do, and it never connects to a host, holds host credentials or runs a fix. A dashboard that could push changes to every host would be the most valuable target on the network. "Fix" in the name is the loop: find, decide (triage), fix (a person, with a remediation plan from here), verify (the next complete scan resolves the finding).
The hosts work out their own findings and the server only stores and shows them. There is no CVE feed on the server and no version matching there: distribution packages carry backported fixes, so upstream version ranges give wrong answers, and a feed sync would write the database outside ingest.
18.1. Where the data comes from
The collector role crucifix.audit_vuln posts one run to POST /api/ingest/vulns with a token scoped
ingest:vulns (make collect PLAYBOOK=vulns; playbooks/vulns.yml). The payload contract is schema 2 (the
contract of 2026-11-18 plus its advisory addendum of the same day); the server publishes it at /api/schema/vulns
(schema_version 2) and still accepts schema 1 bodies, which simply carry no advisory check.
There are two sources in one payload. Both put findings in a host’s findings list; the server does not care which
check produced a finding beyond the check and source it records.
18.1.1. Targeted checks
The first source is targeted checks: a small read-only probe per CVE, for flaws that distribution advisory data
cannot see or has not caught up with. The first check is java4shell (CVE-2026-114938, a heap overflow in OpenJDK’s
x86-64 Base64 decode intrinsic, disclosed 2026-11-17). It finds Java runtimes, reads their version and vendor from
each runtime’s release file, compares them with a dated table of known fixed builds, checks the four CPU flags the
flaw needs, and looks for the workaround (-XX:-UseBASE64Intrinsics, or -XX:UseAVX= 2 or less) on running JVMs.
Each finding carries a verdict:
| Verdict | Tone | Meaning |
|---|---|---|
|
bad |
An affected, unfixed runtime that can be attacked here, running or not (starting it is enough). |
|
warn |
The check could not tell: the version was unreadable, or a running JVM’s environment could not be read (it needs root) and its command line lacks the workaround. |
|
warn |
Every running JVM of this runtime has the workaround. Still unfixed: a restart without the flag undoes it. |
|
neutral |
Affected and unfixed, but this hardware cannot be attacked (not x86-64, or a CPU flag missing). |
A runtime outside the affected lines, or with a fixed build, yields no finding. A host with no open findings is
clean (good) only when every check covered it completely (status ok, findings not cut at the cap). Otherwise it is
partly checked (warn), and the hosts table’s coverage column names each gap: an advisory check that failed (CentOS
Stream publishes no advisory data), one that does not apply (Debian, Arch, NixOS), or a partial run. A host that was
not scanned at all is not scanned (warn).
18.1.2. Distribution advisories
The check advisory asks the distribution’s own security advisories (dnf’s updateinfo on EL 8, 9, 10 and Fedora)
which CVEs affect installed packages and have a fix available. Each finding is one CVE in one source package
(kernel-core, kernel-modules and kernel-modules-core are one kernel finding; the binary packages are named in
detail), with source: "advisory", verdict vulnerable (a fix exists and is not installed), the advisory’s
severity, the installed and fixed version-release, the advisory id in advisory (ALSA-2026:87151, RHSA-…,
RLSA-…, FEDORA-…) and, when the id maps to a known public page, advisory_url. location is empty. Advisory
data cannot say "affected, no fix yet": that needs OVAL and is not built.
Severity words rank Critical, then Important (or High), Moderate (or Medium), Low, and Unknown below Low (an empty or
unrecognised severity is Unknown). Kernel advisories carry thousands of CVEs, so the role’s default minimum severity
is Important; the run records it in filters.min_severity, which must be one of those words or empty (anything else
is 422).
A host’s check can now also be not_applicable: the check does not apply to this OS (advisory on Debian, Ubuntu,
Arch, NixOS or OpenBSD; java4shell off Linux). It is shown in coverage and is never counted as a complete scan for
that check. failed is for a host where the check should work but cannot: CentOS Stream (it publishes no advisory
metadata), repositories disabled, dnf missing or failing. Each host’s advisory check carries the data_date of the
newest repository metadata it used.
18.1.3. Kernel and reboot
Each host also reports kernel: the running kernel, the newest installed one, and whether a reboot is needed, from
dnf needs-restarting -r when present (reboot_known: true), else by comparing the two kernels. This matters because
dnf stops listing a kernel CVE once the fixed kernel is installed: the finding resolves while the running kernel
is still the vulnerable one. The reboot view lists those hosts.
18.2. History and when a finding is resolved
Findings are kept in their own table, vuln_finding, one row per (host, CVE, package, runtime location), with
first_seen, last_seen, resolved_at, the runs that first and last carried it and, for a targeted check, the number
of running JVMs it counted (running; empty for rows stored before migration 0012). "Which hosts have CVE-X" is a
query: GET /api/vulns/findings?cve=CVE-2026-114938.
A row is resolved (gets resolved_at) only when a run
-
scanned that host (
scanned: true), -
ran the check that produced the row completely on it (status
ok), and -
did not truncate the host’s finding list (
max_findings_per_host), and -
covered the row’s severity: the row’s severity is at or above the run’s
filters.min_severity(an Unknown row resolves only under no filter or an Unknown filter),
and no longer reports it. A host that was absent from the run, was not scanned, or whose check was partial or
failed (or not_applicable) keeps its open rows: a partial run never makes a CVE look fixed. A run filtered at
Important does not resolve the Moderate rows an earlier run filtered at Low reported: they were left out, not fixed.
A schema 1 body has no advisory check, so it never resolves advisory rows. A row that comes back clears resolved_at
and keeps its original first_seen. Re-posting a run changes nothing; a run held by the anomaly guard changes nothing
until an admin approves it. Times are when the server stored the run (UTC).
18.3. Views
- Action list (
?view=actions) -
What needs doing, see Triage: owner, ticket, state and SLA. Second in the switcher; the overview stays the default.
- Overview
-
Hosts by their worst open verdict (stats, a bar chart and the hex map); "not scanned" counts every host the latest run could not scan, whatever its open findings. Two more stats: open advisory CVEs and hosts needing a reboot. A table of CVEs, worst severity first and then most hosts affected, with the package (
php,kernel); each CVE links to its own page. The table stops at 200 rows and its title then says "first 200 of N" (/api/vulns/findingshas them all). A table of the checks the latest run carried with the date of their data (how current the fixed-build table or the repository metadata is; foradvisorythe range of the hosts' dates) and how each went across the hosts,not_applicableincluded. The subtitle repeats the run-level data dates. Then every host with its worst verdict, OS and architecture. - CVE (
?view=cve&subject=CVE-2026-114938) -
One CVE: its hosts and runtimes or packages (package, location, installed version, vendor, fixed-in version or "no fixed build known", advisory, detail, first and last seen), and the rows resolved since. The advisory is a link only when the host sent an
https://URL; anything else (javascript:,http:, a URL with credentials or quotes) is shown as plain text. Each open row also shows its triage state, owner and due date. Below: the triage table (the decision for the whole CVE and any for single hosts), the triage forms, and links to the CVE’s remediation plan and the action list. Not in the view switcher; reached from the overview’s CVE table and the action list. A subject that is not a CVE id answers 422. - Plan (
?view=plan&subject=cve%3DCVE-…) -
A remediation plan as a page, see Remediation plans.
- Reboot
-
Hosts whose running kernel is not the newest installed one (or for which needs-restarting says a reboot is needed): running and newest kernel, whether that is known from needs-restarting or from comparing kernels, and the host’s open kernel findings. Stats say how many scanned hosts sent no kernel data.
- Coverage
-
Hosts the latest run could not scan (with the reason and how many open findings they keep), checks that did not run completely (they resolve nothing), checks that do not apply to the host’s OS, and hosts with open findings that the latest run did not include at all.
The summary tile shows open Critical and open Important findings (vulnerable, unknown or mitigated; one per host and CVE and package), hosts needing a reboot, and hosts not scanned. Its headline leads with the SLA: CVEs overdue (bad), else CVEs due soon (warning), followed by the usual headline ("1 CVE due within 7 days on 4 hosts; 3 hosts vulnerable (1 CVE)"). With the default SLA a new Critical is due in seven days, so it is "due soon" from the first run.
18.4. Triage: owner, ticket, state and SLA
A person records a decision about a whole CVE (it applies to every host with that CVE, now and later) or about one
finding (one host’s package or runtime). A finding’s own decision wins over its CVE’s. The decision has a state, an
owner (free text, at most 120 characters), a ticket (at most 200; shown as a link only when it is an https://
URL), a note (at most 2000) and, for an acceptance, an expiry. They are kept in the table vuln_triage. These are
human decisions about findings, like the review of a held run, not audit data, so rule 1 (only ingest writes audit
data) holds. Every change also writes an audit_event (vuln-triage: who, which CVE and host, each field old →
new); that is the history, and there is no separate history table.
| State | Meaning |
|---|---|
|
The default: nobody has taken it on. |
|
Someone owns the fix. |
|
The risk is accepted until the expiry date. Out of the open counts until then. |
|
Not a real exposure here, until the expiry date. Out of the open counts until then. |
- Who may do what
-
-
Only a signed-in person. Machine tokens can never write triage, whatever their scopes (403), and a cross-site request is refused (403; chapter 10). A role below the plugin’s
analystgets the plugin’s usual 404. -
An analyst sets owner, ticket and note, moves a finding to
in_progress, and back toopen(also from an acceptance). -
acceptedandfalse_positiveneedCRUCIFIX_VULNS_ACCEPT_ROLE(defaultadmin;analystallows any analyst), a reason innote, and an expiry date after today and at mostCRUCIFIX_VULNS_MAX_ACCEPT_DAYS(180) ahead. The acceptance ends at 00:00 UTC on that date. After it the findings count as open again and show acceptance expired (bad). This is worked out whenever the page is read; no job runs.
-
- SLA
-
CRUCIFIX_VULNS_SLA_DAYS(default Critical 7, Important 30, Moderate 90, Low 180 days) counts from a finding’sfirst_seen. A severity not listed has no SLA ("no SLA"). Due withinCRUCIFIX_VULNS_DUE_SOON_DAYS(7) is due soon. Only open findings that ask for action (vulnerable, unknown, mitigated; not "not exposed") and are not under an unexpired acceptance count. A resolved finding keeps its triage row for the record but shows nowhere as open; if it comes back, its decision still applies.
The action list (?view=actions) groups those findings by CVE: severity, CVE (linked to its page), package, hosts
affected, owner (linked to that owner’s list; "unassigned", or "mixed (N)" when hosts differ), ticket, state, due or
overdue by N days, the acceptance expiry, and a link to the CVE’s remediation plan. Earliest due first, so overdue CVEs
lead; then severity. Stats: open CVEs, overdue, due soon, unassigned, accepted or false positive, acceptances expiring
within 14 days, acceptances expired. Buttons filter by state (open, in progress, acceptance expired, accepted, false
positive), unassigned and the ten busiest owners; the filter is the view’s subject, a query string such as
state=in_progress&owner=ops (owner=- is unassigned; anything else answers 422). "Remediation plan for this list"
plans the CVEs shown (the first 50).
The cve view has two forms: one for the whole CVE (filled in with its current decision) and one for a single finding
(pick it from the CVE’s open findings). They post to POST /api/vulns/triage and come back to the CVE’s page.
GET /api/vulns/triage lists the decisions.
18.5. Remediation plans
GET /api/vulns/plan writes down what to run for the open, not accepted findings of a scope: cve= (repeatable),
advisory= (repeatable), or host= (repeatable, optionally with cve=), within the usual environment filters. Formats:
json (default, the plan itself), yaml (an Ansible playbook) and text (shell commands for a change ticket); the
last two download as attachments. The plan view (?view=plan&subject=…, linked from each CVE and from the action
list) shows the same plan with download buttons. Every generation through the API (each download) is an
audit_event (vuln-plan: who, scope, format); viewing the page is not (it refreshes every minute like any panel).
Same access as the rest of the plugin.
CRUCI/Fix does not run the plan. A person reviews it and runs it from their own Ansible controller, with their own
credentials and inventory, inside their change process. Every plan says so: "Review before running. Run with --check
first. CRUCI/Fix does not run this." Host names are as CRUCI/Fix has them; they must match the inventory’s (or use
--limit).
- What goes in it
-
-
Advisory findings (EL, Fedora). Hosts that need the same set of source packages updated share a step. The playbook’s play runs
ansible.builtin.dnfwith the binary package names (from the finding’sdetail),state: latestandupdate_only: true(it never installs a package that is not there, and works under--check); comments list the advisories, CVEs and fixed versions. The text form isdnf upgrade --advisory=<id>per host group, with a--assumenopreview line first. -
Kernel findings. The same update, then a reboot that runs only with
-e crucifix_allow_reboot=true,serialfromcrucifix_serial(default 1). Hosts already flagged as needing a reboot are named in the step; a host named in ahost=scope that needs a reboot and has no kernel finding gets a reboot-only step. The text form leaves the reboot as a comment. -
Java4Shell. A runtime owned by a package with a vendor fix (
fixedset) gets a package update. Otherwise the workaround is a manual step in every format, never a task, because the server does not know which services use the runtime: the host, the runtime location, its running JVM count, and the flag (-XX:-UseBASE64Intrinsics, or-XX:UseAVX=2 or lower), with "restart those JVMs" and "replace the workaround with the vendor’s fixed build when one is published". A mitigated runtime is listed as a reminder. -
Needs a person: anything the plan cannot automate, with the reason: an
unknownverdict, a check that did not run completely or does not apply (Debian’snot_applicable, CentOS Stream’s missing advisory data) on a host the scope names, a host the scope names that is not scanned or unknown, and any finding with an unsafe name.
-
18.5.1. Safety
Every value in a plan comes from an audited host. Only values that match these patterns (matched whole, so a trailing newline does not pass) reach a step:
package names ^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$
host names ^[A-Za-z0-9][A-Za-z0-9._-]{0,252}$
advisory ids ^[A-Z]+-[0-9]{4}[:-][0-9A-Za-z-]{1,40}$
CVE ids ^CVE-[0-9]{4}-[0-9]{4,}$
Anything else is left out of every step and listed under "Needs a person" as "unsafe name, check by hand".
None of the patterns allows {, } or %, so a host value can never carry Jinja ({{ }}, {% %}) into a playbook,
which Ansible would evaluate. The playbook is built by a YAML emitter (PyYAML’s SafeDumper), never by string formatting;
the text form quotes every value with shlex.quote. Free text from hosts (a runtime location, a reason) appears only
in comment lines, with every character outside printable ASCII escaped so nothing can end the line. Tests feed hostile
names ($(reboot), ; rm -rf /, a newline and - hosts: all, YAML anchors, {{ lookup(…) }}) and check that none
reaches a task or a command, and every generated playbook passes ansible-playbook --syntax-check and ansible-lint
with the production profile (both skipped where Ansible is not installed).
18.6. What leaves the dashboard
Chat alerts for this plugin carry the run’s counts, environments and a link, never host names, CVE ids or the
tile’s headline, whatever the destination’s detail (chapter 15). Everything shown comes from audited hosts and is
escaped by the generic renderer. Links in tables are in-app paths built by the plugin, except the advisory link, which
is an outside https page checked by https_url() and rendered with rel="noopener noreferrer nofollow". It still
comes from an audited host: the server checks its form, not where it points.
18.7. Not built yet
The run report ("new since the last run", "fixed since", coverage; IMPROVEMENTS.md section 6, V3 and V4); "affected,
no fix yet" (OVAL); advisory sources for Debian, Ubuntu and Arch; retention of resolved rows; chat alerts for an SLA
breach (counts only); the opt-in remediation role crucifix.vuln_remediate that would apply a plan from the operator’s
own controller (the server would still never run it). See TODO.md.
19. Host facts
Host facts answer "what is this host": its CPU model and count, memory, whether it is a VM, a container or bare
metal and on which hypervisor, its board, OS, kernel and architecture. They are part of the core, not a plugin: every
report that carries them fills the same store, and the page Host facts (/facts) and the API
(/api/hosts/facts, chapter 5) show them.
Why it matters: exposure to some flaws depends on hardware (the Java4Shell check needs AVX-512 VBMI), CPU bugs are fixed by microcode, and "which hosts are VMs on that hypervisor" or "all Zen 4 hosts" are everyday questions.
19.1. Where the facts come from
No collector change is needed. A plugin’s parse() hands a host’s facts to the core on HostIn.facts; the core
cleans them and stores them in the same transaction as the run.
-
Every
dustinlee.vm_auditreport carries aparticularssection per host. Every plugin fed by it (SELinux, fapolicyd, Pacemaker, logging, services, time sync, UFW, pf) passes it on, so one report fills the store once per plugin it is posted to. -
A
crucifix.audit_vulnrun (vulns) passes the OS name (os), the architecture, the running kernel and, when the CPU was read, the CPU flags its checks looked for (cpu_flags_checked; a subset, so it is never stored as the fullcpu_flagslist).
A later collector (crucifix.facts_audit, IMPROVEMENTS.md 6d H2) will add microcode, firmware and the full CPU flag
list.
19.2. Which fields are kept
Only known fields are kept (FIELDS in src/audit/audit_facts.py); each has a type and a size cap, because the values
come from the hosts and are not trusted.
| Fields | Type | Rule |
|---|---|---|
|
text |
One line: control and bidi-override characters become spaces, then cut to the field’s width (32 to 255 characters). |
|
text |
One of |
|
text |
|
|
number |
A number or a string of digits, inside the range. |
|
yes/no |
|
|
list |
Text items, duplicates once, cut to a number of items (16 to 512) and a width per item. |
A key not in the list is dropped; a known key whose value does not fit is rejected. Both are counted in one debug log
line per ingest (facts daemon=… unknown_dropped=… rejected=…); neither the keys' values nor the facts are ever
logged. An empty string or list means "not known" and is treated as absent.
19.3. How values are merged
The store keeps one row per host, field and source (the daemon whose ingest carried it), with the value, when it was observed and the run it came from.
-
A report that lacks a field never wipes it. Only the fields a report carries are written.
-
Newest wins, per field. A source replaces its own value only with one observed at the same time or later; an older report that arrives late changes nothing. A reader sees, per field, the newest value among the sources they may read, and each value says which source it came from and when.
-
Observed when? When the report’s
generatedstamp is ISO 8601 with a zone (2026-11-18T03:00:00Z), that time; otherwise the time it was stored. vm_audit’s stamp (20260918T120000) has no zone, so its facts count from when they arrived. A stamp more than five minutes in the future counts as now. -
Held runs write nothing. A quarantined run (
CRUCIFIX_ANOMALY_MODE=quarantine) stores its facts only when an admin approves it, then as of the approval if the report has no usable stamp; a rejected run never does. Re-posting the same report is a no-op, as for every ingest.
Nothing but ingest writes the store (rule 1); there is no edit or delete route. Facts outlive the runs that brought them: a host that stops reporting keeps its last known facts.
19.4. Who sees what
Facts are not restricted, but they never reveal a host a reader could not otherwise see: a value is visible only
through a source the reader may read (chapter 10, Restricted plugins (min_role)). A host that only vulns describes is absent
for a viewer or a token with read alone, and a field that vulns and vm_audit both report shows a viewer the vm_audit
value. Environment and system-type filters work as everywhere (current placements first, the placement stamped at
ingest as the fallback; - selects untagged hosts). RBAC by environment does not exist yet, so an environment filter
narrows the view; it is not an access control.
19.5. The page
Host facts sits after Summary in the top bar. It shows counts by form, charts by form, hypervisor, CPU model and OS, and a table of hosts. Click a form, hypervisor, CPU model or OS in the table to filter by it; the active filters appear as buttons that clear them, and they survive an environment change. Click a host for every field with its source, observation time and run. The page is rendered by the generic panel renderer, like a plugin’s, so values are escaped like every other cell.
20. Appendices
21. Environment Variables
| Variable | Default | Notes |
|---|---|---|
|
|
|
|
empty |
Inventory group the hex clusters start below, e.g. |
|
|
|
|
|
Used when none is supplied (business only) |
|
|
|
|
|
PyNest appends |
|
localhost, 5432, crucifix, crucifix, empty |
PostgreSQL backend |
|
|
JSON list, display order |
|
|
JSON list |
|
empty (off) |
Consul base URL for host enrichment |
|
unset, unset, |
ACL token and TLS options |
|
|
Node-meta keys to read |
|
300, 5 |
Background refresh interval (0 = manual) and HTTP timeout |
|
unset |
Machine tokens; unset fails closed |
|
|
|
|
random per process |
Set for multi-worker or restart-stable sessions |
|
|
|
|
Base for OIDC redirect URIs and for the dashboard link in chat alerts |
|
|
empty (off) |
JSON list of alert destinations; every URL is a credential. See the chat alerts chapter |
|
100 |
Undelivered alerts held in memory per destination; the oldest is dropped (and recorded) beyond it |
|
|
JSON; see chapter on authentication |
|
|
Largest accepted ingest body (HTTP 413 above it); 32 MiB fits a vulns run with language-package inventories (up to 20000 rows, ~5 MB, per host); post larger fleets in several runs |
|
|
IANA zone used to render times when the viewer has not chosen one (data stays UTC) |
|
36, 168 |
Data older than this is flagged stale (amber) / very stale (red) on the summary |
|
|
JSON; days from first seen until a finding is due, per severity. Unlisted severities have no SLA |
|
7 |
"Due soon" window for the vulns action list and tile |
|
(empty) |
crucifix-cve-feed base URL (e.g. |
|
30 |
Timeout of one feed request |
|
12 |
Re-match stored language inventories this often (0 = only after ingest) |
|
30 |
How often the feed’s |
|
|
|
|
180 |
Longest an acceptance or false positive may run before it expires |
|
|
loguru level |
|
|
One JSON object per line (container log shippers) |
|
127.0.0.1, 8100 |
Used by |
22. Ansible Ingest Example
Push a dustinlee.firewall_audit analysis report to CRUCI/Fix from a playbook. This is the only supported ingest path.
- name: Push firewalld audit to CRUCI/Fix
ansible.builtin.uri:
url: "{{ crucifix_url }}/api/ingest/firewalld?classification={{ crucifix_classification | default('INTERNAL') }}&source={{ crucifix_source | default('host-logs') }}"
method: POST
headers:
Authorization: "Bearer {{ crucifix_ingest_token }}"
body_format: json
body: "{{ lookup('ansible.builtin.file', analysis_json_path) | from_json }}"
status_code: [201]
validate_certs: true
delegate_to: localhost
run_once: true
no_log: true # keeps the token out of logs
Keep the token out of the repository: in Ansible Vault, or better in HashiCorp Vault fetched at run time (see Vault Credentials for Ansible). A response of {"created": false} means that exact report was already ingested.
make ingest FILE=… performs the same request from a shell.
22.1. Other daemons
The same task works for any plugin; change the daemon in the URL and point body at that role’s report. For example the
dustinlee.vm_audit JSON report feeds SELinux, fapolicyd (sections.fapolicyd) and Pacemaker (sections.workload). Post the same report to each daemon in turn; each plugin reads only its own section, and re-posting an identical report is a no-op (created: false):
url: "{{ crucifix_url }}/api/ingest/{{ item }}?source=vm-audit&classification=INTERNAL"
body: "{{ lookup('ansible.builtin.file', vm_audit_report_json) | from_json }}"
loop: [selinux, fapolicyd, pacemaker]
23. Dev Kanidm
make stack-idm-up runs dev/kanidm/up.sh, which:
-
generates a throwaway CA and a server leaf certificate (
gen-certs.sh; Kanidm requires TLS, and a self-signed certificate marked as a CA is rejected by clients); -
starts
kanidm/serveronhttps://localhost:8443with a fresh database; -
creates groups
crucifix_admins,crucifix_analysts,crucifix_viewers, usersalice,anna,vera, and an OAuth2 clientcrucifixwithopenid email profile groupsscopes; -
writes
dev/kanidm/data/dev.env(secrets, OIDC provider JSON) whichmake runloads.
Kanidm only lets users set credentials through its reset flow, so run make stack-idm-credential USER=alice and open the printed link in a browser.
Everything under dev/kanidm/data/ is gitignored. This setup is for development only.
24. OpenObserve as a Log Source
Firewall rejects can come from an OpenObserve instance instead of from each host. This is implemented entirely in the
dustinlee.firewall_audit Ansible role (branch feature/openobserve-drops-source), so CRUCI/Fix is unchanged: the role
still produces the usual analysis JSON and Ansible still POSTs it to /api/ingest/firewalld.
OpenObserve ──_search (SQL, basic auth)──▶ Ansible (control node) ──kernel_drops.log──▶ analyser ──JSON──▶ POST /api/ingest/firewalld
CRUCI/Fix never contacts OpenObserve and never holds its credentials. Credentials live in a git-ignored .env (or Ansible Vault)
on the Ansible side; see the role’s README for the variables.
24.1. Things to watch
-
Overlapping windows. Each ingest is a full snapshot of its window, but drop events are deduplicated per host and instant, so pulling "last 24h" hourly does not double-count events. Run-level totals (
total_drops) are per snapshot, not cumulative. Tag these ingests with?source=openobserve. -
Timezone. The exporter converts timestamps using the analysis host’s local zone. Run that host in UTC, or event times shift.
-
Volume. The collector caps rows per host (
firewall_audit_openobserve_max_rows, default 5000). Ingest bodies overCRUCIFIX_MAX_INGEST_BYTES(default 10 MiB) are rejected with 413, so send aggregates plus a capped event sample.
25. Dev Consul
make stack-consul-up runs dev/consul/up.sh, which starts hashicorp/consul as a throwaway dev-mode agent (single node, no ACLs, in-memory) published on
127.0.0.1:8500, seeds it, and writes dev/consul/data/dev.env, which make run loads.
The seed uses hostnames from the sample reports and exercises every matching rule:
| Consul node | Tags | What it demonstrates |
|---|---|---|
|
lab/web, lab/db, dev/web, dev/dns |
Exact name match. |
|
|
FQDN node vs the short host name |
|
prod/web |
vm_audit sample host (SELinux panel). |
|
|
An environment outside the taxonomy: ignored and reported; the valid type is kept. |
|
owner=platform only |
A node with unrelated metadata: not tagged. |
make test-integration runs tests/test_integration_consul.py against it. make stack-consul-down removes the container. UI: http://127.0.0.1:8500/ui.
26. Vault Credentials for Ansible
CRUCI/Fix never holds an Ansible user’s secrets, and Ansible should not keep long-lived credentials in inventories or CI variables either. The
sibling role dustinlee.vault_creds fetches them from HashiCorp Vault at run time. It is a separate repository, tested against a seeded dev Vault
(make vault-up there).
Vault (KV v2 + SSH CA) ◀── AppRole (read-only policy) ── Ansible control node ── POST /api/ingest/<daemon> (Bearer) ──▶ CRUCI/Fix
│
└── signed SSH certificate + become password ──▶ managed hosts
26.1. What goes where
| Credential | Where it lives |
|---|---|
CRUCI/Fix ingest token ( |
Vault KV: |
Consul ACL token, OpenObserve login |
Vault KV: |
Become (sudo) password |
Vault KV: |
SSH access for the Ansible user |
Not stored. A fresh key is generated per run and its public half is signed by Vault’s SSH CA (default 30 minute certificate). |
26.2. Using the ingest token from Vault
Store a real token once, then let the role fetch it in the ingest playbook:
make token SCOPE=ingest | vault kv put -mount=secret services/crucifix ingest_token=-
- hosts: localhost
roles:
- role: dustinlee.vault_creds
vars:
vault_creds_secrets:
crucifix_ingest_token: {path: services/crucifix, key: ingest_token}
tasks:
- ansible.builtin.uri:
url: "{{ crucifix_url }}/api/ingest/firewalld?source=host-logs"
method: POST
headers: {Authorization: "Bearer {{ vault_creds.crucifix_ingest_token }}"}
body_format: json
body: "{{ lookup('ansible.builtin.file', report_json) | from_json }}"
status_code: [201]
no_log: true
The role’s examples/push_to_crucifix.yml is a complete version. This was verified end to end against a running CRUCI/Fix: the token came
out of Vault, the report ingested (created: true), a repeat reported already ingested, and a wrong token in Vault was refused with
nothing printed.
26.3. Rotating the token
Ingest tokens are long-lived HS256 JWTs with no revocation list (see TODO.md). Until that changes, rotation means minting a new token, writing it to
Vault (KV v2 keeps the previous version), and changing CRUCIFIX_JWT_SECRET if the old one must stop working everywhere.
Because Ansible reads the token from Vault on every run, a rotation needs no playbook or inventory change.
26.4. Not built yet
CRUCI/Fix loading its own secrets (JWT/session secrets, OIDC client secrets, Consul token, database password) from Vault at start-up; short-lived,
Vault-minted ingest tokens; response-wrapped AppRole secret_id delivery; other Vault auth methods (GitLab CI JWT).