help with connecting securebridge to MyDac

Discussion of open issues, suggestions and bugs regarding network security and data protection solution - SecureBridge
Post Reply
docH
Posts: 59
Joined: Sun 22 Dec 2013 15:18

help with connecting securebridge to MyDac

Post by docH » Thu 16 Apr 2020 11:21

I use MyDac's TMyConnection to connect to a remote MySQL database from a Delphi 2009 application. Today I purchased and installed Securebridge withe the promise from the web page that
it is enough to place several components on the form and specify the server address and user credentials to establish a secure connection.
The demos came with no instructions, over complex source code and gave me errors saying "cannot create file "C:\Users\public\documents\devart\securebridge for rad stuio 2009\demos\sshClient\54.36.162.178.key"

There seems to be some help files in C:\Program Files (x86)\Devart\SecureBridge for RAD Studio 2009\Doc
but I can't open them with anything.

Can someone post a very simple guide as to what components I need to put on my form and how I connect them to TMyConnection so that my normal remote connection can be an encrypted one.

(Or have I just wasted $99 ?)

Edit. The access denied was my AV but having allowed access the SSHClient demo now errors with
Project SSHClient.exe Authentication failed public key, gssapi-keyex,gssapi-with-mic,password

so I'm no better off.

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

Re: help with connecting securebridge to MyDac

Post by ViktorV » Thu 16 Apr 2020 12:11

To solve the issueyou must have both MyDAC and SecureBridge installed.
You can get the needed information in our documentation: https://www.devart.com/mydac/docs/ssh.htm

As we noted earlier, the TMySSHIOHandler (TMySSLIOHandler) component is located in the mydacsbridge package. This package comes with MyDAC, not with SecureBridge, and is included in the MyDAC demos. See the package installation instructions in the file "%MyDACDemos%\TechnologySpecific\SecureBridge\Readme.html", where %MyDACDemos% is the MyDAC Demo projects installation path on your computer.
After successfully compiling and installing the mydacsbridge package, you should see the TMySSHIOHandler component in the MyDAC palette.
Our SSH (SSL) demo project is located in the directory %MyDACDemos%\TechnologySpecific\SecureBridge\Demo\SSH (SSL), where %MyDACDemos% is the MyDAC Demo projects installation path on your computer. The SSH demo project is located in MyDAC Demo projects, not in SecureBridge demo projects.

docH
Posts: 59
Joined: Sun 22 Dec 2013 15:18

Re: help with connecting securebridge to MyDac

Post by docH » Thu 16 Apr 2020 14:19

Thank you. I already have MyDac installed and have been using it for some years.

I found the mydacsbridge.pkg and opened it in delphi. This showed me
mydacsbridge120.bpl in the project manager together with the 'contains' MyIOHandlerDesign.pas, MyIOHandlerReg.pas, MySSHIOHandler.pas and and the 'requires' of designide.dcp, mydac120.dcp, rtl.dcp, sbridge120.dcp, vcl.dcp

Right clicking on mydacsbridge120.bpl and selecting 'compile' gave me the error
[DCC Fatal Error] CRSSHIOHandler.pas(61): F1026 File not found: 'ScSSHUtil.dcu'
in the unit CRSSHIOHandler in the 'uses' section at line 61;

and if I do a syntax check on mydacsbridge120.bpl it stopped in unit MySSHIOHandler with the error
[Pascal Fatal Error] MySSHIOHandler.pas(6): F2051 Unit CRSSHIOHandler was compiled with a different version of ScSSHChannel.TScSSHChannel
The only copy of CRSSHIOHandler.dcu I could find was in C:\Program Files (x86)\CodeGear\RAD Studio\6.0\lib (dated 2015, presumably from when I first installed myDAC. I renamed it to zzCRSSHIOHandler.dcu and tried to compile again but still got the first error about ScSSHUtil.dcu missing so was not able to re-create CRSSHIOHandler.dcu.

A search of my entire disc found ScSSHUtil.dcu in C:\Program Files (x86)\Devart\SecureBridge for RAD Studio 2009\Lib dated 26th Dec 2019, so I added that path to Tools | options | Library - Win 32 | debug dcu path and also to 'Browsing path' (it was already in 'library Paths'). However on compiling mydacsbridge120.bpl I still got
[DCC Fatal Error] CRSSHIOHandler.pas(61): F1026 File not found: 'ScSSHUtil.dcu'

This seems quite a lot of manual operations to install something costing $100. Is there anything else I need to do?

docH
Posts: 59
Joined: Sun 22 Dec 2013 15:18

Re: help with connecting securebridge to MyDac

Post by docH » Fri 17 Apr 2020 08:00

Would it be better if I raised this under support, since I have a year's suppot?

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

Re: help with connecting securebridge to MyDac

Post by ViktorV » Fri 17 Apr 2020 09:25

To successfully compile the package mydacsbridge, you should use compatible versions of MyDAC and SecureBridge. The given error may occur when you use incompatible versions of MyDAC and SecureBridge.
For example, the latest SecureBridge version 9.2.4 is compatible with the latest MyDAC version 10.1.3, whereas MyDAC 8.4.12 is compatible with SecureBridge 6.4.6.
To accomplish your task, you should download and install compatible versions of SecureBridge and MyDAC.
You may also let us know your MyDAC version, if it's different from the above versions, and we'll send you the compatible SecureBridge version.
We recommend though using the latest versions of our products as they contain many hotfixes and improvements that contribute to high stabilibty and efficiency of the product.
We cannot guarantee the stable operation of older versions since they may lack support for new functionality which was added in newer versions of database systems.

docH
Posts: 59
Joined: Sun 22 Dec 2013 15:18

Re: help with connecting securebridge to MyDac

Post by docH » Sat 18 Apr 2020 13:36

Thank you for the reply. Nowhere on Devart's compatibility page at https://www.devart.com/sbridge/compatibility.html says that it won't work with existing MyDac installations and that after spending $100 on securebridge I must spend another $100 to upgrade MyDac.

However I have now done that and purchased MyDac 10.1.3, even though I was sceptical that the upgrade would go smoothly. I have the following errors

I completely reinstalled all parts of MyDac 10.1.3in the folder

Code: Select all

C:\Users\Admin\Documents\RAD Studio\3rd Party components\Devart MyDac\ver 10.1.3

with the demos in

Code: Select all

C:\Users\Admin\Documents\RAD Studio\3rd Party components\Devart MyDac\ver 10.1.3\Demos
(Even that didn't go smoothly as the first time the install program added 'Rad Studio 2009' onto the end of the path I specified and the folder edit box is too small to notice. However I uninstalled and re-installed in the folders above.)

Opening Delphi 2009 to following the instructions in readme.html I once again got the error

Code: Select all

"The procedure entry point @Idiohandler@TIdIOHandler@InpitLn$qqrx20System@UnicodeStringoixx20Idglobal@TIEncoding could not be located in the dynamic link library IndyCore20.bpl"
But after what you said I ignored that and following the instructions in readme.html I opened the package

Code: Select all

mydacsbridge120.dpk
from where it was installed installed at

Code: Select all

C:\Users\Admin\Documents\RAD Studio\3rd Party components\Devart MyDac\ver 10.1.3\Demos\TechnologySpecific\SecureBridge\Delphi12
On right clicking and clicking compile I got the errors

Code: Select all

CRSSLIOHandler.pas(179): E2003 Undeclared identifier: 'ProxyOptions'
CRSSLIOHandler.pas(179): E2066 Missing operator or semicolon
dacsbridge260.dpk(41): F2063 Could not compile used unit 'CRSSLIOHandler.pas'
I noticed from forum post viewtopic.php?f=27&t=40506 that this is a known bug (at least it's known to Devart, but not mentioned on your sales website) so following the advice in that post I commented out

Code: Select all

if ProxyOptions <> nil then
  SSLClient.ProxyOptions.Assign(ProxyOptions);
in the TCRSSLIOHandler.Connect method.

mydacsbridge120.dpk then appeared to compile OK with just the warning

Code: Select all

[DCC Warning] mydacsbridge120.dpk(43): W1033 Unit 'CRSSLIOHandler' implicitly imported into package 'mydacsbridge120'
appearing twice

I then clicked install but got the error

Code: Select all

Unable to install package C:\users\Public\Documents\Rad Studio\6.0\bpl\mydacsbridge120.bpl
and there is no

Code: Select all

TMySSHIOHandler
component in the palette

Also, trying to open any Delphi project still gives the error

Code: Select all

"The procedure entry point @Idiohandler@TIdIOHandler@InpitLn$qqrx20System@UnicodeStringoixx20Idglobal@TIEncoding could not be located in the dynamic link library IndyCore20.bpl"
and there is no TIdIOHandler component in the palette.

The readme.html says
In the Library path field, specify the path to the directory containing the compiled packages.
although it doesn't say what the 'compiled package is called so I don't really know the path. However I have the paths
C:\Users\Admin\Documents\RAD Studio\3rd Party components\Devart MyDac\ver 10.1.3\lib
C:\Users\Admin\Documents\RAD Studio\3rd Party components\Devart MyDac\ver 10.1.3\bin
C:\Program Files (x86)\CodeGear\RAD Studio\6.0\lib
C:\Program Files (x86)\CodeGear\RAD Studio\6.0\bin
C:\Users\Public\Documents\RAD Studio\6.0\Bpl
in my library path

Delphi's package output folder is set to $(BDSCOMMONDIR)\Bpl and $(BDSCOMMONDIR) is set to C:\Users\Public\Documents\RAD Studio\6.0
and mydacsbridge120.bpl is in C:\Users\Public\Documents\RAD Studio\6.0\bpl, with a creation date of today.



Was I right to be sceptical or have I done something wrong?

BTW I'd rather have the indy component installed as well, just in case it comes in handy, and anyway I've paid for it!

docH
Posts: 59
Joined: Sun 22 Dec 2013 15:18

Re: help with connecting securebridge to MyDac

Post by docH » Sat 18 Apr 2020 20:12

I have got a little further. After shutting down Delphi and restarting it I compiled mydacsbridge120.dpk for the umpteenth time and this time it installed mydacsbridge120.dpk successfully and I got the components TMySSHIOHandler and TMySSLIOHandler
(although I'm still getting the error about The procedure entry point @Idiohandler@TIdIOHandler@InpitLn$qqrx20System@UnicodeStringoixx20Idglobal@TIEncoding etc)

I then installed Securebridge 9.2 and got those components as well.

Finally I attempted to follow the SHH tutorial you suggested at https://www.devart.com/mydac/docs/ssh.htm
The tutorial says to place a TCRSSHIOHandler on the form but there isn't a component of that name so I took a guess and put a TMySSHIOHandler on instead.

I followed the tutorial to construct the application, made the two keys, made a new user on my database, transferred the public key to the server through cpanel and authorised it. I couldn't put port 3311 into TMyConnection as shown in the tutorial as my server refused to connect, Port 22 wouldn't connect either so I left it as port 3306 that works OK and is what I usually use.

In the TQuery I put the sql SHOW STATUS so that I could check if it is using SSL. The application runs and shows me the status values. I shows that it's not using SSL I can't see how to tell if its using SSH.

However using wireshark seemed to indicate the transmission was in plain text.

So the questions now are
1) How can I check if the connection really is using SSH or not?

2) Can I distribute the application 'as is' or do I have to distribute the private key as well and install it in the same location as it is on my development pc?

3) And especially, How do I stop Delphi giving me the error

Code: Select all

"The procedure entry point @Idiohandler@TIdIOHandler@InpitLn$qqrx20System@UnicodeStringoixx20Idglobal@TIEncoding could not be located in the dynamic link library IndyCore20.bpl"

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

Re: help with connecting securebridge to MyDac

Post by ViktorV » Wed 22 Apr 2020 14:10

To use TMySSHIOHandler, you should have a running SSH server which has access to the MySQL server. Ideally the SSH server should be running on the same machine as the MySQL server. In the TMyConnection component, all properties related to the MySQL server (Host, Port, User, Password) should be assigned values according to your server settings (for example, if the port is 3306, then you should assign TMyConnection.Port = 3306). All properties for the SSH server connection are set up in the TScSSHClient component (for example, if the default port 22 is used in the SSH server, then TScSSHClient.Port = 22).
1. If you've set the property TMyConnection.IOHandler to TMySSHIOHandler, SSH will be used to connect to the server.
2. If you're going to use a private key, you should import it as a descendant of the TScStorage component. If you're using the TScFileStorage component, a file with the .key extension will be created when importing a private key. It will be located in the path from TScFileStorage.Path, in which case, when your application is deployed on any other machine, SecureBridge will look for files with the .key extension in the directory specified in TScFileStorage.Path.
3. As we noted earlier, when installing SecureBridge using the installer, you can use the option Indy Components is set during installation at the "Select Components" step of the SecureBridge installation wizard.
This option allows you to install Indy non-standard components, and Devart SecureBridge Components for Indy that include the TScIdIOHandler component, which serves as an adapter between SecureBridge and Indy to create a secure SSH connection.
When this option is enabled, Devart SecureBridge Components for Indy will be automatically installed when installing SecureBridge. If you do not plan to use SecureBridge and Indy to create a secure SSH connection, then you do not have to select this option.
To uninstall Devart SecureBridge Components for Indy to perform the following step:
- remove Devart SecureBridge Components for Indy from [Components]-[Install Packages].

Post Reply