Add (or document) the ability to SSH through bastion hosts, if possible
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 566
- Forks
- 163
- Avg merge
- 4h 51m
- Merged PRs (30d)
- 2
Description
This relates to #84. I'm not interested in using ssh-agent based key forwarding, but I would like to be able to jump through an intermediate host without relying on netcat.
I'm not sure how feasible this would be, but ideally you could do something like this:
let tcp = TcpStream::connect("bastion-host:22").unwrap();
let mut bastion_session = Session::new().unwrap();
bastion_session.set_tcp_stream(tcp);
bastion_session.handshake().unwrap();
bastion_session.userauth_password("username", "password").unwrap();
bastion_channel = bastion_session.channel_direct_tcpip("target-host", 22, None);
target_session = Session::new().unwrap();
// Here's the crux of it, and where I'm really unsure of how difficult this would be
target_session.set_tcp_stream(bastion_channel); // Or a stream from the bastion?
target_session.handshake.unwrap();
target_session.userauth_password("username", "password").unwrap();
// etcetera
This follows a pattern I've used with other SSH client libraries, e.g.
bastion_connection = await asyncssh.connect("bastion")
target_connection = await asyncssh.connect("target", tunnel=bastion_connection)
It seems like the issue is that a channel/stream doesn't implement the RawFd trait, so we can't pass that as a TCP stream to another session. Would it be possible to implement that trait on either the channel or stream?
I'm working on my first Rust project, so please forgive my ignorance here.
EDIT: I'm also waay too used to working in a high level language, because I did a bit of digging and I doubt this will be simple. Still, it would be good to know what it might look like to do this.
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
Review related issue #84 and the Session, Channel, TcpStream, and RawFd APIs involved in the example. Determine whether a channel or stream can serve as the transport for a second session, then define whether the outcome should be implemented support or documentation describing the feasible approach and limitations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- networking
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100