Watch nodes, shields and SBOMs with xtop#
tools/xtop/ is a terminal view of the backend. It reads the
backend’s ClickHouse over its HTTP interface, one query per view: Nodes
sends tools/xtop/sql/nodes.sql, over shirudo.node_status,
shirudo.latest and shirudo.node_vulns, and shows one row per
node, or one per image; Shields sends tools/xtop/sql/shields.sql,
over the tree tables, shirudo.node_ops and shirudo.node_vulns,
and shows one row per upatch, or, with
tools/xtop/sql/shields-available.sql over
shirudo.shield_catalog, one per shield available to append; SBOM sends tools/xtop/sql/sbom.sql,
over shirudo.node_vulns, and shows one row per finding, or, with
tools/xtop/sql/sbom-images.sql over shirudo.sbom_images, one
per image. Every query is sent with readonly=1, or without it to a user whose profile is read-only at another level and may not set it, and it changes nothing unless it is given the operator’s keys to create a tree with. It is a Bun program built on
Ink and React, and runs on an operator’s host, never on a target.
Build and run#
Install Bun 1.4.4 or later.
Build the executable, which embeds the query:
$ make -C tools/xtop
Point it at the HTTP interface, port 8123 unless the server is set up otherwise, and run it:
$ CLICKHOUSE_URL=https://clickhouse.example.com:8443/ CLICKHOUSE_USER=xtop \ CLICKHOUSE_PASSWORD=... tools/xtop/dist/xtop
bun run src/index.tsx in tools/xtop/ runs it without
building. Against the local development stack, whose ClickHouse holds
the backend once make quote-check has built the checker, the URL is
http://127.0.0.1:18124/, which make xtop from the checkout root
sets (Run a local development stack). A user that can only SELECT from the shirudo database
is enough.
Variable |
Value |
|---|---|
|
The HTTP interface, |
|
The ClickHouse user and its password, sent in the
|
A view queries when it opens, every minute after that, as often as
node_status_mv recomputes its table, and when you press r. A
query that fails leaves the rows of the last one in place and says why
at the start of the summary line.
/ searches a table; each view below says which fields. The search is
terms separated by blanks, all of which a row must meet. A term is a
regular expression, of JavaScript’s syntax and ignoring case, that one of
the fields must match; after a leading !, none may. A term that is
no regular expression is matched as text, and the search line says so.
In SBOM, !^linux leaves out the findings of the packages whose names
start with linux, and high !^linux keeps the high ones of the
rest. Enter keeps the search, Esc clears it.
Read the nodes#
STATUS and TRUST are the columns of node_status that
Node status describes, shown side by side as that page asks: a healthy
node is one whose records match its tree, an enrolled one is one whose
key the operator has recorded as a TPM’s.
Column |
Value |
|---|---|
|
|
|
|
|
|
|
The labels from |
|
The first check that failed, as its line names it, for example
|
|
|
|
|
|
From |
|
From |
|
How long ago the newest record was received. |
The summary line gives the health of the nodes shown: the percent of
them healthy, so 100% when every node is healthy and 0% when none
is. A stale node counts against it like an unhealthy one.
Enter on a node shows its host name, key, the builder that enrolled the
key, when, and the endorsement key’s name it gave, from
shirudo.enrollments (Enroll keys from a builder), or by hand for a key
enrolled without one, labels with the name each was
put under, ak_name, node_id or config_root, a line per
conflict with the values it overrode, what its record says it runs, and
the seven lines of its log, a failed one in red; Esc returns. /
searches the node, host and key names, status, trust, image, kernel,
build, the line of the failed check and each label as key=value, so
role=edge finds the nodes of that role, and label conflict finds
the nodes with one.
t switches to one row per image id and version, with the role
labels of its members beside it, ? for a member without one. A
group’s status is its worst member’s, its health the percent of its
members healthy, its kernel mixed when its members differ, its
tree the member furthest behind, its shields the sums over its members,
and its exposure that of its most exposed member. Enter on an image
shows its nodes.
Detector hits are not shown: the collector of
tools/backend/otelcol.yaml takes in no map snapshot metrics.
Read the shields#
Shields has two tabs: in trees, the upatches the trees carry, and
available, the shields published to a registry that a tree can take.
t switches between them, as does k past the header to the tabs,
h or l and Enter. The tab stays chosen while xtop runs.
In trees#
in trees has one row per upatch of every tree the tree ingest job
loaded (Load a tree’s publications), from its newest operation in
shirudo.tree_ops.
Column |
Value |
|---|---|
|
|
|
The upatch id and the first eight digits of the manifest digest of its newest operation. |
|
The worst severity of the advisories in |
|
What those advisories are in: |
|
The first image, as id and version, of a node an advisory affects
in |
|
From the history of each node following the tree in |
|
The |
Enter on a shield shows its tree, its newest operation and how many it
has, when the backend loaded that operation’s publication, the
repository, manifest digest and selector, the rollout in full, the
images, and per advisory its severity and how many affected nodes the
upatch shields. / searches the id, tree, status, severity, digest,
repository, advisories, packages and images.
The rollout counts the nodes whose newest record names the tree; a node that moved to another tree leaves it. Detector hits are not shown, because the backend takes in no metrics.
c creates a tree. Type the tree’s repository, a path under the
registry of the shields such as shirudo/fleet-base, and Enter; then
j and k move over the available shields and Space picks one, in
the order the tree is to take them. n returns to the repository, Esc
to the table. Below the shields are the commands that create it: one
bpm tree append per shield picked and the Load a tree’s publications that
loads the tree into the backend. The tree’s id is the last name of the
repository:
$ shirudo bpm tree append oci://<registry>/<namespace>/<package>:<version> --package-digest sha256:<digest> oci://<registry>/shirudo/fleet-base --tree-id fleet-base --keys-dir <keys>
$ tools/backend/jobs/tree-ingest --cert <keys>/cert.der oci://<registry>/shirudo/fleet-base
Without XTOP_KEYS_DIR xtop only shows them, with the keys directory
left to fill in, and stays a program that reads. With it, x runs
them in order, without a shell and with xtop’s environment, which is
where bpm tree append and tree-ingest take their registry’s CA
and their ClickHouse client from. Each command shows ✓ and its last
line, or ✗ and what it printed, and a failure stops the ones after
it; x again runs from the command that failed. Once all have
succeeded xtop returns to the table, which then lists the tree. xtop then signs with
the operator’s key: set the variable only on the operator’s host.
Variable |
Value |
|---|---|
|
The operator’s keys directory, with |
|
The |
|
The tree ingest job. Default |
make xtop sets all three, and the stack’s CA and ClickHouse client,
once make vm has made a bundle with operator keys.
Available#
available has one row per shield of shirudo.shield_catalog, at
the version put last, which tools/put-shields writes and
tools/backend/jobs/shields-put loads. It lists the shields
before any tree takes them, so that you can choose which to append.
Column |
Value |
|---|---|
|
The worst severity of the advisories in the shield’s |
|
The id of its |
|
The first advisory it fixes, and |
|
What those advisories are in: |
|
The most nodes one of those advisories leaves exposed in
|
|
The version of its package put last. |
|
The trees whose newest operation of the shield is an |
|
How long ago that version was put. |
The table sorts by severity, then by the nodes exposed and the id. Enter
on a shield shows its description, its package and version, the
reference and manifest digest bpm tree append takes it by, its
selector, when it was put and how many versions were, the trees that
carry it, each advisory with its severity and the nodes it exposes, and
the command that appends it, with the tree left to fill in:
shirudo bpm tree append oci://<registry>/<namespace>/<package>:<version> --package-digest sha256:<digest> oci://<registry>/<tree> --tree-id <tree-id>
/ searches the id, package, version, reference, selector,
description, advisories, severities, packages and trees. With no row in
shirudo.shield_catalog the tab says to run make shields on the
local stack (Run a local development stack), or tools/put-shields with
--catalog and then shields-put.
Read the SBOM findings#
SBOM has one row per finding, an advisory in a package, that
node_vulns has on any node: from the SBOM of a node’s image, as
Scan the SBOMs matched it, or from kernel_vulns by the node’s
kernel release (Exposure).
Column |
Value |
|---|---|
|
The advisory and its severity. |
|
|
|
The first version without it; |
|
The nodes it affects, of all the nodes in |
|
The upatch linked to the advisory, |
|
|
The summary line says when the findings come from a scan older than
sbom_stale_seconds. Enter on a finding shows its package, source and
shield, and every node it affects with its exposure, image, installed
version, the binding of its image to an SBOM and its status. /
searches the advisory, package, severity, source, shield, status, the
installed versions, and the names and images of the nodes it affects.
t switches to the images: every image of sbom_images at its
newest scan, with its state (Scan the SBOMs), stale when that scan
is older than sbom_stale_seconds, the nodes that run it, its
findings with how many are critical and high, how long ago it was
scanned and the version of the matcher’s database. An image a node runs
that has no SBOM in the store reads no_sbom: store one with
Store an image’s SBOM. So does a build a node runs whose root the store does
not have for that id and version, on a row of its own with that root:
node_vulns binds such a node root_mismatch. Enter on an image
shows its findings.