From 49e93cb1a92fb86f815264a089a0db88e8b76bbc Mon Sep 17 00:00:00 2001 From: jwhur <57657645+JaewonHur@users.noreply.github.com> Date: Wed, 22 Apr 2026 14:12:06 -0700 Subject: [PATCH] Change guest ssh socket path (#1441) Changes ssh socket path in container to `/var/host-services/ssh-auth.sock` as the path `/run` (where the ssh socket is mounted initially) is often mounted again by init systems, and the ssh socket is hidden. ## Type of Change - [X] Bug fix - [ ] New feature - [ ] Breaking change - [ ] Documentation update ## Motivation and Context Makes ssh socket forwarding reliable. ## Testing - [X] Tested locally - [ ] Added/updated tests - [ ] Added/updated docs --- .../ContainerSandboxService/Server/SandboxService.swift | 2 +- Tests/CLITests/Subcommands/Run/TestCLIRunLifecycle.swift | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/Services/ContainerSandboxService/Server/SandboxService.swift b/Sources/Services/ContainerSandboxService/Server/SandboxService.swift index 2dd0c0f8..c91a822f 100644 --- a/Sources/Services/ContainerSandboxService/Server/SandboxService.swift +++ b/Sources/Services/ContainerSandboxService/Server/SandboxService.swift @@ -51,7 +51,7 @@ public actor SandboxService { private var processes: [String: ProcessInfo] = [:] private var socketForwarders: [SocketForwarderResult] = [] - private static let sshAuthSocketGuestPath = "/run/host-services/ssh-auth.sock" + private static let sshAuthSocketGuestPath = "/var/host-services/ssh-auth.sock" private static let sshAuthSocketEnvVar = "SSH_AUTH_SOCK" class ExitWaiter { diff --git a/Tests/CLITests/Subcommands/Run/TestCLIRunLifecycle.swift b/Tests/CLITests/Subcommands/Run/TestCLIRunLifecycle.swift index 6c017c49..4d797cad 100644 --- a/Tests/CLITests/Subcommands/Run/TestCLIRunLifecycle.swift +++ b/Tests/CLITests/Subcommands/Run/TestCLIRunLifecycle.swift @@ -189,14 +189,14 @@ class TestCLIRunLifecycle: CLITest { // Verify SSH_AUTH_SOCK is set to the expected guest path inside the container. let sshSockValue = try doExec(name: name, cmd: ["sh", "-c", "echo $SSH_AUTH_SOCK"]) #expect( - sshSockValue.trimmingCharacters(in: .whitespacesAndNewlines) == "/run/host-services/ssh-auth.sock", + sshSockValue.trimmingCharacters(in: .whitespacesAndNewlines) == "/var/host-services/ssh-auth.sock", "expected SSH_AUTH_SOCK to point to guest socket path" ) // Verify the forwarded socket file is present and is a socket. let socketCheck = try doExec( name: name, - cmd: ["sh", "-c", "[ -S /run/host-services/ssh-auth.sock ] && echo exists || echo missing"] + cmd: ["sh", "-c", "[ -S /var/host-services/ssh-auth.sock ] && echo exists || echo missing"] ) #expect( socketCheck.trimmingCharacters(in: .whitespacesAndNewlines) == "exists",