chipsenkbeil / distant

🚧 (Alpha stage software) Library and tooling that supports remote filesystem and process operations. 🚧
https://distant.dev
559 stars 11 forks source link

Support ssh client tunneling natively #26

Open chipsenkbeil opened 2 years ago

chipsenkbeil commented 2 years ago

Via something like channel_direct_tcpip, avoid the need for other ports to be allocated by launching a program directly via the ssh library and then tunneling to it through SSH.

In terms of async support, it seems that the existing libraries have been removed as recommendations as described here: https://github.com/alexcrichton/ssh2-rs/pull/224

We'd need to build something simple like threaded message passing to send/receive data. From reading the documentation, we can set it to be nonblocking. Sessions need to avoid concurrent access, so we'd want both reads and writes to exist in a singular thread that uses message passing to pass data around.

wez commented 2 years ago

You may be able to leverage: https://github.com/wez/wezterm/tree/main/wezterm-ssh which presents an easier to use async interface than the raw libssh2 which it uses under the covers.

I've been thinking about also enabling the use of libssh in that crate which has support for more keys and more functions and that, importantly, has overlap with the configuration we use at work than does libssh2.

chipsenkbeil commented 2 years ago

Neat! I'll check it out a little later. First priority is adding robust testing to align with the e2e testing I did for distant.nvim

On Mon, Aug 16, 2021, 5:54 PM Wez Furlong @.***> wrote:

You may be able to leverage: https://github.com/wez/wezterm/tree/main/wezterm-ssh which presents an easier to use async interface than the raw libssh2 which it uses under the covers.

I've been thinking about also enabling the use of libssh in that crate which has support for more keys and more functions and that, importantly, has overlap with the configuration we use at work than does libssh2.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/chipsenkbeil/distant/issues/26#issuecomment-899869164, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAS55CTXEEGKKOM2FQE22MLT5GJK5ANCNFSM5CG476XA .

chipsenkbeil commented 2 years ago

You may be able to leverage: https://github.com/wez/wezterm/tree/main/wezterm-ssh which presents an easier to use async interface than the raw libssh2 which it uses under the covers.

I've been thinking about also enabling the use of libssh in that crate which has support for more keys and more functions and that, importantly, has overlap with the configuration we use at work than does libssh2.

@wez

Having looked at wezterm-ssh, I think I'm going to need the full ssh client lib instead to support both ssh native tunneling and running distant as an ssh client for file and proc manipulation (using an sftp channel, etc) .

Are there any specific details I should know or consider for work? If so, feel free to share privately when you have a chance :)

chipsenkbeil commented 2 years ago

Moving to backlog. This requires adding the functionality to wezterm-ssh, which I don't have the time to do and isn't critical. Marking as help wanted in case someone else wants to tackle this.