Store
The verifier keeps its state in one backend, picked by the storage options of Command line. The tables are created by src/verifier/store/postgres.go and src/verifier/store/db.go; the baseline and nonce stores are under src/verifier/verify.
Backends
Option |
State |
|---|---|
|
Everything, in one Postgres database that every instance shares. |
|
Everything, over several Postgres databases (Shards). |
|
Everything, in one SQLite file. One instance only. |
|
Used nonces, revocations, bans, the audit log and the decision log in one SQLite file. The baselines stay in memory and are lost on restart. |
|
Nothing durable. The used-nonce history holds the last 10000 nonces. |
The challenges a verifier has sent and not yet seen answered live in that instance's memory on every backend: a report reaches the instance whose challenge it answers, on the same connection.
Tables
baselinesOne row per client ID: the agent hash and PCR 14, PCR 0, 1 and 7, the event log and ESRT firmware version recorded with the pin, the re-anchor counters and their last times, the pending low-assurance review, the tenant, and the last kernel digest and machine keys (Verifier).
baseline_archiveThe values a re-anchor replaced, with the time and the reason. A row is never removed, a client delete included.
forced_reanchorsThe clients an operator forced to re-anchor. The round that pins the client afresh spends the row.
used_noncesThe nonces already answered, in hex, with the time of use. A nonce is kept for 15 minutes, three times the five-minute challenge lifetime.
revocations,hardware_bansThe revoked client IDs and the banned device pseudonyms, each with its tenant, the reason, the actor, the note and the time.
audit_logOne row per operator action: the action, the target, the reason, the actor, the note, the tenant and the time.
attestation_logThe decision log (Decision log).
shard_identity,shard_setPostgres only: the database's own identity and the shard set it belongs to (Shards).
schema_versionThe migrations applied, each with its time and the schema fingerprint (Schema).
Postgres serializes the writes for one client with a transaction-scoped advisory lock on the client ID, and runs those of different clients in parallel. The SQLite baseline store takes one process mutex for every client.
Decision log
A row in attestation_log stands for a run of rounds on one host. It holds
the tenant, the client ID, the hardware ID, the verdict, PCR 14, the kernel
digest, the details, the peer address and the duration; timestamp is the
first round, last_seen the last and rounds the count.
A passing round extends the host's newest row when that row passed too, holds
the same hardware ID, PCR 14, kernel digest and details, and opened at most
--attestation-log-window before (default 1h). Any other round opens a
row: the host's first, any refusal, the first pass after a refusal, a change
in the evidence, and a round dated before the row's last_seen. A window
of 0 opens a row per round.
The log gates nothing, and a write that fails or is late never changes a verdict (src/verifier/store/attestation_batch.go):
A round is buffered and written by a background worker, in batches of up to 256, every second or when a batch fills. A read through the monitoring API writes the buffer first.
The buffer holds 4096 rounds. Past that it sheds passing rounds first, oldest first, then refusals. A shed pass costs little: the host's next pass opens the row.
On shutdown the buffer gets 5 seconds to be written. A crash loses what is buffered.
What is lost is logged as
attestation-log buffer full; decision records shed(at most every 30 seconds) orattestation-log flush failed; records dropped, and counted inlota_attestation_log_dropped_total,lota_attestation_log_failed_totaland, for the refusals among them,lota_attestation_log_events_lost_total(Observability).
The used nonce and the baselines a round writes are written before its verdict is sent.
Schema
Each backend carries its own list of migrations, applied in order at startup and each in its own transaction. On Postgres a session advisory lock serializes the instances that start together. The schema is checked three ways after the migrations, and each mismatch stops the verifier (src/verifier/store/schema_identity.go):
- Version
A version above the highest this build knows is refused with
database schema is newer than this build. Run that build, or restore a backup taken at this one.- Fingerprint
The SHA-256 of every migration's version, description and SQL. A different recorded fingerprint is refused with
database schema was written by a different build. A database that records none is stamped, with a warning.- Tables
The tables must be those the migrations create, apart from
schema_version. A missing or extra table is refused withdatabase schema is not the shape this build creates.
A writer refuses a hot standby before migrating, with database is a
read-only standby. A --report-only instance applies nothing and refuses
a database below its version or with no schema, database carries no LOTA
schema; a verifier on the primary builds and migrates it.
lota-verifier --print-versions prints the version and fingerprint of each
backend (Protocol versions).
A migration is appended and never edited, and adds a table, a column or an index without dropping, renaming or retyping one, because the instances still running the older build keep using the database. The tests in src/verifier/store/migrations_test.go refuse a destructive migration.
Connection pool
Each instance opens at most --pg-max-open-conns connections per database,
default 20, and keeps half of them idle. A connection is closed after 30
minutes, or 5 minutes idle. Every instance's pool draws on the database's
max_connections, and the verifier warns at startup when its pool alone
exceeds it (connection pool exceeds the database's max_connections) or
leaves no room for a second instance (connection pool leaves no room for a
second instance). Postgres commits concurrent transactions together, so a
wider pool takes more writes per commit (Verifier topologies).
The SQLite file is opened with write-ahead logging, a 5-second busy timeout and up to 10 connections; its directory is created with mode 0700.