2017-06-29 13 views
0

非常にシンプルに聞こえるかもしれませんが、動作させることはできません。私はコマンドラインでWindows上のSSL証明書でFTPに接続したい。 だから私は、私はそれが「CER」形式にエクスポートして、試して、多くの後、私は、このコマンドラインで終了し、IISと私の証明書を生成します。windowsコマンドラインでssl証明書を使用したFTP接続

curl -3 -v --cacert "XX\XX\test_certif.cer" --disable-epsv --ftp-skip-pasv-ip --ftp-ssl ftp://XXXXXXX --user XXXX 

とパスワードを入力した後、私はこのエラーがあります:

Enter host password for user 'XXXXXX': 
* Rebuilt URL to: ftp://XXXX/ 
* Trying XX::XX:XX:XX... 
* TCP_NODELAY set 
* Connected to XXXXX (XX::XX:XX:XX:XX) port 21 (#0) 
< 220 Microsoft FTP Service 
> AUTH SSL 
< 234 AUTH command ok. Expecting TLS Negotiation. 
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH 
* successfully set certificate verify locations: 
* CAfile: XX\XX\test_certif.cer 
CApath: none 
* SSLv3 (OUT), TLS handshake, Client hello (1): 
* Unknown SSL protocol error in connection to XXX:21 
* Closing connection 0 
curl: (35) Unknown SSL protocol error in connection to XXX:21 

私はそれを機能させるために考えています。 ftpのsslパラメータを "Needs ssl connexion"から "ssl connexion allowed"に変更したときに、私のftpの作業を少しでも進めるには、このように問題はありません。 Windowsファイアウォールは無効です。

更新、私はまだそれに取り組んで、私は今、このコマンドラインを持っている:この出力で

curl -v --cacert "XX\XX\test_certif.cer" --ftp-ssl ftp://XXX --user XXX 

Enter host password for user 'XXX': 
* Rebuilt URL to: ftp://XXX 
* Trying XX::XX:XX:XX:XX... 
* TCP_NODELAY set 
* Connected to XXX (XX::XX:XX:XX:XX) port 21 (#0) 
< 220 Microsoft FTP Service 
> AUTH SSL 
< 234 AUTH command ok. Expecting TLS Negotiation. 
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH 
* successfully set certificate verify locations: 
* CAfile: XX\XX\test_certif.cer 
    CApath: none 
* TLSv1.2 (OUT), TLS header, Certificate Status (22): 
* TLSv1.2 (OUT), TLS handshake, Client hello (1): 
* TLSv1.2 (IN), TLS handshake, Server hello (2): 
* TLSv1.2 (IN), TLS handshake, Certificate (11): 
* TLSv1.2 (OUT), TLS alert, Server hello (2): 
* SSL certificate problem: unable to get local issuer certificate 
* Closing connection 0 
* TLSv1.2 (OUT), TLS alert, Client hello (1): 
curl: (60) SSL certificate problem: unable to get local issuer certificate 
More details here: https://curl.haxx.se/docs/sslcerts.html 

curl performs SSL certificate verification by default, using a "bundle" 
of Certificate Authority (CA) public keys (CA certs). If the default 
bundle file isn't adequate, you can specify an alternate file 
using the --cacert option. 
If this HTTPS server uses a certificate signed by a CA represented in 
the bundle, the certificate verification probably failed due to a 
problem with the certificate (it might be expired, or the name might 
not match the domain name in the URL). 
If you'd like to turn off curl's verification of the certificate, use 
the -k (or --insecure) option. 

は、任意のアイデアを得ましたか? 必要に応じて質問を更新してください。 Thx by advance

答えて

0

私は私の問題を解決します。問題は、IISがcurlで作業していないことによる証明書の使用でした。

だから私は、キーを生成するためにOpenSSLを使用します。

openssl genrsa -des3 -out key.pem -passout pass:password 1024 

はその後、まだキーでcertificatを生成するためにOpenSSLを使用します。

req -x509 -new -key key.pem -passin pass:password -days 3650 -out certificat.cer -config "C:\Program Files (x86)\GnuWin32\share\openssl.cnf" 

-configは、必要に応じて必要ではなく、上に配置されていますあなたのopensslインストールのフォルダ

まだOpenSSLで、キー+ certificatをpfxに変換する

pkcs12 -inkey key.pem -in certificat.cer -export -out iis_certificate.pfx 

これで、pfx証明書をIISにインポートし、それを使用してFTP接続を構成できます。

pemファイルを作成し、彼の中にcertificat.cerの内容をコピーするか、ファイルをpemに変換してください。ここで

curl -v ftp://"IP or server name" --user « username » --ftp-ssl --cacert « Path of cacer.pem file » 

は、コマンドラインでファイルと設定PASSORDをアップロードするために少しのボーナス、コマンドラインです:

curl -upload-file “Path of file to transfert” ftp://"IP or server name" --user « user »: « password » --ftp-ssl --cacert " Path of cacer.pem file " 
名前を「cacer.pem」

今の接続にカールを使用できます

関連する問題