دسکتاپ، Worker و محاسبات محلی · فصل ۱ — Device Identity، Tauri، Tray و Admin CLI · 178
Headless Admin CLI and Break-glass Access
Design a headless admin CLI that exposes a minimal recoverability surface with explicit command scopes, strong local authorization, least privilege, break-glass activation/expiry, reason and approval evidence, immutable audit records, and a recovery path that remains usable when the desktop UI is unavailable. میتواند «Headless Admin CLI و Break-glass Access» را برای یک node محلی با identity، state، privilege و recovery boundary مناسب طراحی کند.
Lesson summary
Design a headless admin CLI that exposes a minimal recoverability surface with explicit command scopes, strong local authorization, least privilege, break-glass activation/expiry, reason and approval evidence, immutable audit records, and a recovery path that remains usable when the desktop UI is unavailable.
میتواند «Headless Admin CLI و Break-glass Access» را برای یک node محلی با identity، state، privilege و recovery boundary مناسب طراحی کند.
This lesson produces
میتواند «Headless Admin CLI و Break-glass Access» را برای یک node محلی با identity، state، privilege و recovery boundary مناسب طراحی کند.
Who it is for
Foundation
Use a guided lesson-specific evidence matrix and one worked negative case.
Repair
Re-run only the failed owned dimension with a smaller deterministic synthetic fixture.
Experienced
Start from mixed authority/policy/evidence records; require explicit trade-offs and provenance.
Prerequisites
1. The problem: losing the GUI must not create a backdoor
Assume the tray and desktop window fail after a bad configuration update while the worker service is still running. Operations needs a headless path for diagnosis and a narrowly bounded recovery action. The dangerous shortcut is a flag such as --force-admin that disables every control. This lesson builds a recovery CLI that remains constrained even during an emergency.
2. Owned boundary: what this lesson controls
LOC-005 owns only the local headless control plane: command identity, effect class, command scope, normal authorization, bounded break-glass state, expiry/revocation, confirmation, and audit. Base device identity, native capability/CSP policy, tray behavior, and OS-service lifecycle remain in adjacent lessons and are not redefined here.
3. Classify a command before authorizing it
Every command needs a stable name and an explicit effect class. A practical minimum is DIAGNOSTIC_READ_ONLY, RECOVERY_STATE_CHANGE, and DESTRUCTIVE_OR_HIGH_RISK. Classification happens before authorization so emergency mode cannot hide the true risk of a destructive operation.
4. Read-only and state-changing commands do not share one gate
Health inspection or configuration validation can use a lower-risk normal local path when authentication, authorization, and scope are valid. Rollback, rotation, or other state changes need stronger evidence, explicit confirmation, and complete audit binding. Being exposed through a CLI grants no additional authority.
5. Prefer the normal path whenever it is usable
If the normal admin path is available and valid, use it. Break-glass is not a permanent substitute for ordinary login or authorization. A broken UI does not necessarily prevent valid local authentication for diagnostic commands, so emergency state should not be activated for every operational inconvenience.
6. Break-glass is a bounded record, not a superuser switch
The emergency record identifies the actor, reason, approval reference, permitted scopes, activation time, and expiry. An active record creates an alternate authorization path only. Each requested command still has to be break-glass eligible and inside the approved scope.
7. Keep local authentication separate from local authorization
A central identity-provider outage does not make a local username trustworthy by default. local_authn_state establishes who presented the local credential, while local_authz_state establishes whether that actor holds the required role. STALE, UNKNOWN, and DENIED evidence remain non-success states.
8. Expiry and revocation are runtime checks
Old approval is not enough. At execution time, compare the current time with expires_at and check revocation. An expired or revoked emergency record stops the action with a typed EXPIRED or REVOKED result and requires a fresh authorization record.
9. Emergency scope must be narrower than local administrator authority
A useful break-glass record may permit only a controlled configuration rollback or rotation of one damaged local credential. An unrelated request such as data purge, log deletion, or broad policy modification remains DENIED even while emergency mode is active.
10. Confirmation protects sensitive effects from operator error
Before a state-changing effect, show the exact target, scope, and consequence and record explicit confirmation. Confirmation is not authentication or authorization; it is an additional gate that reduces accidental execution of an otherwise authorized action.
11. Audit must bind pre-effect intent to post-effect outcome
Each admin command needs a stable audit_event_id tying together actor, command, scope, authority path, reason, approval, timestamps, and result. If an action cannot be linked to its audit record, the result remains UNBOUND rather than being presented as a clean success.
12. Post-event review is how break-glass actually ends
When the normal identity service returns, revoke emergency authority and record what ran, why it ran, which evidence supported it, and what follow-up remains. Closing the incident without this review turns emergency access into an untracked exception.
13. Fail closed by preserving typed weak states
DENIED, DEFER, DEGRADED, EXPIRED, REVOKED, and UNBOUND are operational states, not generic errors. Stale authentication, missing approval, scope mismatch, or a missing audit binding must not be collapsed into a Boolean success value.
14. Lab: Headless Admin CLI & Break-glass Control Record v1
Eight synthetic fixtures ask you to derive authority path, scope state, time state, audit state, break-glass state, action state, and the bounded decision. Expected labels are not present in the learner package. No real credential, privileged OS change, external target, or network access is required.
15. Transfer and chapter exit: close emergency access instead of normalizing it
For transfer, assume the normal identity service returns after recovery. Subsequent commands go back through the normal path, emergency authority is revoked, and post-event review is recorded. C01 exits only when recovery works without the GUI while no permanent “always-admin” path remains.
Assessment
There is no answer key in this lesson pack; answer it yourself and mark honestly. "Needs review" sends the lesson to your review queue.
Q1 boundary
Name the exact control-plane boundary owned by LOC-005 and one adjacent concern it does not own.
Q2 classification
Classify status.health, config.rollback_one, and data.purge by effect class before considering authorization.
Q3 application
Given a valid local normal path and an unavailable GUI, decide whether a read-only health command needs break-glass and justify the evidence.
Q4 diagnosis
An emergency record is active but the requested command is outside its allowed scopes. What typed decision should the control plane preserve and why?
Q5 time
Explain what must happen if the emergency record expires after approval but before execution.
Q6 audit
Why is a missing audit_event_id a control failure even if authentication and scope are otherwise valid?
Q7 transfer
After the identity service returns, describe the sequence that restores normal authorization and closes the emergency episode.
Q8 reflection
State the strongest claim this synthetic lab can support and one claim it cannot support about a real production node.
Assessment rubric
A satisfactory submission must demonstrate all five critical dimensions:
- Identity and boundary — the LOC-005 control-plane boundary is explicit and adjacent lessons are not absorbed.
- Exact evidence binding — command, actor, AuthN/AuthZ, scope, emergency reason/approval, time state, confirmation, and audit evidence are bound to the decision.
- Negative and uncertain states — at least one scope denial and one stale/expired/revoked/unbound state remain typed instead of being coerced into success.
- Bounded decision — a state-changing action is never authorized only because break-glass is active; confirmation and audit remain required.
- Transfer — when normal identity service returns, emergency authority is revoked and post-event review closes the episode.
A response fails the lesson outcome if it introduces a universal force-admin bypass, treats a single identity label as full authorization, ignores expiry/revocation, or exposes expected fixture labels inside learner work.
References & freshness
Case studies
Lab files
Implement an evaluator for the eight synthetic fixtures. Keep the normal authorization path separate from emergency authorization, preserve expiry/revocation/stale/unbound states, and require command scope plus audit evidence.
The lab does not use real credentials, network access, operating-system privilege changes, or destructive effects. The transfer case restores the normal identity path and closes the emergency episode with post-event review.