首页 / 知识

关于asp.net:可编程,安全的FTP替换

2023-04-13 21:44:00

关于asp.net:可编程,安全的FTP替换

Programmable, secure FTP replacement

为了安全起见,我们需要退出传统的FTP(它传输的密码未加密)。 我听说SSH被吹捧为显而易见的替代方案。 但是,我一直在从ASP.NET程序界面驱动FTP来自动化我的网站开发,现在这是一个高度支持Web的过程。

谁能推荐一种安全的方式来传输文件,该方式具有可以从ASP.NET驱动的程序界面?


sharpssh实现通过scp发送文件。


该问题包含三个子问题:

1)选择安全传输协议

存在旧版FTP的安全版本-称为FTP / SSL(通过SSL加密通道的纯旧版FTP)。也许您仍然可以使用旧的部署基础结构-只需检查它是否支持FTPS或FTP / SSL。

您可以在http://www.rebex.net/secure-ftp.net/页面上查看有关FTP,FTP / SSL和SFTP差异的详细信息。

2)Windows的SFTP或FTP / SSL服务器

当选择使用SFTP还是FTPS时,必须部署适当的服务器。对于FTP / SSL,我们在几台服务器上使用Gene6(http://www.g6ftpserver.com/)不会出现问题。有很多FTP / SSL Windows服务器,因此可以使用所需的任何服务器。 Windows的SFTP服务器的情况要复杂一些-只有少数可行的实现。 Bitvise WinHTTPD看起来很有前途(http://www.bitvise.com/winsshd)。

3)ASP.NET的Internet文件传输组件

解决方案的最后一部分是从asp.net安全传输文件。市场上有几个组件。我建议Rebex文件传输包-它同时支持FTP(和FTP / SSL)和SFTP(SSH文件传输)。

以下代码显示了如何通过SFTP将文件上传到服务器。该代码取自我们的Rebex SFTP教程页面。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// create client, connect and log in
Sftp client = new Sftp();
client.Connect(hostname);
client.Login(username, password);

// upload the 'test.zip' file to the current directory at the server
client.PutFile(@"c:\\data\\test.zip","test.zip");

// upload the 'index.html' file to the specified directory at the server
client.PutFile(@"c:\\data\\index.html","/wwwroot/index.html");

// download the 'test.zip' file from the current directory at the server
client.GetFile("test.zip", @"c:\\data\\test.zip");

// download the 'index.html' file from the specified directory at the server
client.GetFile("/wwwroot/index.html", @"c:\\data\\index.html");

// upload a text using a MemoryStream
string message ="Hello from Rebex SFTP for .NET!";
byte[] data = System.Text.Encoding.Default.GetBytes(message);
System.IO.MemoryStream ms = new System.IO.MemoryStream(data);
client.PutFile(ms,"message.txt");

马丁


FTP的传统安全替代方法是SFTP,但是如果您对两个端点都有足够的控制权,则可以考虑使用rsync:它是高度可配置的,仅通过告诉它使用ssh即可保证安全,并且保持两个位置同步的效率要高得多。


过去,我们使用了此解决方案的一种变体,该解决方案使用SSH Factory for .NET


G'day,

您可能想看看ProFPD。

高度可定制。基于Apache的模块结构。

从他们的网站:

ProFTPD grew out of the desire to have a secure and configurable FTP server, and out of a significant admiration of the Apache web server.

我们使用改编版进行大规模的Web内容传输。通常每天更新300,000次。

高温超导

干杯,


替换密码传输加密

最新内容

相关内容

热门文章

推荐文章

标签云

猜你喜欢