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 key forwarding #72

Closed
bitprophet opened this issue Aug 19, 2011 · 10 comments
Closed

SSH key forwarding #72

bitprophet opened this issue Aug 19, 2011 · 10 comments

Comments

@bitprophet
Copy link
Member

Description

Paramiko doesn't support this feature yet. Either add it to Paramiko/our fork of Paramiko, or do some horrible workaround like a subprocess doing ssh -A -N <env.host_string> (if that would even work correctly -- would the key forwarded by that connection be usable by a Paramiko connection?)


See also this LincolnLoop blog post which uses a "route stuff through local()" approach. Not a panacea (doesn't mesh with actual execution strategy; won't pick up any of the context managers like cd(); etc) but still worth investigating as a temporary workaround.


Originally submitted by Jeff Forcier (bitprophet) on 2009-10-25 at 07:05pm EDT

Relations

@ghost ghost assigned bitprophet Aug 19, 2011
@bitprophet
Copy link
Member Author

Charles Leifer (coleifer) posted:


I'm using the lincolnloop approach with a small tweak to use the context managers::

def run(command, shell=True, pty=True):
    """
    Helper function.
    Runs a command with SSH agent forwarding enabled.

    Note:: Fabric (and paramiko) can't forward your SSH agent. 
    This helper uses your system's ssh to do so.
    """
    real_command = command
    if shell:
        cwd = env.get('cwd', '')
        if cwd:
            cwd = 'cd %s && ' % _shell_escape(cwd)
        real_command = '%s "%s"' % (env.shell,
            _shell_escape(cwd + real_command))
    if output.debug:
        print("[%s] run: %s" % (env.host_string, real_command))
    elif output.running:
        print("[%s] run: %s" % (env.host_string, command))
    local("ssh -A %s '%s'" % (env.host_string, real_command))

on 2010-05-08 at 08:23pm EDT

@bitprophet
Copy link
Member Author

Antti Kaihola (akaihola) posted:


Paramiko seems to have a ticket and a patch for this.


on 2010-11-26 at 03:56am EST

@bitprophet
Copy link
Member Author

Johan Charpentier (cyberj) posted:


The previous pull request is closed. The new paramiko's pull request using the same patch is here

But robey need some tests with this patch and I don't know how to test this.

So, if people want to see this issue solved, feel free to improve the pull request with some tests :)

After this pull request, its easy to patch Fabric code


on 2011-06-19 at 08:45am EDT

@tobami
Copy link

tobami commented Sep 29, 2011

We would also like to have this feature for LittleChef. Let's hope paramiko gets it working soon.

We track the feature ourselves here: tobami/littlechef#59

@bendavis78
Copy link

I'm confused on the status of this. From the comment on Aug 18, it seems like all this needs is testing in order for it to be merged in? Or is this being worked on in the new ssh library?

@bendavis78
Copy link

Never mind, found this discussion. I suppose I can try to get the pull request mentioned above working with the new ssh library.

@bendavis78
Copy link

Ok, I forked the ssh library and ported over the pull request mentioned above. Just had to fix a couple of conflicts, but nothing major.

bitprophet/ssh#1

If anyone knows a good way to write tests for this, that'd be great. At the very least I guess it would be good for people to test it out and provide feedback. If anyone wants to try it out right now, you can install ssh from my fork, and then install fabric from my fork (which just adds the couple of lines needed).

@jravetch
Copy link

jravetch commented Jan 6, 2012

Is this fix implemented in 1.3.3 or the next release?

@bitprophet
Copy link
Member Author

"Feature" issues are only released in minor releases; this isn't exactly a bugfix :) see Development for how we release stuff.

Or just look at the Milestone field here on Github ;) it's marked for 1.4. I expect 1.3.4 and 1.4 to be out relatively close to each other, probably within a week or two depending on how my day job goes.

bitprophet added a commit that referenced this issue Jan 17, 2012
Re #72; the related ssh change fixes CPU usage issues.
@cjw296
Copy link

cjw296 commented Jan 24, 2012

Any idea when 1.4 is going to land?

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

No branches or pull requests

5 participants