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

Question: How do I create a hopped ssh session via a tunnel? #27

Open
SnoCold opened this issue Aug 26, 2024 · 0 comments
Open

Question: How do I create a hopped ssh session via a tunnel? #27

SnoCold opened this issue Aug 26, 2024 · 0 comments

Comments

@SnoCold
Copy link

SnoCold commented Aug 26, 2024

Hi,
I was going through the code and found this method

pub fn [open_forward](https://docs.rs/libssh-rs/latest/libssh_rs/struct.Channel.html#method.open_forward)(
    &self,
    remote_host: &[str](https://doc.rust-lang.org/nightly/std/primitive.str.html),
    remote_port: [u16](https://doc.rust-lang.org/nightly/std/primitive.u16.html),
    source_host: &[str](https://doc.rust-lang.org/nightly/std/primitive.str.html),
    source_port: [u16](https://doc.rust-lang.org/nightly/std/primitive.u16.html)
) -> [SshResult](https://docs.rs/libssh-rs/latest/libssh_rs/type.SshResult.html)<[()](https://doc.rust-lang.org/nightly/std/primitive.unit.html)>

I am interested in creating an ssh tunnel via a bastion host to remote server e.g.
ssh -l localhost:1234:192.168.1.1:22 root@bastion

where 192.168.1.1 is the remote server with username root

and then creating a session as such

ssh localhost -p 1234 -l root

How would I achieve this using this library? and how would I authenticate ?
assuming initial session to bastion is established.

Please do let me know.

Thank you,
Regards,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@SnoCold and others