ubuntu - 使用 Ubuntu 的 FluentFTP 连接到 FTP 服务器时出现问题
问题描述
我正在使用此代码尝试建立与 Windows FTP 服务的 FTP 连接
FtpClient client = new FtpClient(ip, user, password);
client.ConnectTimeout = 600000;
client.ReadTimeout = 60000;
client.EncryptionMode = FtpEncryptionMode.Implicit;
client.SslProtocols = System.Security.Authentication.SslProtocols.Tls;
client.DataConnectionType = FluentFTP.FtpDataConnectionType.PASV;
client.ValidateAnyCertificate = true;
client.Connect();
在 Windows 机器中,连接已正确建立,但在我的 Ubuntu 机器上无法建立连接,我总是收到错误消息
"error:141E70BF:SSL routines:tls_construct_client_hello:no protocols available"
我怎样才能使这项工作?
==============更新
我尝试了 FTPClient 的 AutoDetect 方法,但该方法没有检索到任何配置文件
AutoConnect 方法似乎也可以连接,但是当我尝试获取文件夹列表时,会出现配置文件需要 SSL 的错误
当我为客户端启用跟踪时,我在日志中得到以下输出:
# Connect()
Status: Connecting to server:21
Response: 220-Microsoft FTP Service
Response: 220 ************************************************************
Status: Detected FTP server: WindowsServerIIS
Command: AUTH TLS
Response: 234 AUTH command ok. Expecting TLS Negotiation.
Status: Disposing FtpSocketStream...
Error: FTPS Authentication Failed
解决方案
我只是想出了如何按照这篇文章的说明进行这项工作:
OpenSSL v1.1.1 Ubuntu 20 TLSv1 - 没有可用的协议
还有这个
https://askubuntu.com/questions/1233186/ubuntu-20-04-how-to-set-lower-ssl-security-level
就我而言,我的目标服务器似乎很旧,nmap 输出是这样的:
21/tcp open ftp
| ssl-enum-ciphers:
| SSLv3:
| ciphers:
| TLS_RSA_WITH_3DES_EDE_CBC_SHA (rsa 2048) - C
| TLS_RSA_WITH_RC4_128_SHA (rsa 2048) - C
| TLS_RSA_WITH_RC4_128_MD5 (rsa 2048) - C
| compressors:
| NULL
| cipher preference: server
| TLSv1.0:
| ciphers:
| TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (secp256r1) - A
| TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA (secp256r1) - A
| TLS_RSA_WITH_AES_256_CBC_SHA (rsa 2048) - A
| TLS_RSA_WITH_AES_128_CBC_SHA (rsa 2048) - A
| TLS_RSA_WITH_3DES_EDE_CBC_SHA (rsa 2048) - C
| TLS_RSA_WITH_RC4_128_SHA (rsa 2048) - C
| TLS_RSA_WITH_RC4_128_MD5 (rsa 2048) - C
| compressors:
| NULL
| cipher preference: server
| warnings:
| 64-bit block cipher 3DES vulnerable to SWEET32 attack
| Broken cipher RC4 is deprecated by RFC 7465
| Ciphersuite uses MD5 for message integrity
| Weak certificate signature: SHA1
|_ least strength: C
我必须配置 openssl 以使用现在几乎不推荐使用的 TLSv1
推荐阅读
- html - CSS 中心 ul 而 li 是文本左对齐
- javascript - 是否可以在 React 中使用流和箭头函数?
- javascript -
全部替换后和在javascript中如何检查字符串是否为空? - javascript - mongoose 上的 save() 函数不起作用
- r - 在 R 中按组使用具有特定样本大小的列表并将其应用于数据集
- excel - 如何从多个文本文件中搜索列表字符串
- apache-flink - 在 RichCoFlatMapFunction 中更新外部数据库
- c# - 在 C# 中的另一个对象内实例化用户定义的对象
- python - 为什么我需要同时从 Crypto 导入 Hash 和从 Crypto.Cipher 导入 PKCS1_OAEP 才能使 Hash.MD5 工作?
- reactjs - 将道具传递给组件:“对象作为 React 子项无效”