Skip to content

eBPF-based security platform

docs: give the backend its own Operate section

John Fastabend41deec06f07e
diff --git a/Documentation/contribute/testing/testing.rst b/Documentation/contribute/testing/testing.rst
index 80784bf5..5aac8cba 100644
--- a/Documentation/contribute/testing/testing.rst
+++ b/Documentation/contribute/testing/testing.rst
@@ -805,7 +805,7 @@ the host. ClickHouse is available to the collector on the test's Docker
network.
``t9107`` runs the backend of :src:`tools/backend/`
-(:doc:`/operate/integrations/backend`), so the tier needs
+(:doc:`/operate/backend/index`), so the tier needs
``tools/quote-check/shirudo-quote-check``, which
``make -C testing end2end`` builds first; ``host.sh``, run without it,
stops before it starts anything. ``host.sh`` starts a ClickHouse of the
diff --git a/Documentation/operate/integrations/backend/boot-baselines.rst b/Documentation/operate/backend/boot-baselines.rst
similarity index 100%
rename from Documentation/operate/integrations/backend/boot-baselines.rst
rename to Documentation/operate/backend/boot-baselines.rst
diff --git a/Documentation/operate/integrations/backend/exposure.rst b/Documentation/operate/backend/exposure.rst
similarity index 100%
rename from Documentation/operate/integrations/backend/exposure.rst
rename to Documentation/operate/backend/exposure.rst
diff --git a/Documentation/operate/backend/index.rst b/Documentation/operate/backend/index.rst
new file mode 100644
index 00000000..7edb6dbc
--- /dev/null
+++ b/Documentation/operate/backend/index.rst
@@ -0,0 +1,99 @@
+..
+ SPDX-License-Identifier: BSD-2-Clause
+ Copyright (c) 2026 Authors of shirudo
+
+:page-type: Explanation
+:audience: Operators, SecOps
+
+Backend
+=======
+
+The pages of :doc:`/operate/integrations/index` provides export targets
+shirudo can use and alert on. This describes a reference backend: it checks
+every keepalive's TPM quote and compares what each target reports with the
+upatch tree it follows. It lives in :src:`tools/backend/`: an OpenTelemetry Collector
+configuration, a ClickHouse schema, the jobs that load trees and SBOMs,
+and their tests. It also provides the end-to-end tester of shirudo itself,
+at the scale of many nodes and many upatches. This allows us to validate the
+event structure and workflows at scale with a viable backend.
+
+A Shirudo target only sends its keepalive to the collector it is configured
+with, and nothing on the target depends on the backend. However, it does
+enable testing many nodes and validate resource requirements. Start from it
+and adapt retention, access control, sizing and features for your deployment.
+
+What it does
+------------
+
+- An OpenTelemetry Collector configuration that writes every keepalive
+ to ClickHouse, where a materialized view checks its quote with
+ ``shirudo-quote-check``, installed as the ClickHouse function
+ ``tpm_quote_check``, and keeps the record or the reason it was
+ refused. A node is known by the name of its attestation key, never by
+ the host name it claims, and its records are ordered by the quote's
+ clock.
+- A tree ingest job that loads every publication of an upatch tree
+ through ``shirudo bpm tree show``, which verifies it as a target does,
+ and the ``fixes`` its operations carry.
+- A table, ``node_status``, refreshed every minute, that says for every
+ node whether it is healthy, unhealthy or stale, with one line per
+ check: the record is fresh, the target reports no problem, its mask
+ and roots match the tree, it is at the head of the tree or still
+ within the time a rollout may take, the upatches it has loaded are
+ from the published tree, and its outcomes match the nodes expected
+ results.
+- A table, ``node_vulns``, refreshed every five minutes, that says
+ which advisories affect each node's image and kernel and whether a
+ published upatch shields it. Which can be used to match vulnerabilities
+ to nodes using a standard SBOM.
+
+``shirudo-quote-check`` and ``shirudo bpm tree show`` come with the
+operator package, :doc:`/reference/cli/quote-check` and
+:doc:`/reference/cli/bpm` describe them. A pass of the quote check says
+that the body is what one key signed, not that the key lives in a
+genuine TPM, so every node reads ``untrusted`` until you enroll its key
+(:doc:`maintain`) and insert ``enrolled`` for its ``ak_name``
+into ``shirudo.nodes``. Neither says that the body is true: root on a
+target can have its TPM quote a body of its own, so
+``healthy`` is the target's own account until ``shirudo attest verify``
+confirms it (R17 of :doc:`/security/threat-model`).
+
+Files
+-----
+
+.. list-table::
+ :header-rows: 1
+
+ * - Path
+ - Purpose
+ * - :src:`tools/backend/otelcol.yaml`
+ - Collector configuration: OTLP over HTTPS in, ``otel.otel_logs``
+ out.
+ * - :src:`tools/backend/clickhouse/tpm_quote_check_function.xml`
+ - Declares the ``tpm_quote_check`` function over the
+ ``shirudo-quote-check`` program.
+ * - :src:`tools/backend/sql/`
+ - The schema, loaded in the order of the file names, and
+ ``apply-retention.sh``, which sets how long ``shirudo.keepalive``
+ keeps a record and ``shirudo.boot_first`` a boot.
+ * - :src:`tools/backend/jobs/tree-ingest`
+ - Loads every segment of an upatch tree into the reference tables.
+ * - :src:`tools/backend/jobs/sbom-scan`
+ - Scans the SBOM of every image in the SBOM store and loads the
+ outcome into ``sbom_images`` and ``sbom_vulns``.
+ * - :src:`tools/backend/test/`
+ - The SQL tests and their runner, ``test/run.sh``
+ (:ref:`testing-backend`).
+
+.. toctree::
+ :titlesonly:
+
+ overview
+ set-up
+ status
+ exposure
+ tree-ingest
+ sbom-scan
+ maintain
+ boot-baselines
+ tables/index
diff --git a/Documentation/operate/integrations/backend/maintain.rst b/Documentation/operate/backend/maintain.rst
similarity index 100%
rename from Documentation/operate/integrations/backend/maintain.rst
rename to Documentation/operate/backend/maintain.rst
diff --git a/Documentation/operate/integrations/backend/tables/overview.rst b/Documentation/operate/backend/overview.rst
similarity index 76%
rename from Documentation/operate/integrations/backend/tables/overview.rst
rename to Documentation/operate/backend/overview.rst
index 257498d6..6dfc0ed2 100644
--- a/Documentation/operate/integrations/backend/tables/overview.rst
+++ b/Documentation/operate/backend/overview.rst
@@ -8,14 +8,28 @@
Overview
========
-How the tables connect and what they cost. The arrows and the colours
-of the diagram are checked against :src:`tools/backend/sql/` and the table pages when
-the documentation is built.
+How the tables connect and what they cost.
+
+What a keepalive is
+-------------------
+
+Once a minute ``shirudo status --otel`` sends one OTLP log record with
+the event name ``shirudo.keepalive``. Its body is a compact JSON object,
+sent as a string, and its only attribute, ``shirudo.quote``, is a TPM
+quote over the SHA-256 of that string:
+
+.. code-block:: none
+
+ attest=<base64 TPMS_ATTEST>;sig=<base64 TPMT_SIGNATURE>;ak=<base64 TPMT_PUBLIC>
+
+A node is known by the name of its attestation key, ``ak_name``, never
+by the host name it claims, and its records are ordered by the quote's
+``reset_count`` and ``clock``, never by a wall clock.
How a keepalive moves through the schema
----------------------------------------
-A keepalive enters at :table:`otel.otel_logs`, is checked once on its way
+A keepalive sent from Shirudo enters the backend at :table:`otel.otel_logs`, is checked once on its way
into :table:`checked`, and from there fans out on insert to
:table:`keepalive`, :table:`rejected`, :table:`nodes`,
:table:`keepalive_latest` and :table:`boot_first`. Refreshed views then
diff --git a/Documentation/operate/integrations/backend/sbom-scan.rst b/Documentation/operate/backend/sbom-scan.rst
similarity index 100%
rename from Documentation/operate/integrations/backend/sbom-scan.rst
rename to Documentation/operate/backend/sbom-scan.rst
diff --git a/Documentation/operate/integrations/backend/set-up.rst b/Documentation/operate/backend/set-up.rst
similarity index 98%
rename from Documentation/operate/integrations/backend/set-up.rst
rename to Documentation/operate/backend/set-up.rst
index 83ff3007..0a4c6242 100644
--- a/Documentation/operate/integrations/backend/set-up.rst
+++ b/Documentation/operate/backend/set-up.rst
@@ -5,8 +5,8 @@
:page-type: How-to
:audience: Operators
-Set up the backend
-==================
+Set up
+======
You need a ClickHouse server, the OpenTelemetry Collector Contrib
distribution (``otelcol-contrib``) and ``shirudo-quote-check`` from
diff --git a/Documentation/operate/integrations/backend/status.rst b/Documentation/operate/backend/status.rst
similarity index 100%
rename from Documentation/operate/integrations/backend/status.rst
rename to Documentation/operate/backend/status.rst
diff --git a/Documentation/operate/integrations/backend/tables/index.rst b/Documentation/operate/backend/tables/index.rst
similarity index 81%
rename from Documentation/operate/integrations/backend/tables/index.rst
rename to Documentation/operate/backend/tables/index.rst
index 527e4961..14657f61 100644
--- a/Documentation/operate/integrations/backend/tables/index.rst
+++ b/Documentation/operate/backend/tables/index.rst
@@ -11,13 +11,9 @@ are read from the schema when the documentation is built; the pages add
only what the schema cannot say. A table the schema has and these pages
do not document, or a column either side lacks, fails the build.
-:doc:`overview` draws how a keepalive moves through the tables and
-sums what they cost at a reference fleet.
-
.. toctree::
:maxdepth: 1
- overview
ingest
reference
latest
diff --git a/Documentation/operate/integrations/backend/tables/ingest.rst b/Documentation/operate/backend/tables/ingest.rst
similarity index 100%
rename from Documentation/operate/integrations/backend/tables/ingest.rst
rename to Documentation/operate/backend/tables/ingest.rst
diff --git a/Documentation/operate/integrations/backend/tables/latest.rst b/Documentation/operate/backend/tables/latest.rst
similarity index 100%
rename from Documentation/operate/integrations/backend/tables/latest.rst
rename to Documentation/operate/backend/tables/latest.rst
diff --git a/Documentation/operate/integrations/backend/tables/reference.rst b/Documentation/operate/backend/tables/reference.rst
similarity index 100%
rename from Documentation/operate/integrations/backend/tables/reference.rst
rename to Documentation/operate/backend/tables/reference.rst
diff --git a/Documentation/operate/integrations/backend/tables/status.rst b/Documentation/operate/backend/tables/status.rst
similarity index 100%
rename from Documentation/operate/integrations/backend/tables/status.rst
rename to Documentation/operate/backend/tables/status.rst
diff --git a/Documentation/operate/integrations/backend/tables/vulns.rst b/Documentation/operate/backend/tables/vulns.rst
similarity index 100%
rename from Documentation/operate/integrations/backend/tables/vulns.rst
rename to Documentation/operate/backend/tables/vulns.rst
diff --git a/Documentation/operate/integrations/backend/tree-ingest.rst b/Documentation/operate/backend/tree-ingest.rst
similarity index 100%
rename from Documentation/operate/integrations/backend/tree-ingest.rst
rename to Documentation/operate/backend/tree-ingest.rst
diff --git a/Documentation/operate/index.rst b/Documentation/operate/index.rst
index 34933cf8..93c86fa0 100644
--- a/Documentation/operate/index.rst
+++ b/Documentation/operate/index.rst
@@ -26,6 +26,8 @@ refusal or verdict is an incident: follow
attest targets
- :doc:`integrations/index`: send telemetry to ClickHouse,
Elasticsearch, Grafana and Splunk
+- :doc:`backend/index`: check every keepalive's quote and each target's
+ state against its upatch tree
- :doc:`maintain/index`: signing keys, upgrades, backup, recovery and
decommissioning
- :doc:`troubleshoot/index`: failures by symptom, tampered targets and bug
@@ -38,5 +40,6 @@ refusal or verdict is an incident: follow
deploy/index
run/index
integrations/index
+ backend/index
maintain/index
troubleshoot/index
diff --git a/Documentation/operate/integrations/backend.rst b/Documentation/operate/integrations/backend.rst
deleted file mode 100644
index 18b6445d..00000000
--- a/Documentation/operate/integrations/backend.rst
+++ /dev/null
@@ -1,160 +0,0 @@
-..
- SPDX-License-Identifier: BSD-2-Clause
- Copyright (c) 2026 Authors of shirudo
-
-:page-type: Explanation
-:audience: Operators, SecOps
-
-Backend
-=======
-
-The other pages of this section store what targets send and alert on
-it. The backend goes further: it checks every keepalive's TPM quote and
-compares what each target reports with the upatch tree it follows. It
-lives in :src:`tools/backend/`: an OpenTelemetry Collector
-configuration, a ClickHouse schema, the jobs that load trees and SBOMs,
-and their tests. It also serves as the end-to-end tester of shirudo
-itself, at the scale of many nodes and many upatches.
-
-This is a do-it-yourself example, not an integration shirudo
-maintains. shirudo holds no fleet state: a target only sends its
-keepalive to the collector it is configured with, and nothing on the
-target depends on the backend. Start from it and adapt retention,
-access control and sizing to your deployment.
-
-What it does
-------------
-
-- An OpenTelemetry Collector configuration that writes every keepalive
- to ClickHouse, where a materialized view checks its quote with
- ``shirudo-quote-check``, installed as the ClickHouse function
- ``tpm_quote_check``, and keeps the record or the reason it was
- refused. A node is known by the name of its attestation key, never by
- the host name it claims, and its records are ordered by the quote's
- clock.
-- A tree ingest job that loads every publication of an upatch tree
- through ``shirudo bpm tree show``, which verifies it as a target does,
- and the ``fixes`` its operations carry.
-- A table, ``node_status``, refreshed every minute, that says for every
- node whether it is healthy, unhealthy or stale, with one line per
- check: the record is fresh, the target reports no problem, its mask
- and roots match the tree, it is at the head of the tree or still
- within the time a rollout may take, the upatches it has loaded are
- those the tree leaves, and its outcomes are the most common among
- nodes in the same place in the tree.
-- A table, ``node_vulns``, refreshed every five minutes, that says
- which advisories affect each node's image and kernel and whether a
- published upatch shields it.
-
-``shirudo-quote-check`` and ``shirudo bpm tree show`` come with the
-operator package, :doc:`/reference/cli/quote-check` and
-:doc:`/reference/cli/bpm` describe them. A pass of the quote check says
-that the body is what one key signed, not that the key lives in a
-genuine TPM, so every node reads ``untrusted`` until you enroll its key
-(:doc:`backend/maintain`) and insert ``enrolled`` for its ``ak_name``
-into ``shirudo.nodes``. Neither says that the body is true: root on a
-target can have its TPM quote a body of its own, so
-``healthy`` is the target's own account until ``shirudo attest verify``
-confirms it (R17 of :doc:`/security/threat-model`).
-
-A silent node
--------------
-
-A node turns stale when its newest keepalive is older than the
-backend's ``stale_seconds``, 10 minutes by default. A keepalive cannot
-run while a ``bpm tree sync`` holds the config operation lock, so a sync
-of several minutes leaves a gap of that length, as
-:doc:`/operate/run/telemetry` explains; the alerts for a silent target on
-the other pages of this section use the same 10 minutes. Tune the value
-to the longest sync your fleet runs.
-
-The end-to-end test ``t9107`` runs the backend against the example
-keepalives of :src:`testing/fixtures/keepalive/` and their recorded
-quotes, through its collector, its quote check and its tree ingest job.
-
-What a keepalive is
--------------------
-
-Once a minute ``shirudo status --otel`` sends one OTLP log record with
-the event name ``shirudo.keepalive``. Its body is a compact JSON object,
-sent as a string, and its only attribute, ``shirudo.quote``, is a TPM
-quote over the SHA-256 of that string:
-
-.. code-block:: none
-
- attest=<base64 TPMS_ATTEST>;sig=<base64 TPMT_SIGNATURE>;ak=<base64 TPMT_PUBLIC>
-
-A node is known by the name of its attestation key, ``ak_name``, never
-by the host name it claims, and its records are ordered by the quote's
-``reset_count`` and ``clock``, never by a wall clock.
-
-How a record flows
-------------------
-
-The collector writes every record into a table that stores nothing,
-and a materialized view checks its quote on the way in:
-
-.. code-block:: none
-
- target --OTLP/HTTPS--> otelcol-contrib --> otel.otel_logs (Null)
- | checked_mv, one tpm_quote_check call per record
- v
- shirudo.checked (Null)
- accepted | refused
- +------------+---------------+-------------+ |
- v v v v v
- keepalive nodes keepalive_latest boot_first rejected
-
-Neither ``otel.otel_logs`` nor ``shirudo.checked`` stores anything. A
-record is stored once it is checked, in ``shirudo.keepalive``, or with
-the reason it was refused, in ``shirudo.rejected``. Log records of any
-other event name are dropped.
-
-Once a minute ``shirudo.node_ops_mv`` adds to ``shirudo.node_ops`` what
-each node's newest record says it did at operations the backend had not
-seen it reach, ``shirudo.history_contradictions_mv`` marks each node
-whose newest record contradicts that history, and
-``shirudo.node_status_mv`` runs the checks over ``keepalive_latest``,
-``boot_first`` and that history for every node and replaces the rows of
-``shirudo.node_status``, which is what a UI reads
-(:doc:`backend/status`). Every five minutes ``shirudo.node_vulns_mv``
-does the same for ``shirudo.node_vulns`` (:doc:`backend/exposure`).
-
-Files
------
-
-.. list-table::
- :header-rows: 1
-
- * - Path
- - Purpose
- * - :src:`tools/backend/otelcol.yaml`
- - Collector configuration: OTLP over HTTPS in, ``otel.otel_logs``
- out.
- * - :src:`tools/backend/clickhouse/tpm_quote_check_function.xml`
- - Declares the ``tpm_quote_check`` function over the
- ``shirudo-quote-check`` program.
- * - :src:`tools/backend/sql/`
- - The schema, loaded in the order of the file names, and
- ``apply-retention.sh``, which sets how long ``shirudo.keepalive``
- keeps a record and ``shirudo.boot_first`` a boot.
- * - :src:`tools/backend/jobs/tree-ingest`
- - Loads every segment of an upatch tree into the reference tables.
- * - :src:`tools/backend/jobs/sbom-scan`
- - Scans the SBOM of every image in the SBOM store and loads the
- outcome into ``sbom_images`` and ``sbom_vulns``.
- * - :src:`tools/backend/test/`
- - The SQL tests and their runner, ``test/run.sh``
- (:ref:`testing-backend`).
-
-.. toctree::
- :titlesonly:
-
- backend/set-up
- backend/status
- backend/exposure
- backend/tree-ingest
- backend/sbom-scan
- backend/maintain
- backend/boot-baselines
- backend/tables/index
diff --git a/Documentation/operate/integrations/clickhouse.rst b/Documentation/operate/integrations/clickhouse.rst
index c164f625..73efde89 100644
--- a/Documentation/operate/integrations/clickhouse.rst
+++ b/Documentation/operate/integrations/clickhouse.rst
@@ -17,7 +17,7 @@ This is a do-it-yourself example to get started from, not an
integration that shirudo ships or maintains. Adapt retention, access
control and sizing to your deployment. To check the keepalives' quotes
and compare each target with its upatch tree as well, start from the
-:doc:`backend` instead.
+:doc:`/operate/backend/index` instead.
Before you begin
----------------
@@ -204,7 +204,7 @@ Next steps
- :doc:`/upatches/write/decoders` to turn a map into log records or
metrics
- :doc:`grafana` to chart the same data
-- :doc:`backend` to check the quotes and the tree state the
+- :doc:`/operate/backend/index` to check the quotes and the tree state the
keepalives report
- :doc:`/concepts/background/siem-export` for how the records reach a
backend and what to build on them
diff --git a/Documentation/operate/integrations/index.rst b/Documentation/operate/integrations/index.rst
index 66c4332f..41f5cfbe 100644
--- a/Documentation/operate/integrations/index.rst
+++ b/Documentation/operate/integrations/index.rst
@@ -13,9 +13,9 @@ target that goes silent, reports a verdict other than ``ok`` or counts
tamper attempts. Adapt them to your deployment.
Splunk and Elastic Security are SIEMs, ClickHouse keeps records for
-analysis in SQL, and Grafana charts them from Loki and Prometheus. The
-backend builds on ClickHouse to check every keepalive's quote and each
-target's state against its upatch tree.
+analysis in SQL, and Grafana charts them from Loki and Prometheus.
+:doc:`/operate/backend/index` builds on ClickHouse to check every
+keepalive's quote and each target's state against its upatch tree.
Targets speak OTLP over HTTP with JSON bodies and TLS 1.3 with a hybrid
post-quantum key exchange, and nothing else. Each page puts an
@@ -31,7 +31,6 @@ post-quantum support.
elasticsearch
grafana
splunk
- backend
:doc:`/concepts/background/siem-export` explains how the records reach a
backend and what to build on them.
diff --git a/Documentation/operate/run/attest.rst b/Documentation/operate/run/attest.rst
index dde41564..ac9202a9 100644
--- a/Documentation/operate/run/attest.rst
+++ b/Documentation/operate/run/attest.rst
@@ -194,7 +194,7 @@ nonce, and a challenge in between.
8. If you run the keepalive backend, mark the key as enrolled, so that
the node reads ``enrolled`` rather than ``untrusted``
- (:doc:`/operate/integrations/backend`):
+ (:doc:`/operate/backend/index`):
.. code-block:: console
diff --git a/tools/backend/Makefile b/tools/backend/Makefile
index b582b423..4ddecbb0 100644
--- a/tools/backend/Makefile
+++ b/tools/backend/Makefile
@@ -2,7 +2,7 @@
# Copyright (c) 2026 Authors of shirudo
#
# The backend has nothing to build; this runs its SQL tests. Its
-# documentation is Documentation/operate/integrations/backend.
+# documentation is Documentation/operate/backend/.
.DEFAULT_GOAL := help