microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.86k stars 29.51k forks source link

Support reverse tunnel #100222

Open shawee opened 4 years ago

shawee commented 4 years ago

context

I am trying to access adb in local machine from my remote server. To do that, I tried something like ssh -R ${remote_port}:localhost:${local_port} remote_address which opened a reverse port forwarding from my server and local machine so that I was able to access local attached devices in my remote server terminal. However, rather than using remote ssh tunnel everytime, I want to automate everything in vscode extension

Problem

It looks reverse port is a known issue. Wondering when that will be resolved? (https://code.visualstudio.com/api/advanced-topics/remote-extensions#known-issues)

I tried to use vscode.workspace.openTunnel (https://raw.githubusercontent.com/microsoft/vscode/master/src/vs/vscode.proposed.d.ts) api but it only supports a forward tunnel. Can we support reverse tunnel in this api?

markm77 commented 4 years ago

Reverse tunnels are also super useful for forwarding API calls and redirects received by a web server in test scenarios etc. I often create an "empty" web server with just security stuff and an Apache reverse proxy and use a reverse tunnel to route traffic back to my dev machine to allow running of an integration test suite.

Would be great to be able to set up and manage this reverse forwarding in VS Code 😀.

My usual command is

ssh -N -o 'ExitOnForwardFailure yes' -R 8080:localhost:8080 -R 3000:localhost:3000 user@server

for reverse tunnelling.

arita37 commented 4 years ago

Most of secure server requires : Bastion Login Reverse SSH Tunnel

0Grit commented 3 years ago

Hoping this can solve my problem of connecting GDB client in the remote workspace to GDB server running on my local machine.

chuanqisun commented 2 years ago

This could potentially resolve https://github.com/microsoft/WSL/issues/5211 and https://github.com/microsoft/WSL/issues/4619

jberenhaus commented 2 years ago

Bumping this issue, we have a keen interest for this feature as we do Android development (adb) through remote servers.

As I mentioned in https://github.com/microsoft/vscode-remote-release/issues/7182

Right now we launch an external ssh process to do the tunneling which is less than ideal but kind of works. Having a solid API that's part of VS Code would be much more reliable and would save us a bunch of dev time.

Is there an update on priority for this issue?

Starmania commented 1 year ago

Oh, so I'm non the only guy to try to use adbd on local ?

jarrodcolburn commented 11 months ago

Would love this!

What I have to do for adb is pretty backwards. Which is either: ngrok (for TCP)
serveo (ssh->sshd<-ssh).

Seems very roundabout when VS Code's UI and Framework are already communicating.

What I think OP, and I, are trying to accomplish is... image