1

We currently have a process where a user uses Cisco VPN client to establish a secure tunnel to a remote server. They, then, remote desktop into a machine on the remote network. While on the remote machine, they fire up SQL Server 2008 Enterprise manager, run a query that produces a CSV file. The file is then manually transferred back to their local machine.

This process only needs to happen once a month to pull this CSV (report) from our remote machines.

The transport is IPSec/UDP.

I am having trouble finding any kind of help being able to do this through a script. Is this possible? If not through PHP, maybe through perl or any server side script?

Thanks.

4

1 回答 1

0

Perl 能够做到这一点。

试着把这个问题分成两部分:

1) 生成 CSV 文件。2) 将此 CSV 文件移出。

第1部分:

您可以使用 Perl 连接到 SQL 服务器、运行查询并生成 CSV 文件。

使用 ODBC 和 DBI 连接:如何使用 Perl 连接到 SQL Server?

使用Text::CSV生成有效的 CSV 文件。

第2部分:

2.1:您可以设置一个简单的 (https) 网络服务器来仅提供此 CSV 文件。如果需要,您可以在发送之前加密此文件。

您可以使用 Putty 设置 SSH Tunel 以进一步保护传输:http ://www.planetb.ca/2010/08/how-to-create-an-ssh-tunnel-with-putty-and-stay-anonymous -在网络上/

有了这个就很容易了:http ://metacpan.org/pod/HTTP::Server::Brick

use HTTP::Daemon::SSL;

my $server = HTTP::Server::Brick->new(
      port => 8889,
      daemon_class => 'HTTP::Daemon::SSL',
      directory_indexing => 1,
      daemon_args  => [
         SSL_key_file  => 'my_ssl_key.pem',
         SSL_cert_file => 'my_ssl_cert.pem',
      ],
    );
$server->mount( '/csvfile' => {
    path => 'C:/path/to/your/csv/file',
    wildcard => 1,
}); 
# start accepting requests (won't return unless/until process
# receives a HUP signal)
$server->start; 

2.2:您可以在您的机器上设置 ssh 服务器并使用 scp(.exe from Putty) 来复制文件。

https://serverfault.com/questions/8411/what-is-a-good-ssh-server-to-use-on-windows

于 2013-02-05T08:57:31.220 回答