Repository navigation
feat(ssh-agent): nodkey ssh-agent forwards SSH logins to the broker - #62
Merged
Merged
Conversation
An SSH agent socket for plain ssh, git and Ansible; each signature request goes to the broker with its session-binds and the claimed context, and the answer is checked before ssh gets it. Closes #13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
nodkey ssh-agent [--socket PATH]serves an SSH agent socket on the agent's machine. Plainssh,gitand Ansible use it. The SSH keys stay on the broker; each signature request goes to the broker, which checks the real target host and asks the person.$XDG_RUNTIME_DIR/nodkey/agent.sock), mode 0600. Other users, and root, are refused withSO_PEERCRED. A lock file keeps a second agent from taking the socket. A stale socket is removed only if it is the user's and nothing answers. At most 128 connections.agent.ServeAgent, which writes every error to Go's global log). Strict parsing; adding, removing and locking keys, and unknown extensions, are refused.session-bind@openssh.commessages are kept (at most 2) and sent with each sign request, byte for byte with the key, the data and the flags. A waiting request is cancelled when ssh hangs up.sshand up to 3 parents, andNODKEY_REASONfrom the environment ofssh(no other variable), read through one open/proc/PIDdirectory with a 2 s deadline.nodkey run: only a final 200 that passesapi.ReadAnswer; the format and the signature are checked against the key and the data before ssh gets them; no retries; a deadline below sshd'sLoginGraceTime.Tests
The real OpenSSH 9.6
sshagainst an in-process server and against a realsshd, through the real broker service with the fake approver: approve, deny, expiry, broker down, a wrong signature or format from the broker, a third bind, key changes, other users (a root-only test with a real second user runs in the e2e job, #15), the socket modes, the lock, stale sockets, hang-ups with extra bytes, the connection cap, idle memory, stuck/procreads, signals. Four fuzz targets for the parsers. Stress runs with-count=10 -cpu 1,2,4andCI=truepass on Go 1.27 and 1.26.Docs
DESIGN.md sections 6 and 15; THREAT-MODEL.md T2, T12, and the new T30 and T31; AGENTS.md layout.
Review
Three rounds with the security-reviewer agent; the last said "ready to commit".
Fixed on the way:
/procreads had no deadline; two agents starting at once could remove each other's socket.Left for later issues: #61 (pin the peer process with a pidfd before reading
/proc).Closes #13