Skip to content

hardening: approve through the SSH agent - #74

Draft
sorah wants to merge 2 commits into
hardening/policy-approvalfrom
hardening/ssh-agent
Draft

sorah wants to merge 2 commits into
hardening/policy-approvalfrom
hardening/ssh-agent

Conversation

@sorah

@sorah sorah commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner

Implements docs/specs/013-ssh-agent.md.

  • ssh_agent_keys in authorization.json and the ssh-agent method; with keys registered the defaults become methods: ["ssh-agent", "platform"], approval_methods: ["ssh-agent"], and approval anchors record the keys
  • the agent answers REASON_CHALLENGE with a single-use challenge (60 s, bound to the peer process, action and request digest); the retry's SSHSIG (namespace co.0w0.mairu.authorize) must come from a registered key, with the user-presence flag for sk- keys (and user verification when required)
  • the client relays the challenge to SSH_AUTH_SOCK through a minimal agent client and retries, in exec (preflight and ECS), credential-process, policy approve and unlock --tool; it falls back to polkit and pkttyagent
  • gate 2 holds fetched credentials while the client signs; mairu lock drops outstanding challenges
  • doctor shows SSH_AUTH_SOCK reachability and registered keys; README covers tmux ~/.ssh/rc symlinks

Uses ssh-key 0.6 / ssh-encoding. The agent client wraps the signature exactly as returned, since ssh-key 0.6 mis-encodes sk-ecdsa signatures. rsa 0.9 (RUSTSEC-2023-0071) is used for verification only.

Verified in Docker (74 checks) with non-sk keys (no FIDO hardware): bootstrap through polkit, signatures approving exec and gate 2, fallbacks on missing/stale agents, ssh -A localhost into tmux, anchored key changes, mairu lock invalidating a pending signature. sk- flag handling and replay are unit-tested.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Dg17LE9aWqsb1VBUCVcKLM

@sorah
sorah added this pull request to stack #63 October 31, 2026 02:41
@sorah sorah changed the title hardening/ssh agent hardening: approve through the SSH agent Oct 31, 2026
sorah and others added 2 commits October 31, 2026 11:44
Keys registered as ssh_agent_keys in authorization.json let the agent
approve a request by an SSHSIG signature from the SSH agent at
$SSH_AUTH_SOCK, usually forwarded. The agent answers with a single-use
challenge bound to the requesting process and the request digest; the
client signs it through its SSH agent and retries. sk- signatures must
assert user presence, and user verification when required. Declines
and stale sockets fall back to the next method.

The approval anchor now records ssh-agent and the registered keys, so
after the first registration only a signature by an anchored key
approves the next policy change. Outstanding challenges hold their
check open, keeping approvals and credential checks apart.

The SSH agent protocol client is our own: the relay needs only two
requests, and the signature blob is wrapped as the agent returned it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dg17LE9aWqsb1VBUCVcKLM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dg17LE9aWqsb1VBUCVcKLM
@sorah
sorah force-pushed the hardening/ssh-agent branch from c1f3efc to 2e4e0c9 Compare October 31, 2026 02:44

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant