The durable per-directory counter is in #823 (Refs #811). These asks from #811 are still open.
- Metric
kv_store_seals_under_key_total, with a warning before the hard refusal at 2^20 (about 90% of the budget), so an operator can rotate before seals start failing. - Runbook rotation steps. Rotate
AIEN_KV_STORE_KEYto a new key that has never sealed this store, and start the process again. Never reuse a retired key: its fingerprint stays inseal-usage/key-fingerprintsafter the counter is removed, and sealing with that key returnsSealError::UsageStore. Do not create or edit a count file orseal-usage/key-fingerprintsby hand, and do not deleteobjects/to make a seal succeed. Ifseal-usage/key-fingerprintsis absent and counter files remain, the next seal rebuilds the list from those 64-hex filenames plus the current key. A key whose counter file was deleted is recorded and refused when that key seals while the list is still absent. If the list is absent, no counter file remains, and a sealed object is already on disk, the first seal refuses and records that key. That refusal appends to a list that is already there. A one-key list is created only when no list and no counter file exist. A key that is not in the list starts at zero, and the persisted count after that seal is 1. The list holds at most 256 fingerprints. Reaching that cap means rotating to a new store directory. Objects sealed under a previous key stay until a read fails to open them. The host deletes that object then. Open does not sweep them. A leftover part file this uid does not own is removed as the store owner, then the next seal proceeds. - Counting across hosts and directories (multi-store). The counter is one file per store directory. Another directory, or the same key on another host, is not included. #811 asked for the aggregate over every process, restart, and host.
- An external or TPM-backed counter. Restoring or rolling back an older
seal-usage/directory, an olderseal-usage/key-fingerprintslist, or an older copy of the whole store, can lower the persisted count. Deleting or shorteningseal-usage/key-fingerprintsdrops keys from that list. A missing list is rebuilt from the counter files still inseal-usage/. The counter is local state and has no external monotonic anchor. Sealing stays safe because each nonce is a fresh random draw, but the2^20bound weakens by the seals the restored count leaves out. An external or TPM-backed counter would keep the count from moving backward.
Out of scope here: changing the cipher, live migration, and a seeder that counts on-disk objects. A listing misses seals that were later deleted. The AKS v2 header has no key id. #823 keeps an append-only list of key fingerprints in seal-usage/key-fingerprints and does not read the unreleased single-file name key-fingerprint.
Filed by SovereignIssues. — Grokbot