Skip to content

Commit

Permalink
Clean up & add docs; fixes #72
Browse files Browse the repository at this point in the history
  • Loading branch information
bitprophet committed Nov 18, 2011
1 parent 0cc471f commit d40e820
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 5 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Expand Up @@ -46,3 +46,4 @@ Matt Chisholm
Mark Merritt
Max Arnold
Szymon Reichmann
Ben Davis
4 changes: 4 additions & 0 deletions docs/changelog.rst
Expand Up @@ -25,6 +25,10 @@ would have also been included in the 1.2 line.
Changelog
=========

* :feature:`72` SSH agent forwarding support has made it into Fabric's ssh
library, and hooks for using it have been added (enabled by default; use
:option:`-A` to disable.) Thanks to Ben Davis for porting an existing
Paramiko patch to `ssh` and providing the necessary tweak to Fabric.
* :bug:`230` Fix regression re: combo of no fabfile & arbitrary command use.
Thanks to Ali Saifee for the catch.
* :release:`1.3.2 <2011-11-07>`
Expand Down
14 changes: 14 additions & 0 deletions docs/usage/env.rst
Expand Up @@ -324,6 +324,20 @@ using key-based authentication.

.. versionadded:: 0.9.1

.. _no_agent_forward:

``no_agent_forward``
--------------------

**Default:** ``False``

If ``True``, disables the on-by-default forwarding of your local SSH agent to
the remote end.

.. versionadded:: 1.4.0

.. seealso:: :option:`-A`

.. _no_keys:

``no_keys``
Expand Down
9 changes: 8 additions & 1 deletion docs/usage/fab.rst
Expand Up @@ -83,13 +83,20 @@ below.

.. _optparse: http://docs.python.org/library/optparse.html

.. cmdoption:: -a
.. cmdoption:: -a, --no_agent

Sets :ref:`env.no_agent <no_agent>` to ``True``, forcing our SSH layer not
to talk to the SSH agent when trying to unlock private key files.

.. versionadded:: 0.9.1

.. cmdoption:: -A, --no-agent-forward

Sets :ref:`env.no_agent_forward <no_agent_forward>` to ``True``, disabling
agent forwarding.

.. versionadded:: 1.4.0

.. cmdoption:: --abort-on-prompts

Sets :ref:`env.abort_on_prompts <abort-on-prompts>` to ``True``, forcing
Expand Down
9 changes: 5 additions & 4 deletions fabric/operations.py
Expand Up @@ -13,9 +13,10 @@
import time
from glob import glob
from traceback import format_exc

from contextlib import closing

from ssh.agent import AgentClientProxy

This comment has been minimized.

Copy link
@cheshire

cheshire Nov 18, 2011

Hi,
This module is only in the development version of ssh library. Perhaps you should add ssh==dev as a dependency?

This comment has been minimized.

Copy link
@bitprophet

bitprophet Nov 18, 2011

Author Member

I'd just have to change it back when 'ssh' is officially released; I don't think it's worth the hassle. And anybody nabbing fabric==dev is implicitly in dangerous waters anyways re: things working 100% perfectly. Still, sorry if it caused you problems :(

EDIT: for longer release cycles, it might be worth doing, but I'm likely to put out ssh 1.8 in a day or two tops after one or two more folks gives fab==dev + ssh==dev a combined whirl.


from fabric.context_managers import settings, char_buffered
from fabric.io import output_loop, input_loop
from fabric.network import needs_host
Expand Down Expand Up @@ -752,9 +753,9 @@ def _execute(channel, command, pty=True, combine_stderr=None,
rows, cols = _pty_size()
channel.get_pty(width=cols, height=rows)

# request agent
from ssh.agent import AgentClientProxy
forward = AgentClientProxy(channel)
# Use SSH agent forwarding from 'ssh', unless user has turned it off.
if not env.no_agent_forward:
forward = AgentClientProxy(channel)

# Kick off remote command
if invoke_shell:
Expand Down
9 changes: 9 additions & 0 deletions fabric/state.py
Expand Up @@ -157,12 +157,21 @@ def _rc_path():
),

# Use -a here to mirror ssh(1) options.
# Note, much later on: well, no. ssh -a concerns agent *forwarding*. Sigh.
make_option('-a', '--no_agent',
action='store_true',
default=False,
help="don't use the running SSH agent"
),

# Another minor departure from SSH, due to above mixup: use -A to allow
# disabling of agent forwarding (which is on by default.)
make_option('-A', '--no-agent-forward',
action='store_true',
default=False,
help="don't forward local agent to remote end"
),

# No matching option for ssh(1) so just picked something appropriate.
make_option('-k', '--no-keys',
action='store_true',
Expand Down

0 comments on commit d40e820

Please sign in to comment.