我正在使用git-ftp来部署某些站点,而使用一台服务器我无法通过TLS建立连接。
curl -vv --insecure ftps://linux12.unixserver.org:21
* Rebuilt URL to: ftps://linux12.unixserver.org:21/
* Trying 212.63.145.118...
* TCP_NODELAY set
* Connected to linux12.unixserver.org (212.63.145.118) port 21 (#0)
* successfully set certificate verify locations:
* CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* error:1408F10B:SSL routines:ssl3_get_record:wrong version number
curl: (35) error:1408F10B:SSL routines:ssl3_get_record:wrong version number
我已经找到了其他几个问题,但我的问题并不匹配。
--insecure
也会失败,因此它不能成为证书信任问题--cacert
,不起作用--tls-max 1.2
将版本更改为1.2,但它不会改变任何内容某些来源声明,当服务器根本不提供证书时,也会发生此错误。
openssl s_client -connect linux12.unixserver.org:21 -starttls ftp
提供证书,这似乎没问题。
我可以通过Nautilus成功连接,但它警告我证书,发行人是未知的。
非常感谢任何有关其他尝试的提示。
实际上这个案件涉及两个问题。
1)ftps
是仅支持显式tls的服务器的错误协议。
正确的协议将是ftpes
。如果curl没有编译支持它,你可以使用--ssl-reqd
来强制执行TLS,或者只使用--ssl
。
在git-ftp的上下文中,即使curl是用ftpes
编译的,它也能工作。
2)服务器未提供有效的证书链,因此无法验证证书。
这是目前的ftp certificate bug in plesk。
解决方案是手动检索证书链并通过--cacert <file>
提供链。如果它是自签名的,请提取公钥并使用--pinnedpubkey <file>
。
非常感谢Daniel Stenberg的正确提示。