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
Very basic question on Securbridge
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.
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;
Re: Very basic question on Securbridge
Using the example above, I get:
This Error: E2003 Undeclared identifier: 'haMD5'
This Error: E2003 Undeclared identifier: 'haMD5'
Re: Very basic question on Securbridge
haMD5 is declared in the ScUtils unit. To solve the problem, please add the ScUtils unit in the USES clause of your module.