Keepalive#
The keepalive is the status record a target’s TPM quotes and sends to
its collector: one OTLP log record that shirudo status --otel sends
when shirudo-keepalive.timer runs it. The transport, the endpoint
and the resource it shares with the map documents are in OTLP documents.
Log record#
One log record in resourceLogs[0].scopeLogs[0].logRecords:
Field |
Value |
|---|---|
|
Wall clock when shirudo builds the document, nanoseconds since the epoch, decimal string. |
|
|
|
|
|
|
Attribute |
The one attribute, a string: the TPM quote of the body, below. |
timeUnixNano and the resource attributes are for display only. They
identify nothing and order nothing; the quote does both.
shirudo.quote has three fields in this order, separated by ;
with no blanks, each in standard base64 with padding:
attest=<TPMS_ATTEST>;sig=<TPMT_SIGNATURE>;ak=<TPMT_PUBLIC>
Field |
Value |
|---|---|
|
The |
|
The marshalled |
|
The marshalled |
shirudo-quote-check checks a quote against its body without a TPM. An attestation quote always selects a PCR, so it cannot pass as a keepalive quote. A quote that checks proves that the body is unchanged since the key signed it, not that the key lives in a TPM.
When no TPM answers or the quote fails, status --otel sends nothing.
A body that JSON cannot carry unchanged, one with a NUL byte or
malformed UTF-8, is not sent either; the body status builds is never
one.
The keepalive uses map_export.otel_endpoint,
map_export.tenant_id, map_export.otel_insecure,
map_export.otel_retries and map_export.otlp_max_bytes.
status --otel exits 1 when the export fails and 2 when the
map_export.* settings are invalid.
Keepalive body#
The body is the record the quote covers, the bytes that status
--keepalive prints. It is one compact JSON object in UTF-8: no blank
or newline between tokens, no trailing newline, at most 4095 bytes. Its
23 keys are always present and come in the order of the tables below,
which group them as identity, health, upatch tree and loaded set; a key
that does not apply is null, never left out. A hash is 64 lowercase
hex digits. An integer is a JSON number with no sign, fraction or
exponent.
Identity schema boot_id version_id config_root kernel_release
image_id image_version image_root
Health verdict cond flags tamper integrity
Upatch tree tree_id generation base_seq last_seq base_root
projection_root mask
Loaded set set_sha256 count not_ok
A collector reads a condition, a tamper counter and an integrity counter by its place. A new one is added after the last, never put between two.
Identity#
Which boot, build, configuration, kernel and image the record speaks for. Nothing in the body names the host: the attestation key of the quote identifies the node.
Key |
Type |
Value |
|---|---|---|
|
string |
|
|
string |
The kernel’s |
|
hash |
The binary’s |
|
hash or |
The dm-verity root of the selected signed config image. |
|
string |
The kernel release, as |
|
string or |
|
|
string or |
|
|
hash or |
|
Health#
What the node reports about itself, as shirudo status evaluates it.
The detail strings of the conditions stay in status --json; the body
carries only the outcomes.
Key |
Type |
Value |
|---|---|---|
|
string |
The verdict of shirudo status: |
|
integer |
The seven conditions, two bits each, 0 to 16383. |
|
integer |
Bits that qualify what the body reports. |
|
array of integers or |
Every counter of Tamper counters, zeros
included, in the order of that page. |
|
array of integers or |
Every counter of Integrity counters the same
way. |
cond holds two bits per condition, condition i at bits 2i and
2i+1:
i |
Condition |
Bits |
|---|---|---|
0 |
|
0 and 1 |
1 |
|
2 and 3 |
2 |
|
4 and 5 |
3 |
|
6 and 7 |
4 |
|
8 and 9 |
5 |
|
10 and 11 |
6 |
|
12 and 13 |
Each pair is 00 not evaluated, 01 OK, 10 WARN or
11 ALERT. All seven OK is 5461.
The bits of flags:
Bit |
Name |
Set when |
|---|---|---|
0 |
|
The register was bound more than once for this TPM reset. |
1 |
|
This boot’s |
2 |
|
The tree eventlog does not replay to the |
3 |
|
The tamper counters cannot be read; |
4 |
|
A tree operation was left in flight: |
5 |
|
|
6 |
|
The integrity counters cannot be read; |
Upatch tree#
Where the node is in the upatch tree it follows and what it did at each
operation of a window of the last 512. All seven keys are null when
the node follows no tree or its tree state cannot be read. The window
and the outcomes come from the outcomes record of
upatch tree, which keeps every operation the
node processed, those of sealed segments included.
Key |
Type |
Value |
|---|---|---|
|
string or |
The |
|
integer or |
The |
|
integer or |
The sequence number the window starts after: the head of the recorded publication less 512, or 0 for a tree of 512 operations or fewer. |
|
integer or |
The last operation the node processed. |
|
hash or |
The node’s projection root after |
|
hash or |
The node’s projection root after |
|
string or |
The outcome of every operation of the window. |
mask is standard base64 with padding of two bits per operation, from
base_seq + 1 to the head of the recorded publication: 01
applied, 10 passed over, 11 module absent, 00 not reached,
which every operation past last_seq is. The first operation takes
the two highest bits of the first byte, the next the two below them,
and the last byte is padded with 00. A full window of 512 operations
is 128 bytes, 172 characters.
Loaded set#
What is loaded now, as one hash and two counts, the same size for one upatch or a thousand.
Key |
Type |
Value |
|---|---|---|
|
hash |
SHA-256 over a |
|
integer |
The upatches loaded. |
|
integer |
The loaded upatches the tree holds a status file for. |
Example#
The body of a target with verdict ok that follows no tree:
{"schema":"shirudo.keepalive/1","boot_id":"82639935-1127-4dab-91b5-f818eabc7f13","version_id":"d0d7aa800303439023907d1979d917d46a21bec21f816689c138728a28e84af9","config_root":"6d5ed552f448a1c07e3b9d24f5a86c1e0b7d93f2c4e5a6b7180c9d2e3f4a5b6c","kernel_release":"7.3.0-bpf-next+","image_id":null,"image_version":null,"image_root":null,"verdict":"ok","cond":5461,"flags":0,"tamper":[15,0,0,0,0,1,0,0,0,0,0,8,0,0,0,0,0,1,0,0,1,0,0,0,0,0,7,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0],"integrity":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"tree_id":null,"generation":null,"base_seq":null,"last_seq":null,"base_root":null,"projection_root":null,"mask":null,"set_sha256":"5f0c2e8b7a1d4c3f9e6b2a0d8c7f1e3b5a9d4c2e6f8b0a1d3c5e7f9b2d4a6c8e","count":1,"not_ok":0}
Keepalive document#
The keepalive of a target with verdict ok, as the code builds it.
Angle brackets mark values that vary, and the body string is shortened
to its first keys:
{
"resourceLogs": [
{
"resource": {
"attributes": [
{"key": "service.name", "value": {"stringValue": "shirudo"}},
{"key": "service.version", "value": {"stringValue": "<version>"}},
{"key": "host.name", "value": {"stringValue": "<host>"}}
]
},
"scopeLogs": [
{
"scope": {"name": "shirudo.keepalive", "version": "<version>"},
"logRecords": [
{
"timeUnixNano": "<ns>",
"observedTimeUnixNano": "<ns>",
"severityNumber": 9,
"severityText": "INFO",
"eventName": "shirudo.keepalive",
"body": {
"stringValue": "{\"schema\":\"shirudo.keepalive/1\",\"boot_id\":\"<boot-id>\",\"version_id\":\"<version-id>\",...}"
},
"attributes": [
{"key": "shirudo.quote", "value": {"stringValue": "attest=<base64>;sig=<base64>;ak=<base64>"}}
]
}
]
}
]
}
]
}