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

Make local port range configurable #7369

Closed
KrisJanssen opened this issue Oct 14, 2022 · 23 comments
Closed

Make local port range configurable #7369

KrisJanssen opened this issue Oct 14, 2022 · 23 comments
Assignees
Labels
feature-request Request for new features or functionality on-release-notes Issue/pull request mentioned in release notes ssh Issue in vscode-remote SSH verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@KrisJanssen
Copy link

Remote - SSH extension selects a random free port on local host to set up the SSH tunnel in the function 'createTunnel()':

image

findAnyFreePort() cannot be limited in the range of port it tries.

This causes problems when using the functionality in our organization where client machines run Palo Alto Terminal Services Agent, which reserves ports in the range 20000-39999: Remote - SSH does not pick up on the fact that these ports are reserved (even if not used) and subsequently, the tunnel cannot be established if the extension selects a port in this range.

I validated that this is truly the cause by doing two things:

Patch randomPort() to select ports in the range 50000 to 60000:

image

Replace calls to findAnyFreePort() with calls to randomPort():

image

Doing this restores functionality.

As such I would like to request the local port range to be made a configurable item: this would allow our users to select ranges not reserved for other uses.

@github-actions github-actions bot added the ssh Issue in vscode-remote SSH label Oct 14, 2022
@eleanorjboyd
Copy link
Member

Hello! Have you looked into the setting Remote.SSH: Server Pick Ports From Range?

@eleanorjboyd eleanorjboyd self-assigned this Oct 17, 2022
@eleanorjboyd eleanorjboyd added the info-needed Issue requires more information from poster label Oct 17, 2022
@KrisJanssen
Copy link
Author

Hello! Have you looked into the setting Remote.SSH: Server Pick Ports From Range?

That will not work I'm afraid: I am talking about the local port that is used to set up the tunnel. If you check the plugin code you see that the choice of this port is entirely random.

This is further reflected by the documentation of the cited setting:

image

remote.SSH.serverPickPortsFromRange reflects on the ports the remote vscode-server chooses.

Does that clarify?

@eleanorjboyd
Copy link
Member

Yes apologies I miss-read your message. We can put this in the backlog as a feature request!

@eleanorjboyd eleanorjboyd added feature-request Request for new features or functionality and removed info-needed Issue requires more information from poster labels Oct 19, 2022
@vscodenpa vscodenpa added this to the Backlog Candidates milestone Oct 19, 2022
@vscodenpa
Copy link

This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 10 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

@saskerg
Copy link

saskerg commented Oct 20, 2022

would be great to see this implemented!

@Idlebrand
Copy link

I'd like to see this implemented.

@dantchapman
Copy link

Having control of both server and client ports would be a great addition for highly controlled environments

@heyloan
Copy link

heyloan commented Oct 20, 2022

it would be a great addition !

@SarahArchibald
Copy link

This would be useful

@JudiNeuss
Copy link

I'd like this to be implemented

@GBianca
Copy link

GBianca commented Oct 20, 2022

It would be great to see this implemented

@vscodenpa
Copy link

🙂 This feature request received a sufficient number of community upvotes and we moved it to our backlog. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

@tonybart1337
Copy link

tonybart1337 commented Mar 21, 2023

this has been a nightmare for me. running docker, syncthing, nvidia apps, all of those allocate enough ports that it takes me 3-5 attempts on average just to connect to my server which is very annoying.

For those wondering which App allocated a port on Windows: Win + X -> Terminal run as admin

netstat -b

Also when you open a new window, it makes a new connection, 3-5 attempts, you select a folder and then a new connection again...even though the multiplexing is on.

I would really appreciate if this can be made configurable: array of ports, array of ranges

@KrisJanssen
Copy link
Author

@eleanorjboyd : Things are likely busy for sure but any chance there is some info on the position in backlog for this request? It is still a showstopper for us in some scenarios. Thx!

@eleanorjboyd
Copy link
Member

@KrisJanssen currently no update on timeline sorry! When it does get added to our plan it will be linked to another issue called "iteration plan" for the month it will be addressed. Thanks

@tonybart1337
Copy link

tonybart1337 commented Apr 14, 2023

@eleanorjboyd
after the latest VSCode update (1.77.3) and extension (v0.100.0), I no longer experience any issues! it always connects on first try!

I don't know if anyone put a word there, but thank you guys very much.

I think it was resolved in v0.100.0 Remote - SSH extension

@eleanorjboyd
Copy link
Member

@tonybart1337, interesting to hear that it is working since I don't think we made changes that would impact local port range configurability. Are other people seeing this? @roblourens could you investigate a bit further? Thanks!

@KrisJanssen
Copy link
Author

KrisJanssen commented Nov 24, 2023

@eleanorjboyd @roblourens : wanted to check in where we are on this one. This remains a major showstopper which seems like a nobrainer to fix….

@KrisJanssen
Copy link
Author

@eleanorjboyd @roblourens : Where are we on this one? It has been on the backlog for a while and we find ourselves having to deploy manually patched versions of the plugin at each update of VSCode/the plugin, which is somewhat of a pain :)

@evanasse
Copy link

I'm in the same situation as KrisJanssen and would also like to avoid to manually patch the extension.
tonybart1337's problem doesn't seem related to the original issue and I'm worried the comment of the issue being solved could have reduced priority on this.

@KrisJanssen
Copy link
Author

@eleanorjboyd @roblourens : can you please comment.... the stale branches and lack of commits do not bode well for what otherwise seems like quite the core functionality.

@roblourens
Copy link
Member

The extension is not open source, so you can't see what commits go in. Would like to do this but we don't have the time right now, unfortunately.

@joshspicer joshspicer modified the milestones: Backlog, July 2024 Jul 19, 2024
@joshspicer joshspicer self-assigned this Jul 19, 2024
@joshspicer
Copy link
Member

A new setting Preferred Local Port Range is now available in the pre-release build of the extension. Please let me know if you have any feedback on the feature

@joshspicer joshspicer added the verification-needed Verification of issue is requested label Jul 23, 2024
@rzhao271 rzhao271 added the verified Verification succeeded label Jul 23, 2024
@joshspicer joshspicer added the on-release-notes Issue/pull request mentioned in release notes label Jul 26, 2024
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Sep 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality on-release-notes Issue/pull request mentioned in release notes ssh Issue in vscode-remote SSH verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

No branches or pull requests