Repository navigation
fix: resolve symlinked SSH agent sockets for ssh_agent_upstream, fixes #8961 - #8963
Conversation
|
Download this PR's build for your OS and architecture with: ddev utility download-ddev --pr 8963Or download the artifact for your OS and architecture directly:
See Testing a PR. |
stasadev
left a comment
There was a problem hiding this comment.
Thanks, the symlink resolution and the label change look right to me. One small thing, not a blocker:
ddev auth ssh can now fail on Linux with Docker Desktop, Colima, or Lima. With ssh_agent_upstream=host, those providers return a socket inside their VM (/run/host-services/ssh-auth.sock, or Lima's forwarded socket). CheckSSHAgentUpstreamListening() only skips the check when the OS isn't Linux, so on Linux it dials that path on the host, gets connect: no such file or directory, and ddev auth ssh now stops there. Before this PR it was only a warning. Docker Desktop for Linux isn't officially supported and Colima/Lima on Linux are rare, so this is minor.
Skipping provider sockets based on the socket instead of the OS fixes it, and also removes the same false warning from ddev start:
if globalconfig.DdevGlobalConfig.SSHAgentUpstream == "host" &&
(upstream == hostServicesSSHAuthSock || dockerutil.IsLima()) {
return nil
}On macOS, host always returns a provider socket or an error, so this covers the old !nodeps.IsLinux() case too.
Smaller notes, take or leave:
- A dangling symlink set as an explicit
ssh_agent_upstream(for example to~/.1password/agent.sockwhile 1Password isn't running) gets the "after VS Code or SSH reconnects" message. If the target's directory still exists, the agent is more likely just not started yet. resolveSSHAgentSocket()treats anyEvalSymlinkserror on a symlink as stale. Checkingerrors.Is(err, fs.ErrNotExist)would keep a permission error from showing up as "no longer exists".
Claude Code ran TestSSHAgentUpstreamSocketPaths, TestCheckSSHAgentUpstreamListening, and TestSSHAgentUpstreamMount on this branch, and they pass. It didn't run the Docker integration tests.
🤖 Developed with assistance from Claude Code
af9a2cc to
9b753cf
Compare
|
I tested this PR with Docker Desktop for Linux (4.96.0, Ubuntu 26.04 on an amd64 EC2 instance) and with docker-ce on Ubuntu 26.04 arm64, using the branch including "fix: stop Docker Desktop for Linux,
docker-ce on Linux:
Problems with Docker Desktop for Linux found along the way (not caused by DDEV)
For DDEV users on Linux, docker-ce remains the better choice. 🤖 Developed with assistance from Claude Code |
|
I also tested this PR with Colima on Linux (Colima with Lima 2.2.1 and QEMU/KVM, Ubuntu 26.04 amd64 on EC2), using
Colima on Linux problems found along the way (not caused by DDEV)
As with Docker Desktop, docker-ce is the better choice on Linux. Colima on Linux: the router's ports 80 and 443 don't reach the host
Either fix works: # Let unprivileged users bind from port 80 up (needs sudo), then let Lima retry the forwards
echo 'net.ipv4.ip_unprivileged_port_start=80' | sudo tee /etc/sysctl.d/99-lima-ports.conf
sudo sysctl --system
colima stop && colima start
# Or move DDEV's router to high ports (URLs become https://<project>.ddev.site:8443)
ddev config global --router-http-port=8080 --router-https-port=8443
ddev restartRootless Docker and Podman hit the same limit, but there the container start fails with an error, and DDEV's install docs set the sysctl. 🤖 Developed with assistance from Claude Code |
|
I also tested this PR with Lima on Linux (Lima 2.2.1, QEMU 11.1.2 with KVM, Ubuntu 26.04 amd64 on EC2), using
Lima on Linux: templates and mount typesThe macOS recipe in our docs uses Results with a Drupal 11 project, timing
So on Linux, use Lima on Linux: the router's ports 80 and 443As with Colima, Lima forwards published ports to the host with 🤖 Developed with assistance from Claude Code |
|
The findings from testing this PR on Docker Desktop for Linux, Colima, and Lima are collected, with more detail and the test scripts, in rfay/docker-provider-notes. It's meant to outlive this PR: setup recipes, SSH agent behavior for each provider, and failure modes such as the Docker Desktop deadlock, for setups too obscure for the DDEV docs. 🤖 Developed with assistance from Claude Code |
## Short Summary (TL;DR) After the router starts and is healthy, `ddev start` now checks that the router's published ports answer on the host, and warns when one refuses connections, so a provider that quietly fails to forward a port no longer looks like a successful start. ## The Issue While testing #8963 with Colima and Lima on Linux, `ddev start` succeeded and the router was healthy, but the project URL didn't answer. Lima forwards published ports to the host with `ssh -L` as the user, and Linux doesn't let users bind ports below `net.ipv4.ip_unprivileged_port_start` (1024 by default), so ports 80 and 443 failed. Lima logged it as "negligible", and nothing told the user. DDEV checks before starting that the ports are free, and the router's health check runs inside the container, so nothing checked that the ports answer on the host. ## How This PR Solves The Issue - `netutil.IsPortRefused()` reports whether a connection to a port on a loopback Docker IP is actively refused. Timeouts, non-loopback Docker hosts, and other errors count as "not refused", so remote Docker, WSL2 mirrored-mode timeouts, and security software that accepts every connection can't cause a false warning. - After a freshly started router becomes healthy, `warnUnreachableRouterPorts()` dials each published host port, retrying for up to 5 seconds because Lima sets up forwards shortly after the container starts. It warns, rather than failing, since the router itself is fine. - A new troubleshooting section, "Router Ports Not Reachable", covers the warning and the Lima and Colima fix. This is a general check, not one aimed at Lima: any provider whose port forwarding fails after the container starts now gets reported. ## Manual Testing Instructions On Linux with Lima or Colima (with KVM), a router port below `net.ipv4.ip_unprivileged_port_start` reproduces it: ```bash ddev utility download-ddev --pr 8990 export PATH="$HOME/tmp/ddev-download-ddev/pr-8990:$PATH" sysctl net.ipv4.ip_unprivileged_port_start # 1024 by default ddev config global --router-http-port=79 --router-https-port=442 ddev start # Expect: "ddev-router is running, but nothing answers on host port(s) 79, 442 ..." ddev poweroff ddev config global --router-http-port=80 --router-https-port=443 ``` On any supported provider, `ddev start` should show no new warning. See https://ddev--8990.org.readthedocs.build/en/8990/users/usage/troubleshooting/#router-ports-not-reachable ## Automated Testing Overview `TestIsPortRefused` checks a listening port and the same port after it closes. The check runs on every router start in the existing integration tests, so a false warning on any CI provider would show up in their output. 🤖 Developed with assistance from [Claude Code](https://claude.ai/code) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ddev#8961 ## Short Summary (TL;DR) `ssh_agent_upstream` now follows a symlinked agent socket, such as VS Code Remote's `/tmp/vscode-ssh-auth-sock-*`, so containers can reach the agent, and `ddev auth ssh` explains a dead socket in one message. ## The Issue - Fixes ddev#8961 DDEV mounted the directory that held the socket path it was given. When that path is a symlink, the container gets the symlink but not its target, so the relay can't reach the agent even though the host-side check passes. The `~/.ssh/rc` stable-symlink recipe also ended up mounting all of `~/.ssh`. ## How This PR Solves The Issue - `SSHAgentUpstreamSocket()` resolves symlinks for `host` on Linux and for explicit paths, so DDEV mounts the real socket's directory. The container label stores the resolved path, so a VS Code reconnect recreates `ddev-ssh-agent`. The provider sockets used by Docker Desktop, OrbStack, Colima, and Lima are unchanged. - A symlink whose target is gone returns `ErrSSHAgentSocketStale`, with a message saying this happens after VS Code or SSH reconnects, instead of the raw `connect` error. - `ddev auth ssh` fails with a single message when the upstream is stale or not listening, before it recreates the container. `ddev start` still only warns. ## Manual Testing Instructions On a Linux machine reached through VS Code Remote-SSH or Coder's VS Code extension, with agent forwarding (for example 1Password) working in the VS Code terminal: ```bash ddev utility download-ddev --pr 8963 export PATH="$HOME/tmp/ddev-download-ddev/pr-8963:$PATH" ls -l $SSH_AUTH_SOCK # /tmp/vscode-ssh-auth-sock-NNN -> /tmp/auth-agentNNN/listener.sock ddev config global --ssh-agent-upstream=host ddev auth ssh # Expect "Containers use the SSH agent at /tmp/auth-agentNNN/listener.sock" and your keys SSH_AUTH_SOCK=/tmp/vscode-ssh-auth-sock-OLD ddev auth ssh # a symlink left from an earlier connection # Expect one error saying it points to an agent socket that no longer exists ``` See the Linux tip in https://ddev--8963.org.readthedocs.build/en/8963/users/usage/cli/#using-an-existing-ssh-agent ## Automated Testing Overview - `TestSSHAgentUpstreamSocketPaths` checks that a symlink resolves to the target socket and its directory mount, and that a dangling symlink returns `ErrSSHAgentSocketStale`. - `TestSSHAgentUpstream` now points `SSH_AUTH_SOCK` at a symlink in another directory and checks that the container lists the keys. - `TestCmdAuthSSHUpstream` checks `ddev auth ssh` through a symlink, with a stopped agent, and with a dangling symlink. 🤖 Developed with assistance from [Claude Code](https://claude.ai/code) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…et-started agent's symlink With ssh_agent_upstream=host on Linux, Docker Desktop, Colima, and Lima return a socket inside their VM, which the host can't dial, so `ddev auth ssh` failed there. The check is now skipped based on the socket rather than the OS, which matches the old behavior on macOS. A dangling symlink whose target directory still exists, such as 1Password's socket before the app starts, now relays to the target instead of reporting a stale socket, and only a missing target counts as stale rather than any resolution error. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…sh` can't list keys [skip buildkite] Without --ssh-agent, Colima forwards no agent, and Docker creates /run/host-services/ssh-auth.sock as an empty directory, so the existing "make sure that agent is running" advice pointed at the wrong thing. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…he socket's directory remains Removing only the socket leaves its directory, which now means an agent that hasn't started, so the stale case points the symlink into a missing directory instead. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…answers Docker Desktop relays the SSH_AUTH_SOCK it captured at startup, and when that agent is gone its forwarder holds the connection open rather than failing, so `ddev auth ssh` waited forever. Listing keys now gives up after two minutes, long enough to unlock 1Password, prints a notice after five seconds, and on Docker Desktop says how to restart it with the current agent. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ktop Docker Desktop relays the SSH_AUTH_SOCK it started with, so a forwarded agent's per-login socket never reaches it. Starting Docker Desktop once on a fixed path that ~/.ssh/rc repoints at each login works without restarts, tested on Docker Desktop for Linux and macOS. The macOS timeout hint now suggests `docker desktop restart`, because quitting the app with osascript left the backend running with its VM stopped. Co-Authored-By: Claude Opus 5.5 <[email protected]>
38aced6 to
1c224a3
Compare
## Short Summary (TL;DR) Adds the DDEV v1.25.5 release post, with before/after recordings of the rebuilt `ddev tui`, and records how to make such recordings in the `blog-images` skill. The post explains that the PHP fixes for CVE-2026-109618 and CVE-2026-109619 matter locally only with `ddev share` or casual hosting, and that production servers need the PHP update. ## How This PR Solves The Issue The post follows the v1.25.4 one and the release notes in ddev/ddev#8926. The three `ddev tui` WebPs stack v1.25.4 above v1.25.5 and were recorded with VHS against demo projects in an isolated global config; their tapes and ffmpeg filter graphs are in `public/img/blog/2026/10/vhs/` so they can be re-recorded. The `blog-images` skill gets a new `gif-comparison.md` with what took several attempts to get right for these recordings: demo projects in an isolated `DDEV_XDG_CONFIG_HOME` instead of real ones, a font size that stays readable after the blog scales the image, short clips per feature with captions shown before each key, and timing captions from ffmpeg scene detection, because VHS sleeps do not match video time. ## Manual Testing Instructions Open `https://pr-759.ddev-com-fork-previews.pages.dev/blog/release-v1-25-5/` and compare it with the v1.25.4 post at https://ddev.com/blog/release-v1-25-4/. Check that the three `ddev tui` recordings play and are readable at the column width, and that the `ddev launch --qr` screenshot shows the whole QR code. ## Release/Deployment Notes Before publishing, replace the `8.5.XX`-style PHP versions and the PHP announcement link, check the PR count, and drop the Ctrl-C and symlinked agent socket sentences if ddev/ddev#8954 or ddev/ddev#8963 don't make the release. 🤖 Developed with assistance from [Claude Code](https://claude.ai/code) Co-Authored-By: Claude Opus 5.5 <[email protected]>
## Short Summary (TL;DR) Adds the DDEV v1.25.5 release post, with before/after recordings of the rebuilt `ddev tui`, and records how to make such recordings in the `blog-images` skill. The post explains that the PHP fixes for CVE-2026-109618 and CVE-2026-109619 matter locally only with `ddev share` or casual hosting, and that production servers need the PHP update. ## How This PR Solves The Issue The post follows the v1.25.4 one and the release notes in ddev/ddev#8926. The three `ddev tui` WebPs stack v1.25.4 above v1.25.5 and were recorded with VHS against demo projects in an isolated global config; their tapes and ffmpeg filter graphs are in `public/img/blog/2026/10/vhs/` so they can be re-recorded. The `blog-images` skill gets a new `gif-comparison.md` with what took several attempts to get right for these recordings: demo projects in an isolated `DDEV_XDG_CONFIG_HOME` instead of real ones, a font size that stays readable after the blog scales the image, short clips per feature with captions shown before each key, and timing captions from ffmpeg scene detection, because VHS sleeps do not match video time. ## Manual Testing Instructions Open `https://pr-759.ddev-com-fork-previews.pages.dev/blog/release-v1-25-5/` and compare it with the v1.25.4 post at https://ddev.com/blog/release-v1-25-4/. Check that the three `ddev tui` recordings play and are readable at the column width, and that the `ddev launch --qr` screenshot shows the whole QR code. ## Release/Deployment Notes Before publishing, replace the `8.5.XX`-style PHP versions and the PHP announcement link, check the PR count, and drop the Ctrl-C and symlinked agent socket sentences if ddev/ddev#8954 or ddev/ddev#8963 don't make the release. 🤖 Developed with assistance from [Claude Code](https://claude.ai/code) Co-Authored-By: Claude Opus 5.5 <[email protected]>
## Short Summary (TL;DR) Adds the DDEV v1.25.5 release post, with before/after recordings of the rebuilt `ddev tui`, and records how to make such recordings in the `blog-images` skill. The post explains that the PHP fixes for CVE-2026-109618 and CVE-2026-109619 matter locally only with `ddev share` or casual hosting, and that production servers need the PHP update. ## How This PR Solves The Issue The post follows the v1.25.4 one and the release notes in ddev/ddev#8926. The three `ddev tui` WebPs stack v1.25.4 above v1.25.5 and were recorded with VHS against demo projects in an isolated global config; their tapes and ffmpeg filter graphs are in `public/img/blog/2026/10/vhs/` so they can be re-recorded. The `blog-images` skill gets a new `gif-comparison.md` with what took several attempts to get right for these recordings: demo projects in an isolated `DDEV_XDG_CONFIG_HOME` instead of real ones, a font size that stays readable after the blog scales the image, short clips per feature with captions shown before each key, and timing captions from ffmpeg scene detection, because VHS sleeps do not match video time. ## Manual Testing Instructions Open `https://pr-759.ddev-com-fork-previews.pages.dev/blog/release-v1-25-5/` and compare it with the v1.25.4 post at https://ddev.com/blog/release-v1-25-4/. Check that the three `ddev tui` recordings play and are readable at the column width, and that the `ddev launch --qr` screenshot shows the whole QR code. ## Release/Deployment Notes Before publishing, replace the `8.5.XX`-style PHP versions and the PHP announcement link, check the PR count, and drop the Ctrl-C and symlinked agent socket sentences if ddev/ddev#8954 or ddev/ddev#8963 don't make the release. 🤖 Developed with assistance from [Claude Code](https://claude.ai/code) Co-Authored-By: Claude Opus 5.5 <[email protected]>
## Short Summary (TL;DR) Adds the DDEV v1.25.5 release post, with before/after recordings of the rebuilt `ddev tui`, and records how to make such recordings in the `blog-images` skill. The post explains that the PHP fixes for CVE-2026-109618 and CVE-2026-109619 matter locally only with `ddev share` or casual hosting, and that production servers need the PHP update. ## How This PR Solves The Issue The post follows the v1.25.4 one and the release notes in ddev/ddev#8926. The three `ddev tui` WebPs stack v1.25.4 above v1.25.5 and were recorded with VHS against demo projects in an isolated global config; their tapes and ffmpeg filter graphs are in `public/img/blog/2026/10/vhs/` so they can be re-recorded. The `blog-images` skill gets a new `gif-comparison.md` with what took several attempts to get right for these recordings: demo projects in an isolated `DDEV_XDG_CONFIG_HOME` instead of real ones, a font size that stays readable after the blog scales the image, short clips per feature with captions shown before each key, and timing captions from ffmpeg scene detection, because VHS sleeps do not match video time. ## Manual Testing Instructions Open `https://pr-759.ddev-com-fork-previews.pages.dev/blog/release-v1-25-5/` and compare it with the v1.25.4 post at https://ddev.com/blog/release-v1-25-4/. Check that the three `ddev tui` recordings play and are readable at the column width, and that the `ddev launch --qr` screenshot shows the whole QR code. ## Release/Deployment Notes Before publishing, replace the `8.5.XX`-style PHP versions and the PHP announcement link, check the PR count, and drop the Ctrl-C and symlinked agent socket sentences if ddev/ddev#8954 or ddev/ddev#8963 don't make the release. 🤖 Developed with assistance from [Claude Code](https://claude.ai/code) Co-Authored-By: Claude Opus 5.5 <[email protected]>
Short Summary (TL;DR)
ssh_agent_upstreamnow follows a symlinked agent socket, such as VS Code Remote's/tmp/vscode-ssh-auth-sock-*, so containers can reach the agent, andddev auth sshexplains a dead socket in one message.The Issue
DDEV mounted the directory that held the socket path it was given. When that path is a symlink, the container gets the symlink but not its target, so the relay can't reach the agent even though the host-side check passes. The
~/.ssh/rcstable-symlink recipe also ended up mounting all of~/.ssh.How This PR Solves The Issue
SSHAgentUpstreamSocket()resolves symlinks forhoston Linux and for explicit paths, so DDEV mounts the real socket's directory. The container label stores the resolved path, so a VS Code reconnect recreatesddev-ssh-agent. The provider sockets used by Docker Desktop, OrbStack, Colima, and Lima are unchanged.ErrSSHAgentSocketStale, with a message saying this happens after VS Code or SSH reconnects, instead of the rawconnecterror.ddev auth sshfails with a single message when the upstream is stale or not listening, before it recreates the container.ddev startstill only warns.Manual Testing Instructions
On a Linux machine reached through VS Code Remote-SSH or Coder's VS Code extension, with agent forwarding (for example 1Password) working in the VS Code terminal:
See the Linux tip in https://ddev--8963.org.readthedocs.build/en/8963/users/usage/cli/#using-an-existing-ssh-agent
Automated Testing Overview
TestSSHAgentUpstreamSocketPathschecks that a symlink resolves to the target socket and its directory mount, and that a dangling symlink returnsErrSSHAgentSocketStale.TestSSHAgentUpstreamnow pointsSSH_AUTH_SOCKat a symlink in another directory and checks that the container lists the keys.TestCmdAuthSSHUpstreamchecksddev auth sshthrough a symlink, with a stopped agent, and with a dangling symlink.🤖 Developed with assistance from Claude Code
Co-Authored-By: Claude Opus 5.5 [email protected]