2

I want to accept SOCKS5 clients like "ssh -D" does. Same like in Termius app(https://apps.apple.com/in/app/termius-ssh-sftp-client/id1176074088?mt=12) there is option to add Proxy Details(host, username & Pass). Then it will establish connection to the client through Proxy.

enter image description here

Let me know if any more details required.

1 Answers1

0

The Termius app does appear to leverage a bunch of Open Source Libraries:

These provide an OpenSSH library and a Objective-C wrapper respectively.

The -D option you are interested in I believe is known as port forwarding. There is a document to help at a code level with this

If you combine the above into your own app I think you should be able to achieve the desired functionality.

Faisal Memon
  • 2,711
  • 16
  • 30
  • I checked **forwarding.dox** but I couldn't found where do I put proxy credentials(host, username, pass and port). Please guide me if anything I missed out. – K N Sarvaiya Jul 28 '23 at 09:58
  • A mistake on my part, actually the SOCKS support is in the command line tool side of the tech stack, not in the libssh2 layer of the stack. I see an implementation in channels.c of the command line tool; e.g. https://github.com/openssh/openssh-portable/blob/e0f91aa9c2fbfc951e9ced7e1305455fc614d3f2/channels.c#L1509. So a solution would involve pulling this code in as well. I get the feeling however you're looking for something out-of-the-box. – Faisal Memon Jul 30 '23 at 15:17
  • Thank You!, I checked https://github.com/openssh/openssh-portable/blob/e0f91aa9c2fbfc951e9ced7e1305455fc614d3f2/channels.c#L1509 I'm able to add Proxy host and port but not username and without username I can't authenticate with proxy server. is there any way I can create proxy tcp SOCK5 tunnel and then I will connect to actual server using libssh2? – K N Sarvaiya Jul 31 '23 at 07:04