You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What happened: When opening an SSH session and running multiple commands within the same transport using something like Ruby's Net::SSH channels, Teleport only forwards the SSH agent for the first command - the environment variables are not set (and the socket is not present) for subsequent commands.
What you expected to happen: The SSH agent should be available for all commands in a session when SSH agent forwarding is enabled.
How to reproduce it (as minimally and precisely as possible):
Set up a Teleport cluster (example.gravitational.co here)
Run tsh login example.gravitational.co
Set up your ~/.ssh/config file with an appropriate ProxyCommand:
Host hostname
User username
Port 3022
ForwardAgent yes
ProxyCommand ssh -p 3023 %r@example.gravitational.co -s proxy:%h:%p
install the net-ssh Ruby gem (on Fedora this is provided by running dnf install rubygem-net-ssh or gem install net-ssh)
save this Ruby script as test.rb and run it with ruby test.rb (update the hostname and username near the top for your own test cluster):
Observe that the environment variables are different between the two runs - the first output has SSH_AUTH_SOCK and SSH_AGENT_PID set, the second does not:
First run
SSH_CONNECTION=1.2.3.4 37158 127.0.0.1 3022
SSH_AUTH_SOCK=/tmp/teleport-007586859/teleport-8.socket
SSH_TELEPORT_HOST_UUID=e2f9956f-232b-4135-8f4b-b8766ee5e04b
SSH_SESSION_WEBPROXY_ADDR=<proxyhost>:3080
SSH_AGENT_PID=8
SSH_CLIENT=1.2.3.4 37158 3022
SSH_TELEPORT_USER=example@gravitational.com
SSH_TELEPORT_CLUSTER_NAME=example.gravitational.co
Second run
SSH_CONNECTION=1.2.3.4 37158 127.0.0.1 3022
SSH_TELEPORT_HOST_UUID=e2f9956f-232b-4135-8f4b-b8766ee5e04b
SSH_SESSION_WEBPROXY_ADDR=<proxyhost>:3080
SSH_CLIENT=1.2.3.4 37158 3022
SSH_TELEPORT_USER=example@gravitational.com
SSH_TELEPORT_CLUSTER_NAME=example.gravitational.co
The Teleport logs also state that the agent is closing after this the first command: AgentServer(/tmp/teleport-007586859/teleport-8.socket) is closing teleagent/agent.go:104
Description
What happened: When opening an SSH session and running multiple commands within the same transport using something like Ruby's Net::SSH channels, Teleport only forwards the SSH agent for the first command - the environment variables are not set (and the socket is not present) for subsequent commands.
What you expected to happen: The SSH agent should be available for all commands in a session when SSH agent forwarding is enabled.
How to reproduce it (as minimally and precisely as possible):
example.gravitational.co
here)tsh login example.gravitational.co
~/.ssh/config
file with an appropriateProxyCommand
:net-ssh
Ruby gem (on Fedora this is provided by runningdnf install rubygem-net-ssh
orgem install net-ssh
)test.rb
and run it withruby test.rb
(update thehostname
andusername
near the top for your own test cluster):SSH_AUTH_SOCK
andSSH_AGENT_PID
set, the second does not:The Teleport logs also state that the agent is closing after this the first command:
AgentServer(/tmp/teleport-007586859/teleport-8.socket) is closing teleagent/agent.go:104
Full logs here:
Environment
Teleport version (use
teleport version
):Teleport Enterprise v4.2.6git:v4.2.6-0-gce1cbbf8 go1.13.2
Tsh version (use
tsh version
):Teleport v4.2.6 git:v4.2.6-0-gce1cbbf8 go1.13.2
OS (e.g. from
/etc/os-release
):Fedora 31
Where are you running Teleport? (e.g. AWS, GCP, Dedicated Hardware): GKE
The text was updated successfully, but these errors were encountered: