Page 1 of 1

ssh connection using socket

Posted: Sat 26 Feb 2022 11:54
by sparemaster
I need to establish a ssh connection via socket to connect to a MySQL database.

How to setup ScSSHClient similar to

ssh -L 5001:/var/lib/mysql/mysql.sock user@server

environment: MyDAC 11.0.2 Professional / SecureBridge 10.0.1 / RAD-Studio 11

Re: ssh connection using socket

Posted: Tue 22 Mar 2022 15:55
by Dimon
In order to create a secure connection to MySQL server via SSH you can use the TMySSHIOHandler component and SecureBridge components.
The TMySSHIOHandler component is intended for communicating between SecureBridge and MyDAC. This component is included into MyDAC as a demo project. You can find the component package by the following path: MyDAC_InstDir\Demos\TechnologySpecific\SecureBridge\Delphi27\mydacsbridge270.dpk.
MyDAC_InstDir is the MyDAC installation directory on your computer.
Just open this package and install it.

Re: ssh connection using socket

Posted: Sat 26 Mar 2022 10:11
by sparemaster
I already have installed TMySSHIOHandler.

With OpenSSH outside my application I establish the ssh connection with this command:
ssh -L 5001:/var/lib/mysql/mysql.sock user@server.
Afterwards TMyConnection works fine.

But how can I configure TScSSHClient accordingly? What parameter(s) correspond to
-L 5001:/var/lib/mysql/mysql.sock?

Thanks for help!

Re: ssh connection using socket

Posted: Mon 04 Apr 2022 12:52
by dzhanhira
Kindly be informed that the way you describe involves using Socks services (mysql.sock).

But SecureBridge does not support Socks services. However, if you use TMyConnection in combination with TMySSHIOHandler, then there is no need to use Socks services because TMyConnection will directly pass data to TScSSHClient without using intermediate sockets or services.

For information on how to configure TMySSHIOHandler, please have a look at our documentation https://docs.devart.com/mydac/ssh.htm
If after reading the article there will be still some questions, feel free to contact us.

Re: ssh connection using socket

Posted: Sat 09 Apr 2022 10:01
by sparemaster
Thanks for your reply.

Since the ssh server I want to connect to is not under my control I have to use the socks service.

Re: ssh connection using socket

Posted: Tue 12 Apr 2022 17:37
by Dimon
Unfortunately, SecureBridge does not support MySQL sock service.