How to connect the SSH server to my app instead of a CMD shell

Discussion of open issues, suggestions and bugs regarding network security and data protection solution - SecureBridge
Post Reply
cboling
Posts: 24
Joined: Fri 12 Apr 2013 01:00

How to connect the SSH server to my app instead of a CMD shell

Post by cboling » Thu 08 Feb 2018 19:48

This has to fall in the "dumb question" category, but I've spent a lot of time trying to figure it out without success. (Surely I'll get it as soon as I post this...)

I successfully created a simple SSH server test app. When TScSSHServer gets a client connection (with a shell request) it connects it directly to a CMD shell.

How do I instead make it so that the client can interact with my server application instead of a CMD shell?

Based on my understanding of the documentation, I tried setting DIRECT in the BeforeChannelConnect event but it doesn't seem to make any difference; behavior seen by client is unchanged, and my OnDataFromClient event handler isn't called.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: How to connect the SSH server to my app instead of a CMD shell

Post by ViktorV » Fri 09 Feb 2018 13:59

When setting the Direct property to True in the TScSSHServer.BeforeChannelConnect event handler, a direct channel will be established for communication between the client and the server only when using port forwarding and will not work when using the shell.
To solve your task, you can use port forwarding and set the Direct property to True in the TScSSHServer.BeforeChannelConnect event handler.

cboling
Posts: 24
Joined: Fri 12 Apr 2013 01:00

Re: How to connect the SSH server to my app instead of a CMD shell

Post by cboling » Fri 09 Feb 2018 17:48

Thanks for the response, Viktor. Now when you say "port forwarding", I visualize SSH tunnels (e.g. OpenSSH client uses "-L" / "-R" options to proxy data for other apps), which isn't what I'm talking about at all, so let me clarify.

Right now, when someone types "ssh my_server" (which connects them to TScSSHServer) and authenticates, they're instantly taken directly to an interactive Windows CMD prompt.

What I want to happen instead is that when someone types "ssh my_server" and authenticates, they're then talking to me (meaning my Delphi application that's using TScSSHServer and executes my logic to parse incoming commands from the client and reply to them.)

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: How to connect the SSH server to my app instead of a CMD shell

Post by ViktorV » Mon 12 Feb 2018 12:28

When using port forwarding, the TScSSHServer.BeforeChannelConnect event handler is designed for the Devart SSH Sever bundle with the Devart SSH Client client. We will add the ability to use the TScSSHServer.BeforeChannelConnect event handler for the Devart SSH Sever bundle with the OpenSSH shell in the next build.

stlcours
Posts: 33
Joined: Wed 14 Sep 2011 20:22

Re: How to connect the SSH server to my app instead of a CMD shell

Post by stlcours » Mon 19 Feb 2018 10:31

When the next build will be released? Since the last version has been 4 months. Thanks

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: How to connect the SSH server to my app instead of a CMD shell

Post by ViktorV » Mon 19 Feb 2018 13:50

The new SecureBridge release is planned to release within one week.
You can follow the news about SecureBridge releases in the at http://www.devart.com/news.

Post Reply