cURL安全FTP访问(--FTP ssl控制有效,但--FTP ssl无效)

cURL安全FTP访问(--FTP ssl控制有效,但--FTP ssl无效),curl,ssl,ftp,Curl,Ssl,Ftp,这个问题的标题很有希望解释这个问题,但我正在尝试使用我目前正在编写的shell脚本中的cURL连接到远程FTP服务器 在本地计算机上,我正在运行以下命令: curl --verbose --ftp-ssl -3 --user 'USER:PASS' --disable-epsv ftp://ftp.domain.com:21 建立数据连接后,我看到以下输出: < 230 User USER logged in > PBSZ 0 < 200 PBSZ 0 successful

这个问题的标题很有希望解释这个问题,但我正在尝试使用我目前正在编写的shell脚本中的cURL连接到远程FTP服务器

在本地计算机上,我正在运行以下命令:

curl --verbose --ftp-ssl -3 --user 'USER:PASS' --disable-epsv ftp://ftp.domain.com:21
建立数据连接后,我看到以下输出:

< 230 User USER logged in
> PBSZ 0
< 200 PBSZ 0 successful
> PROT P
< 200 Protection set to Private
> PWD
< 257 "/" is the current directory
* Entry path is '/'
> PASV
* Connect data stream passively
< 227 Entering Passive Mode (000,000,000,000,206,106).
*   Trying 000.000.000.000... connected
* Connecting to 000.000.000.000 (000.000.000.000) port 52842
> TYPE A
< 200 Type set to A
> LIST
< 150 Opening ASCII mode data connection for file list
* Doing the SSL/TLS handshake on the data stream
* SSL re-using session ID
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* 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 DHE-RSA-AES256-SHA
* Server certificate:
* Maxdownload = -1
drwxr-xr-x   2 myserver 29894        4096 May 11 17:52 .
drwxr-xr-x   2 myserver 29894        4096 May 11 17:52 ..
* SSLv3, TLS alert, Client hello (1):
* Remembering we are in dir ""
* SSLv3, TLS alert, Client hello (1):
< 226 Transfer complete
* Connection #0 to host ftp.domain.com left intact
> QUIT
< 221 Goodbye.
* Closing connection #0
* SSLv3, TLS alert, Client hello (1):
在服务器上运行相同的命令会得到以下结果:

< 230 User USER logged in
> PBSZ 0
< 200 PBSZ 0 successful
> PROT P
< 200 Protection set to Private
> PWD
< 257 "/" is the current directory
* Entry path is '/'
> EPSV
* Connect data stream passively
< 229 Entering Extended Passive Mode (|||49727|)
*   Trying 2a01:3b0:1:a0::1:2... connected
* Connecting to 2a01:3b0:1:a0::1:2 (2a01:3b0:1:a0::1:2) port 49727
> TYPE A
< 200 Type set to A
> LIST
< 150 Opening ASCII mode data connection for file list
* Doing the SSL/TLS handshake on the data stream
*   CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
* SSL connection using TLS_DHE_RSA_WITH_AES_256_CBC_SHA
* Server certificate:
* Maxdownload = -1
* Remembering we are in dir ""
< 425 Unable to build data connection: Operation not permitted
* server did not report OK, got 425
* Connection #0 to host ftp.domain.com left intact
curl: (18) server did not report OK, got 425
> QUIT
< 221 Goodbye.
* Closing connection #0
如果我使用-ftp ssl控制开关,它可以在服务器上工作,但是我想对数据传输和身份验证进行加密

有人知道解决这个问题的方法吗?我无法确定这是否与服务器上的防火墙有关,或者与SSL连接和/或会话管理有关-我尝试过使用-no sessionid和-sessionid选项,但没有任何区别,无论是使用主动连接还是被动连接,我都得到了相同的结果


提前谢谢

能否添加更多调试信息,以便查看对PROT p命令的答复,该命令指定了数据连接的保护级别?谢谢-我现在更新了我的问题。这两个输出之间的区别似乎是本地机器使用的是PASV而不是EPSV,并且还重用SSL会话。请注意,我在*Server certificate:行之后省略了SSL证书的详细信息,并屏蔽了IP地址。如果您在服务器上使用完全相同的命令,例如-disable-epsv,则不应使用epsv,但它显然会使用。它是否也会忽略重用SSL会话的选项?proftpd和其他可能要求在默认设置中,在控制和数据SSL连接之间重用会话,这可能解释了425…不允许。看起来服务器上有不同版本的curl-密码以不同的格式报告。感谢Steffen-它似乎忽略了-sessionid设置。两个系统7.19.7上的cURL版本相同,但平台不同本地计算机是OS X,服务器是CentOS,其中一个库是不同的本地计算机是OpenSSL/0.9.8y,服务器是NSS/3.14.0.0。我读到proftpd有一个问题,但我无法从日志中判断正在使用什么类型的FTP服务器。