x/crypto/ssh: TCP/IP port forwarding expects IP addresses #37239
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
(*ssh.Client).ListenTCP
expects an IP address (via*net.TCPAddr
) and therefore(*ssh.Client).Listen
attempts to resolve addresses.However, section 7.1 of RFC 4254 states:
There are two consequences of the current interface:
You can only provide resolvable names. This prohibits two of the strings with special-case semantics from working (
""
, reported in #33227, and"::"
).Resolution happens client side. This changes the meaning of the string
"localhost"
from being "all protocol families supported by the SSH implementation on loopback addresses only" to being only one of those and may provide a different result for other names (AWS hostnames resolving to internal addresses inside a data center comes to mind).Outside of defining a new public interface, I think the least breaking change would be to extract an unexported
listenTCP
function taking a string address and call this fromListen
which can then drop resolution but of course if you're relying on that behavior, it will still be surprising.I'm happy to submit a pull request but I'd appreciate some thoughts on how to best evolve the interface into something that both supports the scope of the RFC and doesn't disregard current users.
The text was updated successfully, but these errors were encountered: