(从StackOverflow移动)我被要求使用客户端身份validation证书来设置FTPS连接。 我是客户端,连接到服务器。 我在Windows 7工作站上,在防火墙后面,尽pipe这个连接最终将在专用的CentOS虚拟机上使用。 其他一些信息:
我从Comodo购买了证书,并用IE10生成了证书。 我使用私钥和扩展属性以.pfx格式从IE中导出了完整的证书。
我写了一个batch file,使用OpenSSL从.pfx中提取必要的部分:
::Extract the private key from the PFX openssl pkcs12 -in comodo.pfx -nocerts -out encrypted.key ::Extract unencrypted private key openssl rsa -in encrypted.key -out decrypted.key ::Extract the public cert in Base64 from the PFX openssl pkcs12 -in comodo.pfx -clcerts -nokeys | openssl x509 -out comodo.cer ::Extract the chain bundle from the PFX openssl pkcs12 -in comodo.pfx -nodes -nokeys -cacerts | openssl x509 -out comodo.crt
使用提取的关键部分,我一直在尝试使用各种curl(v7.46.0)命令连接到FTPS服务器。 连接保持失败。 我最近的尝试如下。 这个错误几乎总是一样的。
curl -3 -k -v --ftp-ssl --tlsv1.2 --ftp-ssl-reqd --ftp-pasv --key decrypted.key --cacert comodo.crt --cert comodo.cer --user REMOVED:REMOVED ftp://ftps.REMOVED/
输出的一个例子是:
> curl -3 -v -k --user REMOVED:REMOVED --ftp-ssl --tlsv1.2 --ftp-ssl-reqd --ftp-skip-pasv-ip --cert comodo.cer --key priv.pem ftp://ftps.REMOVED/ * Trying REMOVED_IP. * Connected to ftps.REMOVED (REMOVED_IP) port 21 (#0) < 220 Service ready for new user. > AUTH SSL < 234 Command AUTH okay; starting SSL connection. * ALPN, offering http/1.1 * Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH * TLSv1.2 (OUT), TLS header, Certificate Status (22): * TLSv1.2 (OUT), TLS handshake, Client hello (1): * Unknown SSL protocol error in connection to ftps.REMOVED:21 * Closing connection 0 curl: (35) Unknown SSL protocol error in connection to ftps.REMOVED:21 >pause Press any key to continue . . .
奇怪的是,如果我连接FileZilla,我似乎可以通过TLS握手,但是当我尝试上传文件时遇到了不同的错误。 由于这个连接最终会被curl,所以我专注于这个方法。
我已经试了一个多星期了 服务器pipe理员已经从我的提供商那里购买了一个证书,并且可以无问题地连接 我被困在这一个。 任何帮助将不胜感激。 一般curl / ftpsdebugging技巧也将不胜感激。
这最终是一个非FTP问题。 客户端系统只允许一个CA证书与一个用户关联,所以我们的一些虚拟用户阻止了CA密钥被接受。 感谢大家的帮助。