Skip to content

SSH Agent Forwarding With VS Code Remote-SSH #1593

Description

@timway
ISSUE TYPE
  • Bug Report
SUMMARY

Symbolic links are not followed when determining the volume mount paths for the SSH agent forwarding bits.

Running on Mac OS I add an SSH key with a passphrase into my SSH agent. Leveraging VS Code with the Remote-SSH plugin I forward the agent into remote host. This works fine, the remote host can run ssh-add -l and I see the key and am able to ssh into the managed node I want to use with ansible-navigator.

The VS Code Remote-SSH plugin sets up SSH_AUTH_SOCK to point to a file within the tmpdir configuration value in the plugin which seems to be /run/user/<uid-of-remote-host-user>. It essentially just creates a symbolic link to the normal file where the forwarded agent is placed by ssh.

ANSIBLE-NAVIGATOR VERSION
$ rpm -qi ansible-navigator
Name        : ansible-navigator
Version     : 3.4.1
Release     : 1.el8ap
Architecture: noarch
Install Date: Tue 08 Aug 2023 04:01:18 PM UTC
Group       : Unspecified
Size        : 1922971
License     : ASL 2.0
Signature   : RSA/SHA256, Thu 03 Aug 2023 05:49:14 PM UTC, Key ID 199e2f91fd431d51
Source RPM  : ansible-navigator-3.4.1-1.el8ap.src.rpm
Build Date  : Thu 03 Aug 2023 05:45:17 PM UTC
Build Host  : s390-064.build.eng.bos.redhat.com
Relocations : (not relocatable)
Packager    : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
Vendor      : Red Hat, Inc.
URL         : https://github.com/ansible/ansible-navigator
Summary     : A text-based user interface (TUI) for the Red Hat Ansible Automation Platform
Description :
A text-based user interface (TUI) for the Red Hat Ansible Automation Platform
CONFIGURATION
LOG FILE

VS Code Remote-SSH Log

[20:16:06.380] Updating $SSH_AUTH_SOCK: ln -f -s "/tmp/ssh-xkYbL0MKH1/agent.14010" "/run/user/1000/vscode-ssh-auth-sock-114491209"
STEPS TO REPRODUCE
  • Using MacOS, add an SSH key to the SSH agent with ssh-add -i ... command
  • Install VS Code and the Remote-SSH plugin
  • Use Remote-SSH to connect to a RHEL 8 system capable of running ansible-navigator (from the AAP 2.4 repos in my case)
  • Run ansible-navigator exec bash and inspect the SSH agent with ssh-add -l and notice it fails to connect.
EXPECTED RESULTS

I'd expect the SSH agent is forwarded into the VM correctly.

ACTUAL RESULTS

It fails to connect to the SSH agent specified by SSH_AUTH_SOCK in the environment.

ADDITIONAL INFORMATION

I know this is a bit of an esoteric configuration but I keep trying different ways to use SSH keys particularly ones protected by passphrases with ansible-navigator starting from Mac OS and am just continuously coming up empty.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugResearched, reproducible, committed to fix

    Type

    No type

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions