Event Based Operations Problem - WeOnlyDo Discussion board

Event Based Operations Problem (wodFTPServer)

by Anyz, Tuesday, August 31, 2004, 08:45 (7185 days ago)

hi,

I am getting problems in dealing with event based operations of wodFTPDlx. My code looks like:

1- mySFTPObj.Connect 'in connected event i store errorcode in local var
2- mySFTPObj.GetStatus 'return code from local var

problem is right after Connect statement i try to get status , at that time component is performing handshake/authenticating etc so Connected event is not fired and local variable is not set. It returns false.

Same is the case for Operations like LisDir when you have to wait otherwise component busy error occured.

I think some delay is to be introduced between operations and getting their status. Is there any recommended solution to deal with this problem?

Thanks for your time.

Re: Event Based Operations Problem

by wodSupport, Tuesday, August 31, 2004, 10:44 (7185 days ago) @ Anyz

Anyz,

hi. Can you please show me more of your code? Do you use Blocking=True setting?

Regards.

Re: Event Based Operations Problem

by Anyz, Tuesday, August 31, 2004, 12:16 (7185 days ago) @ wodSupport

Thanx, setting the blocking true solves the problem.

Can you help me in using certificartes. I set Authentication propery to true. Currently certificates are not installed in OS and i load them in code.

Set objSFTP.Certificate = New Certificate
objSFTP.Certificate.LoadKey strCertFile, strCertFilePwd

the sample file Server.pfx is loaded successfully by component. Is this the only step need at client end?

How and which file i need to import in Server to become certificate aware?

Re: Event Based Operations Problem

by wodSupport, Tuesday, August 31, 2004, 13:44 (7185 days ago) @ Anyz

Anyz,

you must tell me what are you trying to do. Question is: do you need certificate to authenticate with the server at all? Most users don't need this, and think that wodCertificate is required, but it really isn't at all.

If you just want to connect with your login/password, ignore Authentication and certificates and everything. Just set Protocol and try to connect.

If you do want to connect with login/certificate, let me know and I'll explain steps needed to load it.

Let me know.
Kreso

Re: Event Based Operations Problem

by Anyz, Tuesday, August 31, 2004, 14:16 (7185 days ago) @ wodSupport

i successfully connected, downloaded, uploaded, searched file using login/password. In production enviornment however we will be using certificates to authanticate user. Separeate key file for each sftp account will be used.

Therefore i need to connect with server using login/certificate machanism? for which i need to configure the certificates. I hope it helps in understanding scenario.

Re: Event Based Operations Problem

by wodSupport, Tuesday, August 31, 2004, 14:28 (7185 days ago) @ Anyz

Anyz,

forgot to ask - what protocol are you using? What language, VB?

typical scenario would be like this:
[code]
Dim c as new wodCertificate
c.LoadKey path_to_your_secret_key
c.Load path_to_your_certificate

Dim ftp as new wodFtpDLX
ftp.Authentication = authCertificate
set ftp.Certificate = c

ftp.Login = something
ftp.Connect...
[/code]

that's about it. Do you have a certificate? Is server aware of the public key belonging to the certificate?

Regards,
Kreso

Re: Event Based Operations Problem

by Anyz, Tuesday, August 31, 2004, 14:51 (7185 days ago) @ wodSupport

i am using SFTP in VB.

i do not have prior knowledge of certificate. I am planning to use sample certificate provided with component. Server is needed to make public key aware. I am using trial veraion of wodSFTPServer. So will u guide a bit how to make it certificate aware? I believe code you gave is for client side, only thing needed is to select appropriate files from given sample files (ca.cer, cleint.cer, server.cer, client.pfx, server.pfx)

Re: Event Based Operations Problem

by wodSupport, Tuesday, August 31, 2004, 15:09 (7185 days ago) @ Anyz

Anyz,

you're using SFTP and wodFTPServer on the server-side?

In that case, use this code

once only:
[code]Dim c as new wodCertificate
c.GenerateKey RSAKey
c.SaveKey c:\somewhere [/code]

and then later on
[code]Dim c as new wodCertificate
c.LoadKey c:\somewhere

Dim ftp as new wodFtpDLXCom
set ftp.Certificate = c
ftp.Authentication = authCertificate
ftp.Login = something
ftp.Connect[/code]

on wodFTPServer's side, in LoginCertificate event, set Action=Allow. This will blindly accept all certificates (BAD IDEA!) but good enough for your tests. You may need to set wodFTPServer's Authentication property to authCertificate too - so it's aware you will use your public key for authentication.

Can you try that?

Re: Event Based Operations Problem

by Anyz, Tuesday, August 31, 2004, 15:28 (7185 days ago) @ wodSupport

Kreso thx for suggestions. I will try this and let you know if i face any problem.

Certificate/Keys Understandings/Findings

by Anyz, Wednesday, September 01, 2004, 10:33 (7184 days ago) @ Anyz

Here are my understanding/findings while using certificate for user authentication with wodFTDDLX. I am using wodFTXServer component as sftp server on win2000 server. Please correct me where i am wrong:

1- First of all certificates are just used for user authentication they have nothing to do with data encryption. SFTP protocol bening on top of SSH makes sure every data sent over wire is encrypted. Is it correct?

2- Possessing a Public Key mean a user has authority to connect server he/she don't need password in this case. Is it correct?

3- Right now i have used Action=Alow to let every user connect but user specifice keys can be generated and used for each user. How, plz guide me?

4- I generated a key according to steps u mentioned in one of you posting above and start server using that key. Using one of sample program provided with component i generated another key and used this new key to connect server. Server is connected successfully. Shouldn't these keys be related some how?? Both are private keys and generated dirrently. One used by server other by client but user is connected ???? How are these related??

Re: Event Based Operations Problem

by wodSupport, Wednesday, September 01, 2004, 11:48 (7184 days ago) @ Anyz

Anyz,

1- First of all certificates are just used for user authentication >they have nothing to do with data encryption. SFTP protocol bening >on top of SSH makes sure every data sent over wire is encrypted. Is >it correct?

Correct. SSH/SFTP is always encrypted, no matter what type of authentication you select.

2- Possessing a Public Key mean a user has authority to connect >server he/she don't need password in this case. Is it correct?

Correct. You connect with what you have instead of what you know .

3- Right now i have used Action=Alow to let every user connect but >user specifice keys can be generated and used for each user. How, >plz guide me?

In LoginCertificate event there is 'Certificate' argument. When someone connects, you must look in your local list of certificates (what kind of list, how do you keep it, where... is your decision) and see if it matches with what user supplied. So, when user gets new certificate/privatekey for himself, he needs to send you his public key in advance, so you can put it on the list. Later on, when he connects, he supplies his public key to you, you receive it through LoginCertificate event, and you check to make sure it's correct. If it is - you let him access the system.

I suggest you use Certificate.PublicKeyOpenSSH property for these checks. It's always in ASCII. When user creates new key, ask him to send you his PublicKeyOpenSSH property value. Store it locally. When he connects, you check stored value with one supplied in the login process (and provided to you by LoginCertificate). If match is found *for the user*, let him in.

That way it cannot happen that someone just creates new key and connects. You will not have his key in your database - this is important step!

4- I generated a key according to steps u mentioned in one of you >posting above and start server using that key. Using one of sample >program provided with component i generated another key and used >this new key to connect server. Server is connected successfully. >Shouldn't these keys be related some how?? Both are private keys >and generated dirrently. One used by server other by client but >user is connected ???? How are these related??

Yes. I think I just explained it above - server must have list of allowed keys for the user.

Regards,
Kreso

Updating to Licence Version

by Anyz, Thursday, September 02, 2004, 08:23 (7183 days ago) @ wodSupport

For licenced version of wodFTPDLXCom component the following property is to be set.
Ftp1.LicenseKey = xxxx...xxxx

I think this is only setting needed to move on licenced version. Correct?

Is it possible to convert the trial version into licenced one using this property, i doubt this property in supported in trial version?

Re: Event Based Operations Problem

by wodSupport, Thursday, September 02, 2004, 09:02 (7183 days ago) @ Anyz

Anyz,

you're correct. You only need to set LicenseKey version.

But you need to install licensed version first. You cannot 'upgrade' trial version to licensed.

Kreso