Bug 3308 - host resolve bug
Summary: host resolve bug
Status: CLOSED WORKSFORME
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: ssh (show other bugs)
Version: 7.9p1
Hardware: Other Linux
: P5 enhancement
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-05-05 00:29 AEST by loic.did
Modified: 2022-02-25 13:58 AEDT (History)
1 user (show)

See Also:


Attachments
screenshot of the bug on debian 10 with 7.9p1 (25.14 KB, image/png)
2021-05-05 00:29 AEST, loic.did
no flags Details
Forget This one I just check the man page to understand why it didn't work (23.74 KB, image/png)
2021-05-05 17:03 AEST, loic.did
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description loic.did 2021-05-05 00:29:29 AEST
Created attachment 3508 [details]
screenshot of the bug on debian 10 with 7.9p1

"ssh debian@vps-1060b8b0.vps.ovh.net" resolve properly

BUT

"ssh debian@vps-1060b8b0.vps.ovh.net:22" doesn't :
"ssh: Could not resolve hostname vps-1060b8b0.vps.ovh.net:22"

It works using -p
"ssh debian@vps-1060b8b0.vps.ovh.net -p 22" resolve properly

PROBLEM:
nodejs modules (for exemple) use the user@host:port methode.

ALSO TESTED ON Windows 10 with 8.1p1 and 7.7p1
Can't
Comment 1 loic.did 2021-05-05 00:34:29 AEST
Also can't resolve the format ip:port
Comment 2 Darren Tucker 2021-05-05 08:22:42 AEST
(In reply to loic.did from comment #0)
[...]
> "ssh debian@vps-1060b8b0.vps.ovh.net:22" doesn't :
> "ssh: Could not resolve hostname vps-1060b8b0.vps.ovh.net:22"

Why do you think that should work?  It's not a valid DNS name and ssh(1) does not list it as a supported way of specifying the port).  If you want to use the URI syntax that does allow a port after a colon you need to specify the "ssh:" scheme prefix (this was added in OpenSSH 7.6):

ssh ssh://debian@vps-1060b8b0.vps.ovh.net:22

> PROBLEM:
> nodejs modules (for exemple) use the user@host:port methode.

If nodejs is invoking ssh in a way that's not supported that sounds like a problem with nodejs.  You could configure around it by adding something like this to your ~/.ssh/config file:

Host vps-1060b8b0.vps.ovh.net:22
  Hostname vps-1060b8b0.vps.ovh.net
  Port 22
Comment 3 loic.did 2021-05-05 17:03:01 AEST
Created attachment 3509 [details]
Forget This one I just check the man page to understand why it didn't work
Comment 4 loic.did 2021-05-05 18:01:35 AEST
As you said I configured 3 node modules with:
host: debian@vps-1060b8b0.vps.ovh.net
port: 22

Trigger the so called bug.

The "ssh ssh://debian@vps-1060b8b0.vps.ovh.net:22" does work but not sure I can get a use of it since I can also use the arguement P but not used by the nodejs modules. Anyway I found a node module that works (at least for the connection).

And as you said the host:port format can only be used while following ssh:// it's written on the man page but as I don't have man installed I used the help that doesn't provide the format.

The help isn't really helpful since I can't understand much with it but it's my fault to not have checked the man page before posting.
I think the help needs and update to provide more information since I think I'm not the only that have or will have this problem.

Sorry that I took your time for that.
Comment 5 Darren Tucker 2021-05-07 13:25:28 AEST
The help (and synopsis) say:

usage: ssh [...] destination [command]

and the man page expands on what format the destination can take:

     ssh connects and logs into the specified destination, which may be
     specified as either [user@]hostname or a URI of the form
     ssh://[user@]hostname[:port]

The man page is about 50KB so there's a limit to how much of it we can cram into the usage and synopsis.
Comment 6 Damien Miller 2022-02-25 13:58:33 AEDT
closing bugs resolved before openssh-8.9