Fleet CLI (lota-fleet)
lota-fleet calls the verifier's monitoring API
(Monitoring API) from the command line: the client
inventory, revocations, hardware bans, forced re-anchors, client deletes, the
low-firmware-assurance review list, and the audit and decision logs. It
talks HTTP to the API alone and needs no access to the verifier's host or
store. The commands are in src/fleetctl/main.go, the requests in
src/fleetctl/client/client.go.
make fleet-cli builds build/lota-fleet, a static binary with no
module dependencies. make all and the packages leave it out.
Usage
lota-fleet [global options] <command> [subcommand] [<id>] [command options]
The options take one or two leading dashes. A command that names a client or
a hardware ID takes it first, before its options: revoke <client-id>
-reason R -actor A.
$ export LOTA_FLEET_SERVER=https://verifier.example:8080
$ lota-fleet -tls-ca verifier-ca.crt -key-file fleet-reader.key stats
Global options
-server URLThe API base URL,
httporhttpswith a host. Without the option,LOTA_FLEET_SERVER; without either,http://127.0.0.1:8080. A path in the URL prefixes every route, and a trailing/is dropped. A request goes through the proxy thatHTTPS_PROXYorHTTP_PROXY(or the lower-case name) gives for its scheme, except to a host listed inNO_PROXYand tolocalhostor a loopback IP.-key-file PATHA file holding the API key, sent as
Authorization: Bearer <key>. Whitespace around the key in the file is trimmed. Without the option the key isLOTA_FLEET_API_KEY, taken as it is; with neither, noAuthorizationheader is sent. There is no option that takes the key itself: an argument shows in the process list, which other users of the machine read unless/procis mounted withhidepid.-tls-ca PATHPEM certificates that replace the system roots for an
httpsserver. The verifier serves HTTPS on any address other than a loopback IP (Command line), so this names the CA that issued its--cert. Without the option the system roots apply.-timeout DURATIONThe time allowed for each request, as a Go duration such as
10s. Default30s;0means the default, and a negative value sets no limit.-jsonPrints the response as JSON in place of the text below (Output). The action commands print text either way.
-h before the command prints the usage, and among the options of a
command that takes options, those options; both exit 2. In the place of a
client or hardware ID, -h is taken as the ID: ban -h asks for
-reason, and revoke -h -reason admin -actor A revokes a client named
-h. ban x -h prints the options of ban.
The key a command needs is the role of its route: a reader key for the listings, an admin key for the actions ("Authentication" in Monitoring API).
Commands
Command |
Role |
Route |
|---|---|---|
|
none |
|
|
reader |
|
|
reader |
|
|
reader |
|
|
admin |
|
|
admin |
|
|
reader |
|
|
admin |
|
|
admin |
|
|
reader |
|
|
admin |
|
|
admin |
|
|
reader |
|
|
admin |
|
|
reader |
|
|
reader |
|
What each route does, the answers it gives and the audit row it writes are in Monitoring API; the effect of a re-anchor, a delete, a revocation and a ban on the client's next round is in "Operator actions" of Verifier.
Actions
-reason, -actor and -note fill the fields of the same names in
the request body. lota-fleet refuses an action without -reason or
-actor. The verifier takes one of cheating, compromised,
hardware_change and admin as the reason of a revoke or a ban, and
free text elsewhere.
ban and unban send -tenant in the body; without it the verifier
uses the tenant default (Multi-tenancy). A hardware ID is the
device pseudonym that devices show prints as hardware id and the
decision log holds as hardware_id.
On success each action prints one line:
revoke,unrevokerevoked <client-id> (<reason>),unrevoked <client-id> (<reason>)ban,unbanbanned <hardware-id> in tenant <tenant> (<reason>),unbanned <hardware-id> in tenant <tenant> (<reason>)reanchorreanchored <client-id>: baselines cleared, next attestation re-establishes trustdeletedeleted <client-id>: trust state removed, revocations and bans keptreanchor-review ackreviewed <client-id>
ban and unban print in the default tenant when -tenant is not
given.
Listings
-limitThe
limitquery value; a value of 0 or less is not sent, and the verifier uses its default.auditandattestssend no other query value, so they read the newest rows.-after,-next-idThe cursor of the next page, which
devices listandbansprint on standard error asnext page: -after <id>andmore results: -next-id <cursor>. Under-jsonit is thenextandnext_idfield of the page, and standard error stays empty.-tenantKeeps the rows of one tenant, in the table and under
-json. The filter runs inlota-fleetover the rows the verifier sent, so a page can come back short or empty while more rows exist. The verifier answers a key scoped to tenants with the rows of its tenants alone; the filter narrows the view of a key that sees more.
Output
healthstatus,modewhen the verifier sends one,uptime, andtls listening: <true|false> (<address>).statsname: valuelines:registered clients,active policy,loaded policies, the attestation counters,active revocations,active bans,pending challenges,used noncesanduptime(GET /api/v1/stats). A key scoped to tenants getstenant scoped: trueandtenantsfirst, and no line for a counter the verifier left out.devices list,reanchor-review listOne client ID per line on standard output. The count goes to standard error, as
<n> clientsand<n> client(s) awaiting re-anchor review, so standard output holds the IDs alone.devices showclient,tenant,hardware id,revoked,revocation reason,first seen,last attestation,attestation count,monotonic counterandpcr14 baseline, a field the verifier left empty omitted. With machine keys on record,mok stateand onemok keyanddb keyline per key: its type, SHA-256 and subject.revocations,bans,audit,attestsA table with the columns below.
attestsgives the duration in milliseconds with one decimal.Command
Columns
revocationsCLIENT TENANT REASON REVOKED AT BY NOTEbansHARDWARE ID TENANT REASON BANNED AT BY NOTEauditTIME TENANT ACTION TARGET ACTOR REASON NOTEattestsTIME TENANT CLIENT RESULT MS DETAILS
-json prints the response as lota-fleet decoded it, indented. A field
it does not read is left out: kernel_hash, last_seen and rounds
of a decision row. revocations, reanchor-review list, audit and
attests print the array of rows without the count beside it;
bans prints the page with count set to the rows kept by -tenant.
Exit status
0Success.
1The request failed or the verifier refused it, or
healthread a status other thanok. A refusal printslota-fleet: API error: HTTP <code>: <message>, with the message of the verifier's error object, orlota-fleet: API error: HTTP <code>alone when the body holds none, as from a server other than the verifier or plain HTTP sent to its HTTPS port. A key file or-tls-cafile that cannot be read, a server URL that is nothttporhttpsor has no host,-tls-cawith anhttpserver, and a CA file that is empty or holds no certificate also exit 1. These are checked after the global options and before the command, so they win over a usage error in the command, and a missing command or an unknown global option wins over them.2A usage error: no command, an unknown command or subcommand, an unknown option or a value it cannot parse, a missing
-reasonor-actor, a missing or extra argument, and-h.
health prints its answer before exiting 1, so a script can test the
status alone:
lota-fleet health >/dev/null || echo "verifier degraded" >&2
Examples
Revoke a client and list the revocations:
$ lota-fleet -key-file fleet-admin.key revoke "$CLIENT_ID" \
-reason compromised -actor ops@example.com -note "incident 42"
$ lota-fleet -key-file fleet-reader.key revocations
Ban the hardware behind the failed rounds of one tenant:
$ lota-fleet -key-file fleet-reader.key -json attests -limit 50 -tenant acme \
| jq -r '.[] | select(.result != "ok") | .hardware_id // empty'
$ lota-fleet -key-file fleet-admin.key ban "$HARDWARE_ID" -tenant acme \
-reason cheating -actor ops@example.com
Re-anchor a client after a planned firmware update:
$ lota-fleet -key-file fleet-admin.key reanchor "$CLIENT_ID" \
-reason "firmware update" -actor ops@example.com
Walk every client ID:
after=
while :; do
lota-fleet -key-file fleet-reader.key devices list -limit 1000 \
${after:+-after "$after"} 2>page.err
after=$(sed -n 's/^next page: -after //p' page.err)
[ -n "$after" ] || break
done