feat: serve the caller's ssh-agent to an identity #49
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/host-ssh-agent"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
Some operators keep their SSH keys only in an agent, such as a
hardware token or a password manager's agent, so they have no private
key file to copy into an identity's
key. The only SSH route today isthat
key, andSSH_AUTH_SOCKis filtered out of every env file. A--mountof the socket plusIdentityAgentgetssshworking, butssh-keygen -Y signdoesn't find the agent, so SSH-signed commitsfail.
What changed
AZKABAN_SSH_AGENT=hostlaunches withthe caller's
$SSH_AUTH_SOCKmounted at/ssh-agentandSSH_AUTH_SOCK=/ssh-agentset in the container. No per-launch agentstarts, and the value of the caller's variable never reaches the
container.
or empty, isn't an absolute path to a socket, or holds a
:; when theidentity also has a
key; or when the value isn'thost.claude: identity: me: host ssh-agent /run/user/1000/….key. One line says so andthe launch goes on without it.
docs/bot-accounts.mdgains "Your own agent". The README lists thecontrol and updates the security model, caller environment and macOS
notes, and the env example lists the line.
Left out: a
--ssh-agentflag and an identityagentfile. The controlis per identity, so bot identities never get your agent, and the
workspace
.envcan't turn it on, because it already rejects everyAZKABAN_name.How to verify
On a Linux host with an agent running:
Expect
identity: me: host ssh-agent <socket>on stderr and-v <socket>:/ssh-agent -e SSH_AUTH_SOCK=/ssh-agentin the printedcommand. Running
SSH_AUTH_SOCK= claude . --identity meinstead stopswith
AZKABAN_SSH_AGENT=host needs SSH_AUTH_SOCK, which is not set.Checks run on the tip:
make lint,.agents/hooks/shellcheck.sh repo(41 files clean) and
make test(0 failures) all pass. Each foldedcommit also passed
make lint && make test. The new tests fail onmaster's code at their behavior assertions. Not run:
make test-e2e,which needs real rootless Podman, so no real agent socket has been
mounted.
Considerations
agent, and can remove keys or lock the agent, for as long as it runs.
The docs say to keep such an identity for work you watch.
--mount …:/ssh-agentbeside the control isn't caughtbefore launch, and Podman refuses the duplicate destination. The docs
say to drop such a mount.
_azk_resolve_host_agentisunevenly wrapped was set aside as low.