cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: connecting to ftps with certificate?

From: Lukasz Szybalski <szybalski_at_gmail.com>
Date: Thu, 12 Jun 2008 11:44:22 -0500

On Thu, Jun 12, 2008 at 9:38 AM, Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Wed, 11 Jun 2008, Lukasz Szybalski wrote:
>
>> I have a certificate in my firefox. I can export it to .p12 file. What do
>> I do next?
>>
>> 1. Convert ,p12 file to what? What would be a command line for that
>> (openssl)
>
> Convert it to PEM. The command line for that is something like:
>
> $

>
> But google has a lot more to tell...
>
>> 2. What is the commend to use the certificate?
>
> It depends. If you have both your cert and key in a file, -E is the option.
> Otherwise you need to specify them both separately. And the keyphrase for
> the key of course.

I run this command as your said:
openssl pkcs12 -in cred.p12 -out certkey.pem -nodes -clcerts

How can I know if it has a key and cert? OR do I assume it has both.

>
>> 3. How can I tell what ftp server wants? ssl, tls, cert, etc?
>
> By what the server responds.
>
>> 4. How can I view the ftp server folder?
>
> By ending the URL with a trailing slash
>
>> 5. What is the command to upload a file?
>
> -T
>
> You really really should consider reading docs or even trying commands
> before asking all these questions.

I did for almost a week and there is so many options out there that it
is hard to figure out what is what. So this list is my last resort.

>
> Without more details that's impossible for us to tell.

1. I don't know if it should ask me for a cert password or not. It doesn't.
2. It connect, at least that what it seems, but I get an error on transfer.
3. Could you comment on this log, and tell me what is what. Where the
cert is ok, where the normal ftp starts, why the file doesn't get
transfered?
4. Is the command I'm using correct?

My command:
curl -E certkey.pem -k -v -u myuser:mypass
ftp://usa.ftptls.edisrvcs.com/ --ftp-ssl -T test1.txt

Here is the log:

* About to connect() to usa.ftptls.edisrvcs.com port 21
* Trying 204.90.130.45... connected
* Connected to usa.ftptls.edisrvcs.com (204.90.130.45) port 21
< 220 intftps2 IE-FTP server (v4r3m0.k) ready on system USA.
> AUTH SSL
< 234 AUTH command accepted - proceed with Negotiation.
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: none
* SSLv2, Client hello (1):
SSLv3, TLS handshake, Server hello (2):
SSLv3, TLS handshake, CERT (11):
SSLv3, TLS handshake, Request CERT (13):
SSLv3, TLS handshake, Server finished (14):
SSLv3, TLS handshake, CERT (11):
SSLv3, TLS handshake, Client key exchange (16):
SSLv3, TLS handshake, CERT verify (15):
SSLv3, TLS change cipher, Client hello (1):
SSLv3, TLS handshake, Finished (20):
SSLv3, TLS change cipher, Client hello (1):
SSLv3, TLS handshake, Finished (20):
SSL connection using DES-CBC-SHA
* Server certificate:
* subject:
* start date:
* expire date:
* common name: usa.ftptls.edisrvcs.com (matched)
* issuer: /C=
* SSL certificate verify result: self signed certificate in
certificate chain (19), continuing anyway.
> USER myusername
< 331 Enter Password.
> PASS mypassword
< 230 Ready - Ignored invalid username, used "USA.xxxx.xxxxx" from
certificate instead.
> PBSZ 0
< 200 Protection buffer size successfully set.
> PROT P
< 200 Data protection level now set to 'P' (Protected).
> PWD
< 257 "*.*/*" is the current directory
* Entry path is '*.*/*'
> EPSV
* Connect data stream passively
< 500 Command not recognized.
* disabling EPSV usage
> PASV
< 227 Entering Secured Passive Mode (204,90,130,45,220,172)
* Trying 204.90.130.45... connected
* Connecting to 204.90.130.45 (204.90.130.45) port 56492
> TYPE I
< 200 Type now set to I.
> STOR test1.txt
< 553 Invalid destination System[ ] Acct[*] Userid[*] Class[*].
* Failed FTP upload: 553
* Uploaded unaligned file size (0 out of 6801 bytes)
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
  0 0 0 0 0 0 0 0 --:--:-- 0:00:02
--:--:-- 0* Connection #0 to host usa.ftptls.edisrvcs.com left
intact

curl: (25) Failed FTP upload: 553
* Closing connection #0
* SSLv3, TLS alert, Client hello (1):
Received on 2008-06-12