Runbook: Clients and Credentials
Runbooks · Code: crates/cli/src/clients.rs, crates/engine/src/clients.rs · Step: 2.08 · Decision: ADR-0017
Who may call the ledger, and what they may do. A client is a platform that owns accounts; a credential is one key, for one actor of a client, with roles from the permission matrix. Credentials are managed only from this command line: the API has no endpoint for them, and the service’s database role cannot create one.
| Who | The operator’s administrator |
| Command | mezgeb-cli client ..., mezgeb-cli credential ... |
| Connects as | mezgeb_admin (--database-url or MEZGEB_DATABASE_URL) |
| Takes | Seconds; a revocation applies to the next request |
Onboarding a client platform
Section titled “Onboarding a client platform”mezgeb-cli client create wallet-app --rate 100 --burst 200mezgeb-cli credential issue wallet-app --actor app:wallet --role poster --role readercredential issue prints the client_id and the client_secret once.
Hand them to the client through its secret store, never by email or chat.
The client then gets tokens itself:
curl -u "$CLIENT_ID:$CLIENT_SECRET" -d grant_type=client_credentials \ https://ledger.example/oauth/tokenGive each credential the fewest roles it needs. A client platform’s back
end is usually poster and reader; nothing a client platform does needs
operator, approver, auditor or admin.
The operator’s staff
Section titled “The operator’s staff”Each person gets their own credential, so that maker-checker compares people, not shared keys (INV-25):
mezgeb-cli client create operator --rate 20 --burst 40mezgeb-cli credential issue operator --actor ops:alice --role operatormezgeb-cli credential issue operator --actor ops:bekele --role approverOne credential is never both operator and approver; the command, the
service and the database each refuse it. The same person may hold an
operator credential and an approver credential, but cannot approve
their own adjustment request: the engine compares the actors.
Rotating a secret
Section titled “Rotating a secret”- Issue a second credential for the same actor and roles.
- Switch the client to the new
client_idand secret. - Check the old credential is no longer used (the access log records the client; token issuance logs the credential).
- Revoke the old one:
mezgeb-cli credential revoke <old client_id>.
A leaked secret or a compromised client server
Section titled “A leaked secret or a compromised client server”Act first, investigate after:
mezgeb-cli credential list <client>to find the credential.mezgeb-cli credential revoke <client_id>: its tokens stop on the next request, and it cannot get new ones.- If the client’s server itself is compromised, disable the whole client:
mezgeb-cli client disable <client>. Every credential and token of it stops. A disabled client is never enabled again; onboard a new one when the platform is clean. - Review what the client posted while compromised (its entries, by
client_id), and correct with reversals or adjustments.
Limits
Section titled “Limits”--rate and --burst set the client’s token bucket: burst requests at
once, refilled at rate per second. A client over it gets 429 rate_limited with Retry-After. The limits are kept per service instance.
Development and CI
Section titled “Development and CI”mezgeb-cli client seed deploy/clients.dev.toml creates the development
clients with the secrets that file names, and skips those that exist.
Compose runs it after the migrations. Never seed that file, or any file of
known secrets, into a ledger holding real money.