Connect to AWS Lightsail UBUNTU

Discussion of open issues, suggestions and bugs regarding network security and data protection solution - SecureBridge
Post Reply
kaffeburk
Posts: 188
Joined: Mon 29 Jan 2007 08:03

Connect to AWS Lightsail UBUNTU

Post by kaffeburk » Sun 16 Jun 2019 23:53

Helllo,

Im trying to connect to AWS, but i dont know how. On DbForge it is easy. Just enter IP number for host, port 22, user and path to private key (a .pam file i got from AWS).

But how do i translate that to Securebridge? I can import the ,pam file in file storage, i can connect in design mode, but when i compile and set connected to true i get "Private Key Not Found". (the provate key is set, to the PAM file).

I also tried to run the "SSH Client.exe" demo and it work with my .pan file, and i can not find any difference but that program is very complicated. Anyway, here is my small project (without the pam file and hostname). PLs tell me what is wrong.

https://www.dropbox.com/s/2taof8o1tjdl2wy/AWS.rar?dl=0

kaffeburk
Posts: 188
Joined: Mon 29 Jan 2007 08:03

Re: Connect to AWS Lightsail UBUNTU

Post by kaffeburk » Mon 17 Jun 2019 10:56

I also mailed a complete example with my private key to support@devart.com.

kaffeburk
Posts: 188
Joined: Mon 29 Jan 2007 08:03

Re: Connect to AWS Lightsail UBUNTU

Post by kaffeburk » Mon 17 Jun 2019 11:28

I extracted the DFM and some proprieties catched just before connect. All identical what i can see:

Devart Working Example:

hostname 3.120.199.143
Port 22
User ubuntu
Password
PrivateKeyName key1
HostKeyName
CiphersClient blowfish-cbc,aes256-ctr,aes256-cbc,aes192-ctr,aes192-cbc,aes128-ctr,aes128-cbc,cast128-cbc,3des-cbc
CiphersServer blowfish-cbc,aes256-ctr,aes256-cbc,aes192-ctr,aes192-cbc,aes128-ctr,aes128-cbc,cast128-cbc,3des-cbc
HostKeyName
Timeout 15

Devart DFM

object ScSSHClient: TScSSHClient
HostKeyAlgorithms = <
item
Algorithm = aaRSA
end
item
Algorithm = aaDSA
end>
HostName = 'localhost'
KeyStorage = ScFileStorage
AfterConnect = ScSSHClientAfterConnect
AfterDisconnect = ScSSHClientAfterDisconnect
OnServerKeyValidate = ScSSHClientServerKeyValidate
OnAuthenticationPrompt = ScSSHClientAuthenticationPrompt
Left = 4
Top = 80
end

My NOT working example
hostname 3.120.199.143
Port 22
User ubuntu
Password
PrivateKeyName key1
HostKeyName
CiphersClient blowfish-cbc,aes256-ctr,aes256-cbc,aes192-ctr,aes192-cbc,aes128-ctr,aes128-cbc,cast128-cbc,3des-cbc
CiphersServer blowfish-cbc,aes256-ctr,aes256-cbc,aes192-ctr,aes192-cbc,aes128-ctr,aes128-cbc,cast128-cbc,3des-cbc
HostKeyName
Timeout 15

My DFM
object Client: TScSSHClient
Authentication = atPublicKey
HostName = '3.120.199.143'
User = 'ubuntu'
KeyStorage = ScFileStorage1
PrivateKeyName = 'key1'
OnServerKeyValidate = ClientServerKeyValidate
Left = 80
Top = 87
end

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

Re: Connect to AWS Lightsail UBUNTU

Post by ViktorV » Tue 18 Jun 2019 14:49

When you import a private key to TScFileStorage, a file with the .key extension is created in the directory specified in the TScFileStorage.Path property: https://devart.com/sbridge/docs/tscfilestorage_path.htm
The "Private Key Not Found" error message comes up when SecureBridge can't find the private key with the name specified in the TScSSHClient.PrivateKeyName property in the directory specified in the TScFileStorage.Path property.

kaffeburk
Posts: 188
Joined: Mon 29 Jan 2007 08:03

Re: Connect to AWS Lightsail UBUNTU

Post by kaffeburk » Wed 19 Jun 2019 06:44

As i wrote in my original post " i can connect in design mode". The key is loaded and working in design. Pls use the example i send You.

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

Re: Connect to AWS Lightsail UBUNTU

Post by ViktorV » Wed 19 Jun 2019 09:44

Your first post has a link to a sample. However, the sample doesn't contain neither the PEM source file, nor the file created when importing, so we are not able to reproduce the issue. To investigate the described behavior of SecureBridge, we need a complete sample with all necessary files. Please send us a sample using the contact form https://devart.com/company/contactform.html
Note, to import private key in run time, you can use the following code:

Code: Select all

...
var
  Key: TScKey;
begin
  Key := TScKey.Create(ScFileStorage.Keys);
  Key.KeyName := 'key1';
  Key := ScFileStorage.Keys.FindKey('key1');
  if keyFile = nil then begin
    Key := TScKey.Create(ScFileStorage.Keys);
    Key.KeyName := 'key1';
    Key.ImportFrom('myPrivateKey');
  end;

Post Reply