ssh connection using socket

Discussion of open issues, suggestions and bugs regarding network security and data protection solution - SecureBridge
Post Reply
sparemaster
Posts: 5
Joined: Sat 05 Jan 2019 10:37

ssh connection using socket

Post by sparemaster » Sat 26 Feb 2022 11:54

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

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Re: ssh connection using socket

Post by Dimon » Tue 22 Mar 2022 15:55

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.

sparemaster
Posts: 5
Joined: Sat 05 Jan 2019 10:37

Re: ssh connection using socket

Post by sparemaster » Sat 26 Mar 2022 10:11

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!

dzhanhira
Devart Team
Posts: 239
Joined: Mon 26 Oct 2020 13:49

Re: ssh connection using socket

Post by dzhanhira » Mon 04 Apr 2022 12:52

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.

sparemaster
Posts: 5
Joined: Sat 05 Jan 2019 10:37

Re: ssh connection using socket

Post by sparemaster » Sat 09 Apr 2022 10:01

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.

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Re: ssh connection using socket

Post by Dimon » Tue 12 Apr 2022 17:37

Unfortunately, SecureBridge does not support MySQL sock service.

Post Reply