Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSH Agent Forwarding With MacOS and Docker Desktop #1292

Open
timway opened this issue Aug 10, 2023 · 0 comments
Open

SSH Agent Forwarding With MacOS and Docker Desktop #1292

timway opened this issue Aug 10, 2023 · 0 comments
Labels
needs_triage New item that needs to be triaged

Comments

@timway
Copy link

timway commented Aug 10, 2023

This impacts only Docker Desktop on MacOS when using ansible-runner in process isolation mode.

The ENV path of cli_mounts in _handle_automounts does not work with Docker Desktop on MacOS. Docker Desktop wants to share a socket that is local to its internals and not on the MacOS system; /run/host-services/ssh-auth.sock. Because this file doesn't exist it fails the first check in _update_volume_mount_paths. Because it does not get added to the list of volumes it cannot be consumed by the container.

if src_mount_path is None or not os.path.exists(src_mount_path):
logger.debug(f"Source volume mount path does not exist: {src_mount_path}")
return

This is documented by Docker Desktop at https://docs.docker.com/desktop/networking/#ssh-agent-forwarding and I have a similar bug open with ansible-navigator via ansible/ansible-navigator#1591 as that also checks the file path in a similar way.

The socket is mounted as:

$ ls -lahZ /run/host-services/ssh-auth.sock 
srwxr-xr-x 1 root root ? 0 Aug  7 14:00 /run/host-services/ssh-auth.sock

It is only writable by root so this feature requires root inside the container. I know setting the default container user to root could be problematic so it will require discussion to determine whether root inside the container is a good default because it enables ssh-agent to work or if that should be a required step by those wishing to use ssh-agent and is there for simply documented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs_triage New item that needs to be triaged
Projects
None yet
Development

No branches or pull requests

1 participant