nccgroup / SocksOverRDP

Socks5/4/4a Proxy support for Remote Desktop Protocol / Terminal Services / Citrix / XenApp / XenDesktop
https://research.nccgroup.com/2020/05/06/tool-release-socks-over-rdp/
MIT License
1.07k stars 168 forks source link

connection not stable #8

Closed fengxx closed 2 years ago

fengxx commented 2 years ago

thanks for the tool, it is very useful, however running ssh over the socks created on rcp channel is not stable

earthquake commented 2 years ago

Hi @fengxx,

Thanks for the bug report, it seems that your connection to the RDP server is slow and that affecting the underlying virtual channel where the connection lags. Unfortunately this is not something that I can fix, because:

  1. not much to do with the tool
  2. there is no way I can reproduce it based on what you wrote

You can try recompiling the executable, by changing this this value to 6: running_args.priority = 4; (line 445)

This would prioritise the virtual channel giving it real time priority: "WTS_CHANNEL_OPTION_DYNAMIC_PRI_REAL Real-time priority. Use this priority level only in cases where the data transfer is absolutely critical. The data transfer size should be limited to a few hundred bytes per message.".

fengxx commented 2 years ago

I tried WTS_CHANNEL_OPTION_DYNAMIC_PRI_REAL but no luck. I guess it maybe related the behavior of ssh, which transfer every key stroke in a packet for interactive purpose, heavily affected by Nagle algorithm (default enabled in winsock) with 200-ms ACK delay. I also tried ssh's ProxyCommand config with socat's nodelay ProxyCommand socat -b 4192 - "SOCKS5:%h:%p|TCP:127.0.0.1:1080,nodelay" but no improvement

earthquake commented 2 years ago

Sorry to hear that. Will close this for now, since it looks like a network issue rather than a problem with the code itself.