Commit 3fde392
authored
fix(start-ssh-agent): support OpenSSH 10.1+ socket location (#183)
### Description
Since Git for Windows upgraded to OpenSSH 10.2.P1 (which includes
changes from OpenSSH 10.1), the `start-ssh-agent.cmd` script fails to
locate ssh-agent sockets.
### Root Cause
OpenSSH 10.1 moved agent sockets from `/tmp` to `~/.ssh/agent/` as a
**security improvement**. From the [OpenSSH 10.1 release
notes](https://www.openssh.org/txt/release-10.1):
> ssh-agent(1), sshd(8): move agent listener sockets from /tmp to under
~/.ssh/agent for both ssh-agent(1) and forwarded sockets in sshd(8).
This ensures processes that have restricted filesystem access that
includes /tmp do not ambiently have the ability to use keys in an agent.
### Proposed Fix
This PR updates the script to search `%USERPROFILE%\.ssh\agent\` instead
of `%TEMP%\ssh-*` to align with OpenSSH's new default socket location.
### Why not use `-T`?
The `-T` flag exists to force the old `/tmp` location but would revert
the security improvement. The proper fix is updating the script to match
OpenSSH's new default.
This fixes git-for-windows/git#60842 files changed
+6
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
52 | 50 | | |
53 | 51 | | |
54 | 52 | | |
| |||
0 commit comments