Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port fowarding failed for listen #941

Closed
ayalu opened this issue Nov 8, 2017 · 5 comments
Closed

Port fowarding failed for listen #941

ayalu opened this issue Nov 8, 2017 · 5 comments

Comments

@ayalu
Copy link

ayalu commented Nov 8, 2017

"OpenSSH for Windows" version
0.0.22.0

Server OperatingSystem
windows 2012 EN Datacenter

Client OperatingSystem
Kali Linux 2017.1

What is failing
Remote port fowarding (sh -R 444:127.0.0.1:444 [email protected])

Expected output
On the server : netstat -an | grep ":444"

Actual output
In SSH client logs: Warning: remote port forwarding failed for listen port 444

@manojampalam
Copy link
Contributor

manojampalam commented Nov 8, 2017

Share sshd logs from server side. Steps here - https://github.com/PowerShell/Win32-OpenSSH/wiki/Troubleshooting-Steps

@ayalu
Copy link
Author

ayalu commented Nov 8, 2017

C:\Program Files\OpenSSH>sshd -d
./sshd_config line 100: Deprecated option UsePrivilegeSeparation
debug1: sshd version OpenSSH_7.6, LibreSSL 2.5.3
debug1: private host key #0: ssh-rsa SHA256:Hj2rOnXOqORPEp7R3CmCQqgLswyPb9PGBH7JkGoHwCU
debug1: private host key #1: ssh-dss SHA256:bA64dnhgl7UPJ4rjVmpBLUNEjQbDrBt4mo4XTIBNWW8
debug1: private host key #2: ecdsa-sha2-nistp256 SHA256:W5NKNP0UIBLx9fWE/2HGtZblws2KY9D+mpgpsNxSJVo
debug1: private host key #3: ssh-ed25519 SHA256:TlhVMya37fwMBud/wwddOaEoZqumAglF5J7MtJSgr+k
debug1: Bind to port 22 on ::.
Server listening on :: port 22.
debug1: Bind to port 22 on 0.0.0.0.
Server listening on 0.0.0.0 port 22.
debug1: Server will not fork when running in debugging mode.
Connection from 192.168.1.25 port 33160 on 192.168.1.34 port 22
debug1: Client protocol version 2.0; client software version OpenSSH_7.4p1 Debia
n-10
debug1: match: OpenSSH_7.4p1 Debian-10 pat OpenSSH* compat 0x04000000
debug1: Local version string SSH-2.0-OpenSSH_7.6
debug1: list_hostkey_types: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp25
6,ssh-ed25519
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: client->server cipher: [email protected] MAC: <implicit

compression: none
debug1: kex: server->client cipher: [email protected] MAC: <implicit
compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_INIT
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: KEX done
debug1: userauth-request for user administrator service ssh-connection method no
ne
debug1: attempt 0 failures 0
Failed none for administrator from 192.168.1.25 port 33160 ssh2
debug1: userauth-request for user administrator service ssh-connection method ke
yboard-interactive
debug1: attempt 1 failures 0
debug1: keyboard-interactive devs
debug1: auth2_challenge: user=administrator devs=
debug1: kbdint_alloc: devices ''
Failed keyboard-interactive for administrator from 192.168.1.25 port 33160 ssh2
debug1: userauth-request for user administrator service ssh-connection method pa
ssword
debug1: attempt 2 failures 1
Accepted password for administrator from 192.168.1.25 port 33160 ssh2
debug1: Entering interactive session for SSH2.
debug1: server_init_dispatch
debug1: server_input_global_request: rtype tcpip-forward want_reply 1
debug1: server_input_global_request: tcpip-forward listen localhost port 444
debug1: server_input_channel_open: ctype session rchan 0 win 1048576 max 16384
debug1: input_session_request
debug1: channel 0: new [server-session]
debug1: session_new: session 0
debug1: session_open: channel 0
debug1: session_open: session 0: link with channel 0
debug1: server_input_channel_open: confirm session
debug1: server_input_global_request: rtype [email protected] want_rep
ly 0
debug1: server_input_channel_req: channel 0 request pty-req reply 1
debug1: session_by_channel: session 0 channel 0
debug1: session_input_channel_req: session 0 req pty-req
debug1: Allocating pty.
debug1: session_pty_req: session 0 alloc console
debug1: Ignoring unsupported tty mode opcode 1 (0x1)
debug1: Ignoring unsupported tty mode opcode 2 (0x2)
debug1: Ignoring unsupported tty mode opcode 3 (0x3)
debug1: Ignoring unsupported tty mode opcode 4 (0x4)
debug1: Ignoring unsupported tty mode opcode 5 (0x5)
debug1: Ignoring unsupported tty mode opcode 6 (0x6)
debug1: Ignoring unsupported tty mode opcode 7 (0x7)
debug1: Ignoring unsupported tty mode opcode 8 (0x8)
debug1: Ignoring unsupported tty mode opcode 9 (0x9)
debug1: Ignoring unsupported tty mode opcode 10 (0xa)
debug1: Ignoring unsupported tty mode opcode 12 (0xc)
debug1: Ignoring unsupported tty mode opcode 13 (0xd)
debug1: Ignoring unsupported tty mode opcode 14 (0xe)
debug1: Ignoring unsupported tty mode opcode 18 (0x12)
debug1: Ignoring unsupported tty mode opcode 30 (0x1e)
debug1: Ignoring unsupported tty mode opcode 31 (0x1f)
debug1: Ignoring unsupported tty mode opcode 32 (0x20)
debug1: Ignoring unsupported tty mode opcode 33 (0x21)
debug1: Ignoring unsupported tty mode opcode 34 (0x22)
debug1: Ignoring unsupported tty mode opcode 35 (0x23)
debug1: Ignoring unsupported tty mode opcode 36 (0x24)
debug1: Ignoring unsupported tty mode opcode 37 (0x25)
debug1: Ignoring unsupported tty mode opcode 38 (0x26)
debug1: Ignoring unsupported tty mode opcode 39 (0x27)
debug1: Ignoring unsupported tty mode opcode 40 (0x28)
debug1: Ignoring unsupported tty mode opcode 41 (0x29)
debug1: Ignoring unsupported tty mode opcode 42 (0x2a)
debug1: Ignoring unsupported tty mode opcode 50 (0x32)
debug1: Ignoring unsupported tty mode opcode 51 (0x33)
debug1: Ignoring unsupported tty mode opcode 52 (0x34)
debug1: Ignoring unsupported tty mode opcode 53 (0x35)
debug1: Ignoring unsupported tty mode opcode 54 (0x36)
debug1: Ignoring unsupported tty mode opcode 55 (0x37)
debug1: Ignoring unsupported tty mode opcode 56 (0x38)
debug1: Ignoring unsupported tty mode opcode 57 (0x39)
debug1: Ignoring unsupported tty mode opcode 58 (0x3a)
debug1: Ignoring unsupported tty mode opcode 59 (0x3b)
debug1: Ignoring unsupported tty mode opcode 60 (0x3c)
debug1: Ignoring unsupported tty mode opcode 61 (0x3d)
debug1: Ignoring unsupported tty mode opcode 62 (0x3e)
debug1: Ignoring unsupported tty mode opcode 70 (0x46)
debug1: Ignoring unsupported tty mode opcode 71 (0x47)
debug1: Ignoring unsupported tty mode opcode 72 (0x48)
debug1: Ignoring unsupported tty mode opcode 73 (0x49)
debug1: Ignoring unsupported tty mode opcode 74 (0x4a)
debug1: Ignoring unsupported tty mode opcode 75 (0x4b)
debug1: Ignoring unsupported tty mode opcode 90 (0x5a)
debug1: Ignoring unsupported tty mode opcode 91 (0x5b)
debug1: Ignoring unsupported tty mode opcode 92 (0x5c)
debug1: Ignoring unsupported tty mode opcode 93 (0x5d)
debug1: server_input_channel_req: channel 0 request env reply 0
debug1: session_by_channel: session 0 channel 0
debug1: session_input_channel_req: session 0 req env
debug1: server_input_channel_req: channel 0 request shell reply 1
debug1: session_by_channel: session 0 channel 0
debug1: session_input_channel_req: session 0 req shell
Starting session: shell on console for administrator from 192.168.1.25 port 3316
0 id 0
debug1: Executing command: C:\Program Files\OpenSSH\ssh-shellhost.exe

@ayalu
Copy link
Author

ayalu commented Nov 8, 2017

OpenSSH_7.4p1 Debian-10, OpenSSL 1.0.2l 25 May 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: resolving "192.168.1.34" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to 192.168.1.34 [192.168.1.34] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4p1 Debian-10
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.6
debug1: match: OpenSSH_7.6 pat OpenSSH* compat 0x04000000
debug2: fd 4 setting O_NONBLOCK
debug1: Authenticating to 192.168.1.34:22 as 'administrator'
debug3: hostkeys_foreach: reading file "/root/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file /root/.ssh/known_hosts:4
debug3: load_hostkeys: loaded 1 keys from 192.168.1.34
debug3: order_hostkeyalgs: prefer hostkeyalgs: [email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,ext-info-c
debug2: host key algorithms: [email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected],ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],aes128-cbc,aes192-cbc,aes256-cbc
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],aes128-cbc,aes192-cbc,aes256-cbc
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,[email protected],zlib
debug2: compression stoc: none,[email protected],zlib
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1
debug2: host key algorithms: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none
debug2: compression stoc: none
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: compression: none
debug1: kex: client->server cipher: [email protected] MAC: compression: none
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug3: receive packet: type 31
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:W5NKNP0UIBLx9fWE/2HGtZblws2KY9D+mpgpsNxSJVo
debug3: hostkeys_foreach: reading file "/root/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file /root/.ssh/known_hosts:4
debug3: load_hostkeys: loaded 1 keys from 192.168.1.34
debug1: Host '192.168.1.34' is known and matches the ECDSA host key.
debug1: Found key in /root/.ssh/known_hosts:4
debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey after 134217728 blocks
debug2: key: /root/.ssh/id_rsa ((nil))
debug2: key: /root/.ssh/id_dsa ((nil))
debug2: key: /root/.ssh/id_ecdsa ((nil))
debug2: key: /root/.ssh/id_ed25519 ((nil))
debug3: send packet: type 5
debug3: receive packet: type 7
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug3: start over, passed a different list publickey,password,keyboard-interactive
debug3: preferred gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/id_rsa
debug3: no such identity: /root/.ssh/id_rsa: No such file or directory
debug1: Trying private key: /root/.ssh/id_dsa
debug3: no such identity: /root/.ssh/id_dsa: No such file or directory
debug1: Trying private key: /root/.ssh/id_ecdsa
debug3: no such identity: /root/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /root/.ssh/id_ed25519
debug3: no such identity: /root/.ssh/id_ed25519: No such file or directory
debug2: we did not send a packet, disable method
debug3: authmethod_lookup keyboard-interactive
debug3: remaining preferred: password
debug3: authmethod_is_enabled keyboard-interactive
debug1: Next authentication method: keyboard-interactive
debug2: userauth_kbdint
debug3: send packet: type 50
debug2: we sent a keyboard-interactive packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug3: userauth_kbdint: disable: no info_req_seen
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred:
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
debug3: send packet: type 50
debug2: we sent a password packet, wait for reply
debug3: receive packet: type 52
debug1: Authentication succeeded (password).
Authenticated to 192.168.1.34 ([192.168.1.34]:22).
debug1: Remote connections from LOCALHOST:444 forwarded to local address 127.0.0.1:444
debug3: send packet: type 80
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug3: send packet: type 90
debug1: Requesting [email protected]
debug3: send packet: type 80
debug1: Entering interactive session.
debug1: pledge: network
debug3: receive packet: type 80
debug1: client_input_global_request: rtype [email protected] want_reply 0
debug3: receive packet: type 4
debug1: Remote: Server has disabled port forwarding.
debug3: receive packet: type 82
debug1: remote forward failure for: listen 444, connect 127.0.0.1:444
Warning: remote port forwarding failed for listen port 444
debug1: All remote forwarding requests processed
debug3: receive packet: type 91
debug2: callback start
debug2: fd 4 setting TCP_NODELAY
debug3: ssh_packet_set_tos: set IP_TOS 0x10
debug2: client_session2_setup: id 0
debug2: channel 0: request pty-req confirm 1
debug3: send packet: type 98
debug1: Sending environment.
debug3: Ignored env LS_COLORS
debug3: Ignored env XDG_MENU_PREFIX
debug1: Sending env LANG = en_US.UTF-8
debug2: channel 0: request env confirm 0
debug3: send packet: type 98
debug3: Ignored env GDM_LANG
debug3: Ignored env DISPLAY
debug3: Ignored env COLORTERM
debug3: Ignored env USERNAME
debug3: Ignored env XDG_VTNR
debug3: Ignored env SSH_AUTH_SOCK
debug3: Ignored env XDG_SESSION_ID
debug3: Ignored env USER
debug3: Ignored env DESKTOP_SESSION
debug3: Ignored env QT_QPA_PLATFORMTHEME
debug3: Ignored env PWD
debug3: Ignored env HOME
debug3: Ignored env JOURNAL_STREAM
debug3: Ignored env SSH_AGENT_PID
debug3: Ignored env QT_ACCESSIBILITY
debug3: Ignored env XDG_SESSION_TYPE
debug3: Ignored env XDG_DATA_DIRS
debug3: Ignored env XDG_SESSION_DESKTOP
debug3: Ignored env GTK_MODULES
debug3: Ignored env WINDOWPATH
debug3: Ignored env TERM
debug3: Ignored env SHELL
debug3: Ignored env VTE_VERSION
debug3: Ignored env XDG_CURRENT_DESKTOP
debug3: Ignored env GPG_AGENT_INFO
debug3: Ignored env QT_LINUX_ACCESSIBILITY_ALWAYS_ON
debug3: Ignored env SHLVL
debug3: Ignored env XDG_SEAT
debug3: Ignored env PYTHONPATH
debug3: Ignored env WINDOWID
debug3: Ignored env GDMSESSION
debug3: Ignored env GNOME_DESKTOP_SESSION_ID
debug3: Ignored env LOGNAME
debug3: Ignored env DBUS_SESSION_BUS_ADDRESS
debug3: Ignored env XDG_RUNTIME_DIR
debug3: Ignored env XAUTHORITY
debug3: Ignored env PATH
debug3: Ignored env SESSION_MANAGER
debug3: Ignored env _
debug2: channel 0: request shell confirm 1
debug3: send packet: type 98
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 0
debug2: PTY allocation request accepted on channel 0
debug2: channel 0: rcvd adjust 2097152
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 0
debug2: shell request accepted on channel 0
debug3: receive packet: type 96
debug2: channel 0: rcvd eof
debug2: channel 0: output open -> drain
debug2: channel 0: obuf empty
debug2: channel 0: close_write
debug2: channel 0: output drain -> closed
debug3: receive packet: type 98
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug3: receive packet: type 98
debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0
debug2: channel 0: rcvd eow
debug2: channel 0: close_read
debug2: channel 0: input open -> closed
debug3: receive packet: type 97
debug2: channel 0: rcvd close
debug3: channel 0: will not send data after close
debug2: channel 0: almost dead
debug2: channel 0: gc: notify user
debug2: channel 0: gc: user detached
debug2: channel 0: send close
debug3: send packet: type 97
debug2: channel 0: is dead
debug2: channel 0: garbage collecting
debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
#0 client-session (t4 r0 i3/0 o3/0 fd -1/-1 cc -1)

debug3: send packet: type 1
Transferred: sent 2528, received 3824 bytes, in 3.7 seconds
Bytes per second: sent 680.0, received 1028.6
debug1: Exit status 0

@ayalu
Copy link
Author

ayalu commented Nov 8, 2017

2 different VM. I tried with different ports and same issue.

Here is sshd_config

AllowAgentForwarding yes
AllowTcpForwarding yes
GatewayPorts yes

@ayalu
Copy link
Author

ayalu commented Nov 8, 2017

OK here is the answer :
https://unix.stackexchange.com/questions/41451/how-can-i-set-up-a-remote-port-forward-on-port-80-to-my-localhost-with-the-help

Only root can foward privileged ports.

Thank you for you support and great product !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants