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

Adding in SSH forwarding to spur using Paramiko's AgentRequestHandler #81

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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