Bug 2024007
Summary: | Unable to tunnel an SSH client through SSH bastion connection using SSH ProxyCommand with nmap-ncat | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Maxwell Spangler <maxops> |
Component: | nmap | Assignee: | Martin Osvald 🛹 <mosvald> |
Status: | CLOSED DUPLICATE | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
Severity: | medium | Docs Contact: | |
Priority: | unspecified | ||
Version: | 35 | CC: | crypto-team, dbelyavs, dwalsh, jjelen, lantw44, lkundrak, markmc, mattias.ellert, maxops, mhlavink, mosvald, pavel, sir_neil, tm |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | If docs needed, set a value | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2022-02-22 15:35:59 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: | |||
Attachments: |
Description
Maxwell Spangler
2021-11-17 01:27:50 UTC
Created attachment 1842222 [details]
SSH debug output for Fedora 33 client to bastion (Successful Example)
Success example: Debug output of an SSH connection establishing a connection to a bastion and a tunnel on a fresh install of Fedora 33.
Created attachment 1842226 [details]
Fedora 33 Client to bastion creating tunnel output (success)
Fedora 33, Successful example:
SSH client to bastion creating a tunnel and showing tunnel connection activity.
Created attachment 1842227 [details]
Fedora 33 Client through tunnel to private node (success)
Fedora 33, Successful example:
SSH client using nmap-ncat to tunnel through bastion to private node.
Created attachment 1842228 [details]
Fedora 35 Client to bastion creating tunnel output (Bug scenario)
Failure example:
Fedora 35 SSH client to bastion node creating a tunnel.
Tunnel works fine
Includes activity of SSH client that attempts to go through the tunnel and immediately fails.
Created attachment 1842229 [details]
Fedora 35 Client through tunnel to private node (Bug scenario, Failure)
Failure example:
Fedora 35 SSH client through tunnel to private node attempt
Fails very quickly at "kex_exchange_identification".
I confirm that this bug impacts fedora 35 and the issue resides in the default /bin/nc executable. My workflow is using a socks5 proxy and using it to make a ssh connection using the default nc in fedora 35 will fail with debug1: kex_exchange_identification: write: Broken pipe banner exchange: Connection to UNKNOWN port 65535: Broken pipe Which clearly indicate an issue with the underlying connection as netcat is the one in charge this was my first guess and by doing the following I confirmed it Changing debug1: Executing proxy command: exec /bin/nc --proxy-type socks5 --proxy 0.0.0.0:1080 git.dev********* to debug1: Executing proxy command: exec netcat -X 5 -x 0.0.0.0:1080 git.dev********* Fixed the issue. This was introduces between fedora 34 and 35 as this only affects my newer VM Fedora 34 (fine) [r@fedora ~]$ nc -v Ncat: Version 7.80 ( https://nmap.org/ncat ) Ncat: You must specify a host to connect to. QUITTING. [r@fedora ~]$ Fedora 35 (not fine) [r@fedora ~]$ nc -v Ncat: Version 7.91 ( https://nmap.org/ncat ) Ncat: You must specify a host to connect to. QUITTING. [r@fedora ~]$ Using netcat package (not from nmap on fedora 35) fixed it: Last metadata expiration check: 0:24:24 ago on Wed 17 Nov 2021 10:50:05 AM CET. Installed Packages netcat.x86_64 1.218-2.fc35 @updates Regards, Neil I bisected nmap repository and found the fix of this issue in the commit 169d7e5a922ef8e63b51ee2bdf4fd4ad60ed2689 If you do : git clone https://github.com/nmap/nmap cd nmap/ git reset f4fb91912d975f20499b4d903a14491471522398 --hard ./configure && make -j 12 && sudo cp ./ncat/ncat /usr/bin/ncat Then by doing any git connection using /bin/nc (which is a symlink to /etc/alternative/ncat -> /usr/bin/ncat) then it will fail with debug1: kex_exchange_identification: write: Broken pipe banner exchange: Connection to UNKNOWN port 65535: Broken pipe However if you do git clone https://github.com/nmap/nmap cd nmap/ git reset 169d7e5a922ef8e63b51ee2bdf4fd4ad60ed2689 --hard ./configure && make -j 12 && sudo cp ./ncat/ncat /usr/bin/ncat then the connection will go perfectly fine This commit add this patch if (o.ssl) { /* connect_handler creates stdin_nsi and calls post_connect */ nsock_reconnect_ssl(mypool, cs.sock_nsi, connect_handler, o.conntimeout, NULL, NULL); } else { /* Create IOD for nsp->stdin */ if ((cs.stdin_nsi = nsock_iod_new2(mypool, 0, NULL)) == NULL) bye("Failed to create stdin nsiod."); post_connect(mypool, cs.sock_nsi); } https://github.com/nmap/nmap/commit/169d7e5a922ef8e63b51ee2bdf4fd4ad60ed2689 Cheers, Neil I tend to change the component Thanks for the report, this is a known issue with 7.91. See https://github.com/nmap/nmap/issues/2149 *** This bug has been marked as a duplicate of bug 2020453 *** |