Skip to content

Commit

Permalink
Adding in SSH forwarding to spur using Paramiko's AgentRequestHandler (
Browse files Browse the repository at this point in the history
  • Loading branch information
WamboJambo committed Aug 28, 2018
1 parent 0438be8 commit 2c7070c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions spur/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ def spawn(self, command, *args, **kwargs):
channel = self._get_ssh_transport().open_session()
except EOFError as error:
raise self._connection_error(error)
paramiko.agent.AgentRequestHandler(channel)
if use_pty:
channel.get_pty()
channel.exec_command(command_in_cwd)
Expand Down
7 changes: 7 additions & 0 deletions tests/ssh_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ def an_open_socket_can_be_used_for_ssh_connection_with_sock_argument():
assert_equal(b"hello\n", result.output)


@istest
def ssh_agent_key_forwarding_successful():
with create_ssh_shell(missing_host_key=spur.ssh.MissingHostKey.accept) as shell:
auth_sock = shell.run(["printenv", "SSH_AUTH_SOCK"])
assert auth_sock is not None


def _create_shell_with_wrong_port(**kwargs):
return spur.SshShell(
username=USERNAME,
Expand Down

0 comments on commit 2c7070c

Please sign in to comment.