openssh-rust / openssh

Scriptable SSH through OpenSSH in Rust
Apache License 2.0
232 stars 37 forks source link

Passthrough OpenSSH client? #162

Open shymega opened 2 months ago

shymega commented 2 months ago

Hi,

I found this crate when writing a Rust wrapper around ssh. It looks like what I need, but I'd like to be able to 'pass through' the SSH client-specific arguments to this crate.

Is that possible?

Thanks.

NobodyXu commented 2 months ago

SessionBuilder contains many options supported, depending on the use case they might be enough.

I don't think it's a good idea to pass unsanitized args directly to ssh, but if there's a use case, I'd accept a PR to add a new method to it.

miguelgila commented 2 days ago

@NobodyXu I just came across this crate and I was wondering if @shymega's request was about adding dynamic the application-level port forwarding (SOCKS5) option -D to the session.

Perhaps there is already a way to do this with the crate and I haven't seen it, but if not, would this be an acceptable use case?

shymega commented 2 days ago

I didn't say anything about SOCKS5. I just wanted to be able to pass through args to the SSH call.

NobodyXu commented 19 hours ago

Perhaps there is already a way to do this with the crate and I haven't seen it, but if not, would this be an acceptable use case?

@miguelgila Yes I will accept a PR for that.

it's already supported by the openssh-mix-client and -D via ssh cli, so it'd be relatively simple:

https://docs.rs/openssh-mux-client/latest/openssh_mux_client/struct.Connection.html#method.request_dynamic_forward