Ingest#
The collector writes into otel.otel_logs. checked_mv verifies each record’s TPM quote once, and the result is routed either to the audit store or to the reject log. Neither otel_logs nor checked keeps a row.
Schema: tools/backend/sql/10-ingest.sql
Views, functions and jobs#
shirudo.checked_mvmaterialized view, on insert.
Splits the quote with a regex, calls tpm_quote_check(attest, sig, ak, sha256(body)) once per record and writes the parsed JSON answer to checked.
shirudo.keepalive_mvmaterialized view, on insert.
checked → keepalive for accepted rows.
shirudo.rejected_mvmaterialized view, on insert.
checked → rejected for refused rows, with reject as reason.
tpm_quote_check()executable_pool UDF, clickhouse/tpm_quote_check_function.xml.
Runs shirudo-quote-check (pool of 4). Returns one JSON line: ok, reason, ak_name, ak_public, reset_count, clock.
otel.otel_logs#
Landing table for the OpenTelemetry Collector’s ClickHouse exporter. It holds nothing; it exists so the exporter has a target and checked_mv has a source.
The columns match what the exporter inserts. Only Timestamp, ResourceAttributes[‘host.name’], LogAttributes[‘shirudo.quote’], Body and EventName are used.
Log records with any other event name are dropped.
- Engine:
Null- Defined in:
tools/backend/sql/10-ingest.sql- Written by:
otelcol-contrib, configured by
tools/backend/otelcol.yaml- Fires on insert:
checked_mvintochecked- Queried by:
nothing in the schema
- Row size:
0 B stored. About 2 KB per record on the wire (body ~0.9 KB plus quote).
- Scale:
Nodes × 1 record per minute, passing through: 10,000 nodes ≈ 170 inserts/s.
- Reference fleet:
0 B
Columns (16)
Column |
Type |
Meaning |
|---|---|---|
|
|
Becomes checked.time. |
|
|
OTLP trace context. Unused. |
|
|
OTLP trace context. Unused. |
|
|
OTLP trace context. Unused. |
|
|
Unused. |
|
|
Unused. |
|
|
Unused. |
|
|
The keepalive body: a compact JSON string that the quote signs. |
|
|
Unused. |
|
|
host.name is taken from here. |
|
|
Unused. |
|
|
Unused. |
|
|
Unused. |
|
|
Unused. |
|
|
shirudo.quote: attest=…;sig=…;ak=… (base64 TPM structures). |
|
|
Must be shirudo.keepalive. |
shirudo.checked#
One row per keepalive, accepted or not, with the checker’s answer and every body field split into its own column. The body fields and order_key/reject are DEFAULT expressions, so a test can insert just the first eleven columns and get the same row a real record would.
order_key = reset_count << 40 | clock. That leaves 24 bits for reset_count and 40 for clock; a record outside that range is rejected as clock_range.
reject is computed in order: checker failure (bad_signature, body_mismatch, malformed), then schema, then clock_range. Empty means accepted.
- Engine:
Null- Defined in:
tools/backend/sql/10-ingest.sql- Written by:
checked_mvon insert intootel.otel_logs; tests, which insert here directly- Fires on insert:
keepalive_mvintokeepalive;rejected_mvintorejected;nodes_mvintonodes;keepalive_latest_mvintokeepalive_latest;boot_first_mvintoboot_first- Queried by:
nothing in the schema
- Row size:
0 B stored.
- Scale:
Same rate as otel_logs. Each row costs one tpm_quote_check call (pool of 4 processes).
- Reference fleet:
0 B
Columns (35)
Column |
Type |
Meaning |
|---|---|---|
|
|
When the backend received the record. Freshness (check 2) and retention count from it.
|
|
|
The OTLP Timestamp the target put on the log record. Not trusted for ordering. |
|
|
host.name resource attribute: what the node claims to be called. Not an identity. |
|
|
The shirudo.quote attribute as sent. |
|
|
The JSON body as sent. |
|
|
1 when tpm_quote_check accepted the quote. |
|
|
The checker’s reason on failure. |
|
|
Attestation key name, from the checker. |
|
|
Public area of the attestation key, from the checker. Goes only to nodes. |
|
|
TPM reset counter from the quote. |
|
|
TPM clock from the quote. |
|
|
Body schema. Must be shirudo.keepalive/1 or 1.x, else the record is rejected as schema.
|
|
|
Identifies the boot that sent the record. Tamper baselines in boot_first are per boot.
|
|
|
Build identifier of the shirudo binary: SHA-256 over its git commit (with -dirty), config.mk and Makefile.shirudo. Printed by shirudo version –version-id. Check 3 requires it to be in expected_builds.
|
|
|
Digest of the node’s configuration. One of the keys that groups peers for check 7.
|
|
|
Running kernel, e.g. 7.4.2. Groups peers (check 7) and is matched against kernel_vulns via kver().
|
|
|
OS image the node says it booted. Joins to sbom_images.
|
|
|
Version of that image.
|
|
|
Verity root of the image. When it matches the SBOM’s root the binding is verified.
|
|
|
The node’s own overall verdict. Check 3 requires ok.
|
|
|
Condition pairs, two bits each. Check 3 requires the low seven pairs to read 0x1555 (all OK).
|
|
|
Bits 0–3 are faults and fail check 3 (bit 2: outcomes file damaged, bit 3: tamper counters unreadable). Bit 4: sync in progress. Bit 5: snapshot unsettled.
|
|
|
Tamper counters. Their sum must not rise within a boot (check 3). Empty when unreadable.
|
|
|
The upatch tree the node follows. NULL means no tree, and checks 4–7 are skipped.
|
|
|
Publication generation of the tree the node has seen.
|
|
|
The record’s window starts after this operation seq (exclusive).
|
|
|
Last operation the node has applied (inclusive end of the window).
|
|
|
Hash-chain root at base_seq, 64 hex digits.
|
|
|
Hash-chain root after last_seq. Check 4 refolds the tree to reproduce it.
|
|
|
Base64, two bits per operation in the window: 1 applied, 2 selector did not match, 3 attach module not loaded, 0 not reached. Decoded by mask_code().
|
|
|
Hash of the upatch set the node has loaded. Check 6 recomputes it.
|
|
|
Number of upatches loaded. Shown as loaded in node_status.
|
|
|
Reported by the node and stored. No check reads it.
|
|
|
reset_count << 40 | clock. The TPM’s own ordering, never a wall clock.
|
|
|
Empty if accepted, else malformed, bad_signature, body_mismatch, schema or clock_range.
|
shirudo.keepalive#
Every accepted record with its quote and body, kept for audit. No check reads this table.
A record sent twice has the same key and collapses into one row on merge.
quote and body are ZSTD-compressed.
- Engine:
ReplacingMergeTree- Order by:
(ak_name, reset_count, clock)- TTL:
toDateTime(received) + INTERVAL 3600 SECOND. The default ofkeepalive_retention_secondsinsettings;tools/backend/sql/apply-retention.shrewrites it from the setting- Defined in:
tools/backend/sql/10-ingest.sql- Written by:
keepalive_mvon insert intochecked- Fires on insert:
nothing
- Queried by:
audit and ad-hoc queries only
- Row size:
~200 B per record compressed (README).
- Scale:
Nodes × 1,440 records per day × retention. 30 days of retention is 432M rows ≈ 86 GB.
- Reference fleet:
600k rows ≈ 120 MB at the default 1 hour
Columns (30)
Column |
Type |
Meaning |
|---|---|---|
|
|
When the backend received the record. Freshness (check 2) and retention count from it. |
|
|
The OTLP Timestamp the target put on the log record. Not trusted for ordering. |
|
|
host.name resource attribute: what the node claims to be called. Not an identity. |
|
|
The signed quote, ZSTD(1). |
|
|
The signed body, ZSTD(1). |
|
|
Name of the TPM attestation key. This is the node’s identity everywhere in the schema. |
|
|
TPM reset counter from the quote. First half of the ordering. |
|
|
TPM clock from the quote. Second half of the ordering. |
|
|
Body schema. Must be shirudo.keepalive/1 or 1.x, else the record is rejected as schema. |
|
|
Identifies the boot that sent the record. Tamper baselines in boot_first are per boot. |
|
|
Build identifier of the shirudo binary: SHA-256 over its git commit (with -dirty), config.mk and Makefile.shirudo. Printed by shirudo version –version-id. Check 3 requires it to be in expected_builds. |
|
|
Digest of the node’s configuration. One of the keys that groups peers for check 7. |
|
|
Running kernel, e.g. 7.4.2. Groups peers (check 7) and is matched against kernel_vulns via kver(). |
|
|
OS image the node says it booted. Joins to sbom_images. |
|
|
Version of that image. |
|
|
Verity root of the image. When it matches the SBOM’s root the binding is verified. |
|
|
The node’s own overall verdict. Check 3 requires ok. |
|
|
Condition pairs, two bits each. Check 3 requires the low seven pairs to read 0x1555 (all OK). |
|
|
Bits 0–3 are faults and fail check 3 (bit 2: outcomes file damaged, bit 3: tamper counters unreadable). Bit 4: sync in progress. Bit 5: snapshot unsettled. |
|
|
Tamper counters. Their sum must not rise within a boot (check 3). Empty when unreadable. |
|
|
The upatch tree the node follows. NULL means no tree, and checks 4–7 are skipped. |
|
|
Publication generation of the tree the node has seen. |
|
|
The record’s window starts after this operation seq (exclusive). |
|
|
Last operation the node has applied (inclusive end of the window). |
|
|
Hash-chain root at base_seq, 64 hex digits. |
|
|
Hash-chain root after last_seq. Check 4 refolds the tree to reproduce it. |
|
|
Base64, two bits per operation in the window: 1 applied, 2 selector did not match, 3 attach module not loaded, 0 not reached. Decoded by mask_code(). |
|
|
Hash of the upatch set the node has loaded. Check 6 recomputes it. |
|
|
Number of upatches loaded. Shown as loaded in node_status. |
|
|
Reported by the node and stored. No check reads it. |
shirudo.rejected#
Every refused record and why. Check 1 counts a node’s rejections in the last hour.
- Engine:
MergeTree- Order by:
received- TTL:
toDateTime(received) + INTERVAL 7 DAY- Defined in:
tools/backend/sql/10-ingest.sql- Written by:
rejected_mvon insert intochecked- Fires on insert:
nothing
- Queried by:
node_status_mvintonode_status- Row size:
~1 KB (estimate: raw quote and body, sorted by time so little cross-row compression).
- Scale:
Refused records × 7 days. Near zero normally; one bad node at 1 per minute adds ~10,000 rows a week.
- Reference fleet:
≈ 10 MB per misbehaving node
Columns (8)
Column |
Type |
Meaning |
|---|---|---|
|
|
When it arrived. |
|
|
malformed: quote missing or unparseable. bad_signature: does not verify or wrong signer. body_mismatch: quote is over a different body. schema: unknown major version. clock_range: counters too large for order_key. |
|
|
Claimed host name. |
|
|
Key name, when the checker got far enough to read one. |
|
|
From the quote, if parsed. |
|
|
From the quote, if parsed. |
|
|
As sent, ZSTD(1). |
|
|
As sent, ZSTD(1). |