Skip to content

Commit

Permalink
Remove client side port guessing from tsh puttyconfig (#44573)
Browse files Browse the repository at this point in the history
If no port was provided puttyconfig would default to 3022. That
is not guaranteed to be the correct port and causes UX issues. To
allow the port to be optional and guarantee the correct port is
used puttyconfig is updated to use 0 instead of 3022. This is a
special port that indicates to Teleport to use whatever port is
defined in the node when making dial request. Since the value
from puttyconfig is fed into tsh proxy ssh this value is honored
by Teleport during connections.
  • Loading branch information
rosstimothy authored Jul 24, 2024
1 parent f4dffe0 commit 9adafe7
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions tool/tsh/common/putty_config_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ const puttyRegistrySSHHostCAsKey = puttyRegistryKey + `\SshHostCAs`
const puttyProtocol = `ssh`

// ints
const puttyDefaultSSHPort = 3022
const puttyDefaultProxyPort = 0 // no need to set the proxy port as it's abstracted by `tsh proxy ssh`

// dwords
Expand Down Expand Up @@ -87,11 +86,6 @@ func addPuTTYSession(proxyHostname string, hostname string, port int, login stri
}
registryKey := fmt.Sprintf(`%v\%v`, puttyRegistrySessionsKey, puttySessionName)

// if the port passed is 0, this means "use server default" so we override it to 3022
if port == 0 {
port = puttyDefaultSSHPort
}

sessionDwords := puttyRegistrySessionDwords{
Present: puttyDwordPresent,
PortNumber: port,
Expand Down

0 comments on commit 9adafe7

Please sign in to comment.