Very basic question on Securbridge

Discussion of open issues, suggestions and bugs regarding network security and data protection solution - SecureBridge
Post Reply
piopio
Posts: 17
Joined: Tue 22 Nov 2011 23:41

Very basic question on Securbridge

Post by piopio » Tue 10 Jan 2012 19:55

Hello there,

I am taking the very first steps with Securbridge and want to set up a secure tunnel SSH connection and I have a problem with compiling the source code.

I dropped in a form the following components:

ScSSHClient
ScSSHChannel
ScFileStorage
PgTable
PgConnection
DBGrid
PgDataSource

then filled the following properties:

PgConnection.database =database name
PgConnection.password =password to access the remote db
PgConnection.port =5432
PgConnection.server =localhost
PgConnection.username=username

ScSSHClient.hostname =postgres ssh address provided by the hosting website
ScSSHClient.password=provided by the hosting website
ScSSHClient.port=7822 which is the port the postgres server listens
ScSSHClient.user=provided by the hosting website
ScSSHClient.privatekeyname= blank

ScFileStorage. All properties are the default ones

ScSSHChannel.desthost=localhost
ScSSHChannel.destport = 5432
ScSSHChannel.sourceport=5433

I flagged all connected checkboxes of the above components, then connected the pgtable with pgdatasource and dbgrid and I can see all data of the remote DB.

At this stage I tried to compile and run the project but I have the error message "host key not verified".

What did I forget to do exactly ? why I can see the correct data at design time but can't run the application ?


Many thanks


Alberto Paganini

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

Post by Dimon » Thu 12 Jan 2012 12:44

This error occurs if the key received from the server and the key specified in HostKeyName do not match. You should handle the TScSSHClient.OnServerKeyValidate event.
You can look at the example of handling this event in the SSHClient demo.

Code: Select all

procedure TForm1.ScSSHClientServerKeyValidate(Sender: TObject;
  NewServerKey: TScKey; var Accept: Boolean);
var
  Key: TScKey;
  fp, msg: string;
begin
  Key := ScFileStorage.Keys.FindKey(ScSSHClient.HostName);
  if (Key = nil) or not Key.Ready then begin
    NewServerKey.GetFingerPrint(haMD5, fp);
    msg := 'The authenticity of server can not be verified.'#13#10 +
           'Fingerprint for the key received from server: ' + fp + '.'#13#10 +
           'Key length: ' + IntToStr(NewServerKey.BitCount) + ' bits.'#13#10 +
           'Are you sure you want to continue connecting?';

    if MessageDlg(msg, mtConfirmation, [mbOk, mbCancel], 0) = mrOk then begin
      Key := TScKey.Create(nil);
      try
        Key.Assign(NewServerKey);
        Key.KeyName := ScSSHClient.HostName;
        ScFileStorage.Keys.Add(Key);
      except
        Key.Free;
        raise;
      end;

      Accept := True;
    end;
  end;
end;

drmoorejr
Posts: 12
Joined: Fri 04 Aug 2017 20:19

Re: Very basic question on Securbridge

Post by drmoorejr » Wed 09 Aug 2017 17:06

Using the example above, I get:

This Error: E2003 Undeclared identifier: 'haMD5'

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

Re: Very basic question on Securbridge

Post by ViktorV » Thu 10 Aug 2017 07:05

haMD5 is declared in the ScUtils unit. To solve the problem, please add the ScUtils unit in the USES clause of your module.

Post Reply