Respond (RS) · Identity
Identity at the client side layer
deterministic · Outside the model's reasoning
How do I stop the bleeding now?
What this cell does
Kill agent process tree, delete local credential file, force re-authentication on next launch, logout SSO session on the operator host.
Artifacts (1)
agent-revoke-localview on GitHub#!/usr/bin/env bash
# ABOUTME: Local identity-revocation runbook. Kills agent processes, deletes credential, forces re-auth.
# ABOUTME: Pre-authorized at on-call level. Reversible by rotating a fresh credential and re-launching.
set -euo pipefail
if [[ $# -lt 1 ]]; then
echo "Usage: agent-revoke-local <AGENT_NAME>" >&2
exit 64
fi
AGENT_NAME="$1"
TIMESTAMP="$(date -Iseconds)"
INCIDENT_ID="$(uuidgen 2>/dev/null || python3 -c 'import uuid; print(uuid.uuid4())')"
# 1. Kill all running agent processes (fast).
pkill -KILL -f "claude.*$AGENT_NAME" 2>/dev/null || true
sleep 2
if pgrep -f "claude.*$AGENT_NAME" >/dev/null; then
echo "WARN: agent processes still running after pkill -KILL" >&2
fi
# 2. systemctl stop if running as a service.
if systemctl list-units --type=service --state=active 2>/dev/null | grep -q "$AGENT_NAME"; then
systemctl stop "claude-code-${AGENT_NAME}" 2>/dev/null || true
fi
# 3. Delete local credential files.
CRED_PATH="/etc/agents/${AGENT_NAME}"
if [[ -d "$CRED_PATH" ]]; then
shopt -s nullglob
rm -f "$CRED_PATH"/*token* "$CRED_PATH"/*key* "$CRED_PATH"/.env
fi
# 4. Force re-auth on next launch via flag file. The agent launcher should
# refuse to start if this flag is present and a fresh credential has not been
# provisioned over it.
mkdir -p "$CRED_PATH"
touch "$CRED_PATH/.requires_reauth"
chmod 0644 "$CRED_PATH/.requires_reauth"
# 5. Log the incident.
logger -t agent-incident -p user.warning \
"$(jq -n \
--arg event "identity_revoked_local" \
--arg agent "$AGENT_NAME" \
--arg incident "$INCIDENT_ID" \
--arg actor "$(whoami)" \
--arg ts "$TIMESTAMP" \
'{event:$event, agent:$agent, incident:$incident, actor:$actor, ts:$ts}')"
echo "Local identity revoked for $AGENT_NAME (incident $INCIDENT_ID)"
Cell notes
Interventions, Identity / Client-side
Trigger. Sentinels alert: identity used outside expected hours, identity used from unexpected source IP, credential fingerprint mismatch.
Authority. On-call, no second approval required. Identity revocation is reversible (rotate again to restore).
Speed target. Under 30 seconds.
Tooling
- - Standard Linux process tools:
pkill,pgrep,systemctl. - - The per-agent credential layout from
../../../controls/identity/client-side/.
Files in this directory
- -
agent-revoke-local, runbook script. TakesAGENT_NAMEas the only positional argument. Kills the process tree, optionallysystemctl stops, deletes the credential file, sets a re-auth flag, ships an incident event to syslog.
Verification
# Confirm no agent processes survive
pgrep -f "claude.*claude-code-prod" && echo "FAIL: process survived" || echo "OK"
# Confirm credential file removed
ls -la /etc/agents/claude-code-prod/ | grep -E "(token|key|env)"
# (must produce no output)
# Confirm log entry shipped to SIEM
journalctl -t agent-incident --since "1 minute ago"
Common mistakes
- -
pkill -TERMinstead ofpkill -KILL. Daemonized agents ignore SIGTERM. - - Forgetting
systemctl stop. The service manager respawns the agent. - - Deleting the credential file but missing env-var credentials in already-running processes (the kill step handles this; do not skip it).
- - Pattern match too narrow:
pkill -f claude-code-prodmissespkill -f $AGENT_NAMEwhen the name has special chars.
Citation
NIST CSF 2.0 RS.MI-01 (incident contained), RS.MI-02 (incident eradicated). NIST SP 800-61 Rev. 2 (Computer Security Incident Handling Guide). NIST AI RMF MANAGE 4.1. OWASP ASI03, ASI10.
Primary failure modes
Documented, not hypothetical. A control whose bypass is undocumented is worse than no control, because somebody trusted it.
- daemonized agents survive pkill
- env-var credentials persist in already-running processes
Crosswalk
| NIST CSF 2 0 | RS.MI-01, RS.MI-02 |
|---|---|
| NIST AI RMF | MANAGE 4.1 |
| OWASP AGENTIC | ASI03, ASI10 |
| OTHER | NIST SP 800-61 Rev. 2 |
Cite this cell:
https://agenticcovenants.com/respond/identity/client-side/