Pure-Rust asynchronous SSH library, both client and server

#59 How to establish connect to remote tcp?

Opened by diaevd on December 23, 2021
diaevd on December 23, 2021

I trying to

        let mut channel_sess = session.channel_open_direct_tcpip("localhost", 80, "localhost", 3333).await.unwrap();

just like in example. But it just freeze on channel_open_direct_tcpip.

2021-12-23T10:24:44.550212Z  INFO thrussh::client::encrypted: Unhandled global request: Ok("hostkeys-00@openssh.com")    
2021-12-23T10:24:44.592047Z DEBUG thrussh::cipher: reading, len = [43, 187, 133, 146]    
2021-12-23T10:24:44.592104Z DEBUG thrussh::cipher: reading, seqn = 6    
2021-12-23T10:24:44.592132Z DEBUG thrussh::cipher: reading, clear len = 40    
2021-12-23T10:24:44.592148Z DEBUG thrussh::cipher: read_exact 44    
2021-12-23T10:24:44.592174Z DEBUG thrussh::cipher: read_exact done    
2021-12-23T10:24:44.592204Z DEBUG thrussh::cipher: reading, padding_length 6    
2021-12-23T10:24:44.592238Z DEBUG thrussh::client::encrypted: client_read_encrypted, buf = [91, 0, 0, 0, 2, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 128, 0]    
2021-12-23T10:24:44.592266Z DEBUG thrussh::client::encrypted: buf = 17 bytes    
2021-12-23T10:24:44.592348Z DEBUG thrussh::client::encrypted: channel_open_confirmation    
2021-12-23T10:25:44.558761Z DEBUG thrussh::cipher: reading, len = [61, 220, 71, 253]    
2021-12-23T10:25:44.558814Z DEBUG thrussh::cipher: reading, seqn = 7    
2021-12-23T10:25:44.558854Z DEBUG thrussh::cipher: reading, clear len = 32    
2021-12-23T10:25:44.558885Z DEBUG thrussh::cipher: read_exact 36    
2021-12-23T10:25:44.558931Z DEBUG thrussh::cipher: read_exact done    
2021-12-23T10:25:44.558983Z DEBUG thrussh::cipher: reading, padding_length 10    
2021-12-23T10:25:44.559042Z DEBUG thrussh::client::encrypted: client_read_encrypted, buf = [96, 0, 0, 0, 2]    
2021-12-23T10:25:44.559087Z DEBUG thrussh::client::encrypted: buf = 5 bytes    
2021-12-23T10:25:44.559136Z DEBUG thrussh::client::encrypted: channel_eof    
2021-12-23T10:25:44.559245Z DEBUG thrussh::client: msg = Some(Msg(Eof)) 

pause on thrussh::client::encrypted: channel_open_confirmation for 60s. and stop msg = Some(Msg(Eof))

no return from channel_open_direct_tcpip. any ideas?

pmeunier on December 23, 2021

Thanks for the report, could you upload a minimal example somewhere, so I can try to reproduce?

diaevd on December 23, 2021

ok, I’ll do it a little later. sshd log just in case:

Dec 23 22:24:36 veles sshd[3848832]: debug1: SELinux support disabled
Dec 23 22:24:36 veles sshd[3848832]: debug1: PAM: establishing credentials
Dec 23 22:24:36 veles sshd[3848832]: debug1: permanently_set_uid: 1000/1000
Dec 23 22:24:36 veles sshd[3848832]: debug1: rekey in after 134217728 blocks
Dec 23 22:24:36 veles sshd[3848832]: debug1: rekey out after 134217728 blocks
Dec 23 22:24:36 veles sshd[3848832]: debug1: ssh_packet_set_postauth: called
Dec 23 22:24:36 veles sshd[3848832]: debug1: active: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
Dec 23 22:24:36 veles sshd[3848832]: debug1: Entering interactive session for SSH2.
Dec 23 22:24:36 veles sshd[3848832]: debug1: server_init_dispatch
Dec 23 22:24:36 veles sshd[3848832]: debug1: server_input_channel_open: ctype direct-tcpip rchan 2 win 2097152 max 32768
Dec 23 22:24:36 veles sshd[3848832]: debug1: server_request_direct_tcpip: originator localhost port 3333, target localhost port 80
Dec 23 22:24:36 veles sshd[3848832]: debug1: connect_next: host localhost ([127.0.0.1]:80) in progress, fd=9
Dec 23 22:24:36 veles sshd[3848832]: debug1: channel 0: new [direct-tcpip]
Dec 23 22:24:36 veles sshd[3848832]: debug1: server_input_channel_open: confirm direct-tcpip
Dec 23 22:24:36 veles sshd[3848832]: debug1: channel 0: connected to localhost port 80
Dec 23 22:24:36 veles sshd[3848832]: debug1: Got 82/6 for keepalive

server processes the command and opens the channel for direct-tcpip

diaevd on December 23, 2021
diaevd on January 17, 2022

Any ideas?