Bug 2115377

Summary: Incorrect parsing of IPv6 IPs in ssh clients
Product: Red Hat Enterprise Linux 8 Reporter: Shreyas Mahangade <smahanga>
Component: opensshAssignee: Dmitry Belyavskiy <dbelyavs>
Status: CLOSED WORKSFORME QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: low Docs Contact:
Priority: low    
Version: 8.5CC: jjelen, mhavrila, sbroz
Target Milestone: rcKeywords: Triaged
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-06-14 07:16:32 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Shreyas Mahangade 2022-08-04 14:41:29 UTC
Description of problem:
When using IPv6 for ssh connection it treats it as hostname.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. Try to connect ssh with IPv6 with multiple use cases
2. 
3.

Actual results:
Note: IPs used are local IPs on lab machine

# sftp test@[fe80::f816:3eff:febd:d89e]
ssh: Could not resolve hostname [fe80::f816:3eff:febd:d89e]: Name or service not known
Connection closed.  
Connection closed

# ssh test@[fe80::f816:3eff:febd:d89e]
ssh: Could not resolve hostname [fe80::f816:3eff:febd:d89e]: Name or service not known

# ssh [fe80::f816:3eff:febd:d89e]
ssh: Could not resolve hostname [fe80::f816:3eff:febd:d89e]: Name or service not known

# sftp test@[fe80::f816:3eff:febd:d89e]
ssh: Could not resolve hostname [fe80::f816:3eff:febd:d89e]: Name or service not known
Connection closed.  
Connection closed


# sftp [fe80::f816:3eff:febd:d89e]
ssh: connect to host fe80::f816:3eff:febd:d89e port 22: Invalid argument
Connection closed.  
Connection closed

Loopback IP was parsed correctly

# sftp [::1]
ECDSA key fingerprint is SHA256:uMU1AbOclwdniyeyJBbzXjebd3qdU4yw2A2wBJqtv4g.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '::1' (ECDSA) to the list of known hosts.


Expected results:
Treat IPv6 block with IP and not hostname


Additional info:
This behavior changes for different IPs here. For above IP it is showing

Comment 3 Shreyas Mahangade 2022-08-12 13:24:03 UTC
It looks like issue might be related to this upstream bug:

   https://bugzilla.mindrot.org/show_bug.cgi?id=1602

Comment 9 Dmitry Belyavskiy 2023-02-07 12:19:00 UTC
Should be partially fixed for 8.x with https://bugzilla.redhat.com/show_bug.cgi?id=2162733

Comment 10 Dmitry Belyavskiy 2023-03-15 11:28:52 UTC
Is this bug still relevant, after https://bugzilla.redhat.com/show_bug.cgi?id=2162733 is shipped?