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

Commands using agent forwarding hang #399

Closed
dylanahsmith opened this issue Sep 22, 2014 · 4 comments
Closed

Commands using agent forwarding hang #399

dylanahsmith opened this issue Sep 22, 2014 · 4 comments

Comments

@dylanahsmith
Copy link
Contributor

Version 1.15.0 introduced a regression with ssh agent forwarding which causes commands to hang when they use the forwarded agent. This bug wasn't present in version 1.14.1

We were experiencing this problem with fabric, which can be reproduced with the following script executed with fab -H $HOST test

from fabric.api import run, env
env.forward_agent = True
def test():
    run('ssh-add -L')

Fabric is using paramiko.agent.AgentRequestHandler(channel) to enable ssh agent forwarding, and I managed to reproduce the regression using paramiko directly:

import sys
import paramiko

host = sys.argv[1]
client = paramiko.SSHClient()
client.load_system_host_keys()
client.connect(host)
channel = client.get_transport().open_session()
forward = paramiko.agent.AgentRequestHandler(channel)
channel.exec_command('ssh-add -L')
stdout = channel.makefile('r')
stderr = channel.makefile_stderr('r')
for line in stdout:
    sys.stdout.write(line)
for line in stderr:
    sys.stderr.write(line)
channel.close()
forward.close()
client.close()
@dylanahsmith
Copy link
Contributor Author

@bitprophet I found commit 752507a was the first failing commit using git bisect.

@dylanahsmith
Copy link
Contributor Author

The regression came when resolving merge conflicts in that merge commit. The problem is that Transport.init changed the position of the gss_kex and gss_deleg_creds arguments, and SSHClient.connect constructs a Transport with positional arguments for gss_kex and gss_deleg_creds.

I'll write a pull request that creates the Transport with keyword arguments.

@bitprophet
Copy link
Member

@dylanahsmith Thanks for the awesomely detailed bug report - I'll get right on this!

@bitprophet
Copy link
Member

Rolling into the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants