Expand description
The rotation state machine (R13): rotate a credential at its issuer, deploy it to the things that use it, check them, and revoke the old credential only when that is safe.
The engine owns the order of steps and the safety rules; it knows nothing about any one issuer or
deployment. Those arrive as traits (IssuerConnector, Consumers, EntryStore), so the
same state machine runs against PostgreSQL, Cloudflare or a fake that injects faults, and the
properties below are tested against the fake.
The rules, in the order they matter:
- The old credential stays valid until the end. It is revoked last, and only when the revoke
rule is met: by default every required consumer has been deployed to and has passed its check
in this run (
RevokeRule::AfterAllChecked). - A value the client chose is stored before the issuer hears of it (
rotation_pending), so a lost response never leaves a credential at the issuer that nobody has. - No blind retry of anything destructive. A response lost after a destructive call is
uncertain; the connector is asked what happened (IssuerConnector::reconcile) and the step is repeated only when the answer is “not done”. An in-place roll that is lost cannot be reconciled (the old value is gone and the new one never arrived) and stops asneeds_attention. - Store first. The new value is written to the entry (a new generation, the old value in its history) before it is deployed, so a crash after the issuer changed cannot lose it.
- Every transition is persisted (
RunStore), so a crash, a lock or a restart resumes at the step that was in flight and never starts over.
Structs§
Enums§
- Class
- What a connector can do. The class decides the steps.
- Issuer
Error - Why an issuer call did not succeed.
- Outcome
- Reconcile
- Revoke
Rule - Rollback
Rule - Status
- Step
- Step
Kind - The step a reconcile is about.
Traits§
- Consumers
- What uses the credential, usually node targets. Each consumer is identified by a stable id.
- Entry
Store - The vault entry being rotated.
- Issuer
Connector - RunStore
- Where runs and pending values are kept between steps.
Functions§
- init_
schema - Creates the rotation tables inside the encrypted vault database. Runs hold ids and states, never
values;
rotation_pendingholds the one value that exists nowhere else yet. - list_
runs - load_
run - A run saved by
SqlStore, to resume after a crash or an unlock. - run_
name