moul/assh

Unable to use IPv6 Address Hostname with custom Port

jessiebryan opened this issue · 2 comments

Hello,

I am having trouble using assh to connect to IPv6 Addresses that use a custom ssh Port.
Go is returning the error

failed to dial: dial tcp: address ::1:9922: too many colons in address

How to reproduce:

  • Set up an SSH host to listen on a non-standard port number such as 2222 or 9922
  • Connect to host by IPv6 Address, not FQDN/name

Observed Behavior:

  • assh connect reports the following output:
~$ assh connect -p9922 ::1
Error: failed to dial: dial tcp: address ::1:9922: too many colons in address
Usage:
  assh connect [flags]

Examples:
Argument is a host.

Flags:
      --dry-run      Only show how assh would connect but don't actually do it
  -h, --help         help for connect
      --no-rewrite   Do not automatically rewrite outdated configuration
  -p, --port int     SSH destination port

failed to dial: dial tcp: address ::1:9922: too many colons in address

Expected Behavior:

  • Execute SSH with -p<Port#> rather than appending a ":<Port#>" to the end of the connection request.

Troubleshooting:

  • I tried to wrap the IPv6 Address with '[' and ']' but this does not help.
  • I updated to the latest version (go get -u moul.io/assh/v2)
  • Verified SSH is able to connect without using assh /usr/bin/ssh -p9922 ::1

This does not appear to be a problem with custom ports only:

$> ssh 2601:280:c***:***:*
Error: failed to dial: dial tcp: address 2601:280:c***:***:* too many colons in address
Usage:
  assh connect [flags]

Examples:
Argument is a host.

Flags:
      --dry-run      Only show how assh would connect but don't actually do it
  -h, --help         help for connect
      --no-rewrite   Do not automatically rewrite outdated configuration
  -p, --port int     SSH destination port

failed to dial: dial tcp: address 2601:280:c*** too many colons in address
kex_exchange_identification: Connection closed by remote host
Connection closed by UNKNOWN port 65535

Without assh this ssh alone works fine.

Ah yeah that makes sense. Also, I think the owner @moul may no longer be active; I haven't seen any updates from them for this project.

I use hostnames that resolve to the v6 address for now.