我正在尝试使用 curl 通过 ftp 从 Ubuntu 服务器连接到合作伙伴网站。该命令由业务合作伙伴提供
curl -v -kG --ftp-method nocwd --ftp-ssl -cert "domainname.crt" --key "domainname.key" -u user:password ftp://ftp.partner.biz/
我收到以下错误。
* Could not resolve host: domainname.crt
* Closing connection 0
curl: (6) Could not resolve host: domainname.crt
* Trying <ipaddr>:21...
* TCP_NODELAY set
* Connected to ftp.partner.biz (<ipaddr>) port 21 (#1)
< 220 (<partnername>)
> AUTH SSL
< 504 unknown security mechanism
> AUTH TLS
< 234 AUTH TLS OK starting TLS negotiation
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Request CERT (13):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Certificate (11):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS alert, handshake failure (552):
* error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure
* Closing connection 1
我看到我的服务器上正在监听端口 22 和 443
tcp6 0 0 :::22 :::* LISTEN 1570/sshd: /usr/sbi
tcp6 0 0 :::443 :::* LISTEN 5802/apache2
合作伙伴说他们那边没有错误日志。这和 tcp6 有关吗?还是其他原因?我无法更改命令格式,因为合作伙伴说它适用于他们的其他客户。我束手无策。有人能告诉我哪里出了问题吗?
答案1
curl
抱怨说它无法到达“domainname.crt”,因为它不知道此主机名的 IP 地址,从而产生了您问题中提到的以下消息。
* Could not resolve host: domainname.crt
* Closing connection 0
curl: (6) Could not resolve host: domainname.crt
假设您不打算连接到名为“domainname.crt”的某个站点;它很可能是存储在客户端计算机上某处的证书文件的名称。请仔细检查您的curl
命令。它应该是
curl -v -kG --ftp-method nocwd --ftp-ssl --cert "domainname.crt" --key "domainname.key" -u user:password ftp://ftp.partner.biz/
我猜你在--cert
论点中漏掉了一个连字符。
答案2
您的命令有小错误。文本:
-cert "domainname.crt"
必须是
--cert "domainname.crt"