Add proxy_connect convenience function to SSHClient
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 9.9k
- Forks
- 2.1k
- PR merge metrics
- No merged PRs in 30d
Description
I would like to propose a convenience function for chaining ssh connections using a function in the SSHClient class. I'd propose something like the following:
def proxy_connect(self, hostname, port=SSH_PORT, **kwargs):
"""
Connect to an SSH server through the currently open connection. Keyword arguments
are the same as those for connect.
Note that the missing host key policy is coppied from the current client.
@return: A new SSHClient connection to the host.
@rtype: L{SSHClient}
"""
transport = self.get_transport()
kwargs['sock'] = transport.open_channel('direct-tcpip', (hostname, port), ('', 0))
ssh = SSHClient()
ssh.set_missing_host_key_policy(self._policy)
ssh.connect(hostname, port, **kwargs)
return ssh
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in the SSHClient implementation and trace get_transport(), open_channel(), connect(), and the missing-host-key policy. Review existing SSH connection behavior before adding the convenience entry point, then verify that it returns a usable client for a chained connection and preserves the current policy.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- networking
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100