Default desktop port to 3389 if not specified#35304
Merged
Conversation
When specifying hosts in the config file, Teleport will automatically set the port to 3389 if it is not otherwise specified. This behavior is different with tctl or our API - in these cases, we don't default to the correct port, and attempts to connect to these desktops will fail. We now parse the desktop addr at connect time and set the port if it is not provided. Closes #31646
probakowski
approved these changes
Dec 4, 2023
ibeckermayer
approved these changes
Dec 4, 2023
Contributor
ibeckermayer
left a comment
There was a problem hiding this comment.
I spent a bit too long trying to decipher how ParseHostPortAddr ultimately works, I created this docstring which you can consider adding:
// ParseHostPortAddr expects a string in the format "[(tcp | http | https)://]host[:port]"
// and returns a [*NetAddr] or an error. If the `hostport` string contains a valid port, this
// port is used regardless of the value of `defaultPort`.
//
// If the `hostport` does not contain a port, the function uses the provided `defaultPort`,
// unless `defaultPort` is -1, in which case the function returns an error.
//
// The `AddrNetwork` of the returned [*NetAddr] is set to "tcp" by default if no scheme was provided,
// and the `Addr` is set to the host and port joined by a colon. Providing a string in a format
// besides the one described above is not supported and may result in unexpected behavior.
This was referenced Dec 4, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When specifying hosts in the config file, Teleport will automatically set the port to 3389 if it is
not otherwise specified. This behavior is different with tctl or our API - in these cases, we don't
default to the correct port, and attempts to connect to these desktops will fail.
We now parse the desktop addr at connect time and
set the port if it is not provided.
Closes #31646
changelog: Desktop connections default to RDP port 3389 if not otherwise specified.