尝试将“test_file”发送到 FTPS 服务器。
curl -v -k --ftp-ssl --tlsv1 --ftp-ssl-reqd --ftp-pasv --key key_nopass.pem --cert client.pem --user 'user:pass' --upload-file test_file ftp://Ftps.example.com:21/
连接成功,但之后失败了。以下是一些输出:
> * Connected to EXAMPLE.COM_IP_ADDRESS (IP_ADDRESS) port 21 (#0)
> < 220 Microsoft FTP Service
> > AUTH SSL
> < 234 AUTH command ok. Expecting TLS Negotiation.
> * successfully set certificate verify locations:
> USER username
< 331 Password required for username.
> PASS thepassword
< 230 User logged in.
> PBSZ 0
< 200 PBSZ command successful.
> PROT P
< 200 PROT command successful.
> PWD
< 257 "/" is current directory.
* Entry path is '/'
> EPSV
* Connect data stream passively
< 229 Entering Extended Passive Mode (|||5013|)
* Trying example.com.ip.addess
0 0 0 0 0 0 0 0 --:--:-- 0:00:09 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:03:09 --:--:-- 0* Connection timed out
* couldn't connect to host
* got positive EPSV response, but can't connect. Disabling EPSV
> PASV
* response reading failed
0 0 0 0 0 0 0 0 --:--:-- 0:03:09 --:--:-- 0
* Closing connection #0
* SSLv3, TLS alert, Client hello (1):
} [data not shown]
curl: (56) response reading failed
好像在“连接到 EXAMPLE.COM_IP_ADDRESS (IP_ADDRESS) )”和“登录”之后,它显示“无法连接到主机“尽管如此,上面的几行似乎是相连的”
更新:使用“--disable-epsv”参数运行相同的命令,似乎它也在尝试打开数据通道端口:
* Connect data stream passively
< 227 Entering Passive Mode (A,B,C,D,19,179).
其中 A、B、C、D 是服务器的 IP,我认为其他的:19、179 是端口。对吗?PS:每次运行命令时,最后一个数字(179)都会增加 1。