WinSCP - 自动接受任何证书

WinSCP - Accept any certificate automatically

我正在使用 WinSCP 命令行实用程序(从 SSIS 启动)和一个如下所示的脚本文件:

option confirm off
open ftps://user:pw@ftp.host.com:3221/root -certificate=*
put \path\to\file\Stores.zip
put \path\to\file\Products.zip
put \path\to\file\Inventory.zip
exit

当我 运行 它没有完成 - 如果我检查日志我看到这个:

. 2018-05-11 10:27:16.413 Connecting to ftp.host.com:3221 ...
. 2018-05-11 10:27:16.546 Connected with ftp.host.com:3221, negotiating SSL connection...
. 2018-05-11 10:27:17.044 Asking user:
. 2018-05-11 10:27:17.045 The server's certificate is not known. You have no guarantee that the server is the computer you think it is. Server's certificate details follow:
. 2018-05-11 10:27:17.045 
. 2018-05-11 10:27:17.046 Issuer:
. 2018-05-11 10:27:17.047 - Organization: Host, Inc., *.host.com
. 2018-05-11 10:27:17.048 - Location: US, State, City
. 2018-05-11 10:27:17.048 
. 2018-05-11 10:27:17.053 Subject:
. 2018-05-11 10:27:17.058 - Organization: CertOrg
. 2018-05-11 10:27:17.060 - Location: US
. 2018-05-11 10:27:17.066 
. 2018-05-11 10:27:17.068 Valid: 7/14/2017 12:00:00 AM - 8/29/2018 12:00:00 PM
. 2018-05-11 10:27:17.074 
. 2018-05-11 10:27:17.075 Fingerprint (SHA1): ##################
. 2018-05-11 10:27:17.075 
. 2018-05-11 10:27:17.076 Summary: Unable to get local issuer certificate. The error occured at a depth of 1 in the certificate chain.
. 2018-05-11 10:27:17.076 
. 2018-05-11 10:27:17.077 If you trust this certificate, press Yes. To connect without storing certificate, press No. To abandon the connection press Cancel.
. 2018-05-11 10:27:17.080 
. 2018-05-11 10:27:17.081 Continue connecting and store the certificate? ()

-certificate=* 应该会根据我在文档中收集到的内容自动推动接受。我在这里遗漏了什么吗?我也试过 hostkey=* 产生相同的结果,并且同时使用主机密钥和证书标志会导致错误。

非常感谢任何帮助。

如果没有看到完整的会话日志文件,很难回答这个问题。

但我的猜测是你使用了一些旧版本的 WinSCP,它不支持 -certificate 中的 *(早于 5.2)或者不支持 -certificate 开关全部(早于 4.2.2)。

使用最新版本的 WinSCP,您的脚本应该可以正常工作。


不用说,使用 *,您将失去对 MITM attacks!

的保护