有时普通的FTP并没有完全削减它......当你需要通过SSIS软件包进行安全的FTP时,你会推荐哪种产品?
在回答之前,请查看某人是否已经提出相同的建议,如果是,请将其投票.
NOTE: 理想情况下,它需要处理SSH和SSL FTP连接,但如果它最有意义,我会考虑两个独立的组件....
根据Spolsky的说法,我不能称自己为开发者,所以这个问题背后有很多耻辱......
场景:从C#应用程序,我想从SQL数据库中获取一个字符串值,并将其用作目录的名称.我有一个安全(SSL)FTP服务器,我想在其上使用数据库中的字符串值设置当前目录.
问题:一切正常,直到我点击一个带有"特殊"字符的字符串值 - 我似乎无法正确编码目录名以满足FTP服务器.
下面的代码示例
Process _winscp = new Process();
byte[] buffer;
string nameFromString = "Sinéad O'Connor";
_winscp.StandardInput.WriteLine("cd \"" + nameFromString + "\"");
buffer = Encoding.UTF8.GetBytes(nameFromString);
_winscp.StandardInput.WriteLine("cd \"" + Encoding.UTF8.GetString(buffer) + "\"");
buffer = Encoding.ASCII.GetBytes(nameFromString);
_winscp.StandardInput.WriteLine("cd \"" + Encoding.ASCII.GetString(buffer) + "\"");
byte[] nameFromBytes = new byte[] { 83, 105, 110, 130, 97, 100, 32, 79, 39, 67, 111, 110, 110, 111, 114 }; …Run Code Online (Sandbox Code Playgroud) 除了Apache commons-net FTPSClient之外,您是否知道任何优秀的开源库与FTPS站点进行交互
问候,
我了解到在PHP for Windows下使用ftps('ftp_ssl_connect()')很难.您被要求进入构建自己的二进制文件以包含Open SSL的漫长旅程...我发现有关phpseclib的建议作为替代(但是获得openssl.cnf支持对等验证的权利对我来说也很难......) .
然后我点击了这篇文章,其令人愉快的简单示例包括工作对等验证(以避免中间人攻击)引起我对流的注意:
$uri = 'https://www.bankofamerica.com/';
$ctx = stream_context_create(['ssl' => [
'verify_peer' => true, // important
'cafile' => '/hard/path/to/cacert.pem',
'CN_match' => 'www.bankofamerica.com'
]]);
$html = file_get_contents($uri, FALSE, $ctx); // we are good
Run Code Online (Sandbox Code Playgroud)
但是,这对ftp连接有用吗?我还可以使用经过对等验证的流上下文来打开ftps流吗? php手册提示,ssl上下文选项也适用于sftp,但缺乏进一步的指导.
所以我疯狂地猜测:
$ctx = stream_context_create(['ftps' => [
'verify_peer' => true,
'cafile' => 'd:/sandbox/mycerts.pem',
'CN_match' => 'ftp-12345678.mywebhoster.com'
]]);
Run Code Online (Sandbox Code Playgroud)
对?错误?用户+密码现在作为选项?然后什么?用户/密码呢?还是以后?我无能为力......
这有甚么可能吗?(几行代码将非常有用....)或者流是否仅适用于单一文件访问?
更新:Curl可能会做我想要的(包括对等验证和目录lsiting),如本SO答案所示.本周晚些时候会检查......
I am trying to get the directory list of a FTPS FileZilla server using the code below :
ftpRequest = (FtpWebRequest)FtpWebRequest.Create(host + "/" + directory);
ftpRequest.EnableSsl = true;
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(ValidateCertificate);
ftpRequest.Credentials = new NetworkCredential(user, pass);
ftpRequest.UseBinary = true;
ftpRequest.UsePassive = true;
ftpRequest.KeepAlive = true;
ftpRequest.Method = WebRequestMethods.Ftp.ListDirectory;
ftpResponse = (FtpWebResponse)ftpRequest.GetResponse();
Run Code Online (Sandbox Code Playgroud)
I got an exception when FtpWebResponse)ftpRequest.GetResponse() is executed :
the underlying connection was closed. The server committed a protocol violation.
When I switch to normal FTP connection. Everything …
我正在使用System.Net.FtpClient程序集将文件上载到测试FTP站点.当我运行下面的代码时,文件不会出现在远程位置,除非我使用Thread.Sleep如下所示(我不想使用):
using System;
using System.IO;
using System.Net;
using System.Net.FtpClient;
using System.Security.Cryptography.X509Certificates;
using System.Threading;
namespace FtpsUploadTest
{
/// <summary>
/// The ftp publisher.
/// </summary>
public class FtpPublisher
{
private readonly FtpsSettings _settings;
private readonly IFtpClient _ftpClient;
/// <summary>
/// Initializes a new instance of the <see cref="FtpPublisher"/> class.
/// </summary>
public FtpPublisher()
{
_ftpClient = new FtpClient();
_settings = SettingsReader.GetMySettings();
Init();
}
/// <summary>
/// The publish.
/// </summary>
/// <param name="fileToUpload">
/// The input file path.
/// </param>
public …Run Code Online (Sandbox Code Playgroud) 得到
尝试从套接字流中读取数据超时!
使用 FluentFTP 连接到 FTP 时。
下面是我用来连接的源代码:
Console.WriteLine("Configuring FTP to Connect to {0}", hostname);
ftp = new FtpClient(hostname,port,new NetworkCredential(username,password));
ftp.ConnectTimeout = 600000;
ftp.ReadTimeout = 60000;
ftp.EncryptionMode = FtpEncryptionMode.Explicit;
ftp.SslProtocols = System.Security.Authentication.SslProtocols.Tls;
ftp.ValidateCertificate += new FtpSslValidation(OnValidateCertificate);
ftp.Connect();
Console.WriteLine("Connected to {0}", hostname);
ftp.SetWorkingDirectory(foldername);
Console.WriteLine("Changed directory to {0}", foldername);
Run Code Online (Sandbox Code Playgroud)
void OnValidateCertificate(FtpClient control, FtpSslValidationEventArgs e)
{
// add logic to test if certificate is valid here
e.Accept = true;
}
Run Code Online (Sandbox Code Playgroud)
用于成功连接的 FileZilla 日志文件。我可以通过 FileZilla 连接该位置。日志片段如下:
Console.WriteLine("Configuring FTP to Connect to {0}", hostname);
ftp …Run Code Online (Sandbox Code Playgroud) 我有一个FTPS服务器,我已经可以使用Filezilla和Syncback等客户端.我也有这个FTPS服务器的管理员访问权限,我知道它与TLS一起工作正常,因为我在Filezilla连接日志中看到了"TLS".
但是,我无法使用RCurl库(R版本= 3.4.3,RCurl版本= 1.95-4.9,Windows 7 PC)从R访问此相同的FTPS服务器.我希望它与我的getURL()调用有关.这是当我尝试列出FTPS服务器上的目录中的文件时发生的情况:
library(RCurl)
url <- "FTPS://<myIpaddress>/<path>/"
userpwd <- "myname:mypasswd"
filenames <- getURL(url, userpwd=userpwd, ftp.use.epsv = FALSE, dirlistonly = TRUE, .opts=curlOptions(verbose=TRUE))
Run Code Online (Sandbox Code Playgroud)
它抱怨端口990上的连接被拒绝(可能是FTPS的默认端口?).我碰巧将FTPS服务器设置为使用端口21. Filezilla不需要端口号,所以我也把它留在了这里.但是,明确指定端口21会带来另一个问题......
url <- "FTPS://<myIpaddress>:21/<path>/"
Run Code Online (Sandbox Code Playgroud)
这次投诉是关于"未知协议".不明白.我正在使用侦听端口21的FTPS服务器,我在URL上指定了相同的内容.可能有什么不对?
任何人都可以推荐一些方法来进一步解决这个问题吗?
我正在使用节点模块basic-ftp尝试通过TLS/ SSL建立安全连接。服务器使用通配符 CA 签名证书作为主机名。我似乎无法找到 followig 错误代码的答案。
Connected to 1.1.1.1:21
< 220 Welcome to ftp.foo.com
> AUTH TLS
< 234 Using authentication type TLS
{ Error: unable to verify the first certificate
at TLSSocket.onConnectSecure (_tls_wrap.js:1051:34)
at TLSSocket.emit (events.js:189:13)
at TLSSocket._finishInit (_tls_wrap.js:633:8) code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'
}
Run Code Online (Sandbox Code Playgroud)
您可以在下面找到示例代码:
const ftp = require("basic-ftp");
async establishFtpsConnection() {
const client = new ftp.Client();
client.ftp.verbose = true;
try {
await client.access({
host: "ftp.foo.com",
user: "bar",
password: "1234",
port: 21,
secure: true
});
const list …Run Code Online (Sandbox Code Playgroud) 我正在用C#开发一个FTP服务器,我刚刚使用SslStream类完成了FTPS显式模式功能,一切都很顺利.
我在使用fileZilla> 3.0.11作为客户端时遇到问题.我google arround,似乎sslstream实现没有正确关闭连接.(不发送close_notify警报).使用WinScp,SmartFTP和lftp everithing工作正常.
任何想法或任何其他SSL库?
或者也许某种方式硬编码close_notify警报并发送它?
具体的代码示例会很棒!
创建sslStream:
_sslStream = new SslStream(socket.GetStream());
var _cert = new X509Certificate2(certPath,pass);
_sslStream.AuthenticateAsServer(_cert);
Run Code Online (Sandbox Code Playgroud)
关闭连接:
_sslStream.Close();
socket.Close();
_sslStream = null;
socket = null;
Run Code Online (Sandbox Code Playgroud)
FileZilla 3.6.0.2错误日志:
Response: 150 Opening data connection for LIST
Trace: CFtpControlSocket::TransferParseResponse()
Trace: code = 1
Trace: state = 4
Trace: CFtpControlSocket::SendNextCommand()
Trace: CFtpControlSocket::TransferSend()
Trace: state = 5
Trace: CTlsSocket::OnRead()
Trace: CTlsSocket::ContinueHandshake()
Trace: TLS Handshake successful
Trace: TLS Session resumed
Trace: Cipher: AES-128-CBC, MAC: SHA1 …Run Code Online (Sandbox Code Playgroud)