3
0
Fork 0
forked from mirrors/nixpkgs

* NAT module: support active FTP.

svn path=/nixos/trunk/; revision=26247
This commit is contained in:
Eelco Dolstra 2011-03-10 13:03:47 +00:00
parent 9bf4ac079e
commit 53bc6d3efa
2 changed files with 16 additions and 3 deletions

View file

@ -63,6 +63,8 @@ in
environment.systemPackages = [ pkgs.iptables ]; environment.systemPackages = [ pkgs.iptables ];
boot.kernelModules = [ "nf_nat_ftp" ];
jobs.nat = jobs.nat =
{ description = "Network Address Translation"; { description = "Network Address Translation";

View file

@ -29,6 +29,8 @@
{ virtualisation.vlans = [ 2 ]; { virtualisation.vlans = [ 2 ];
services.httpd.enable = true; services.httpd.enable = true;
services.httpd.adminAddr = "foo@example.org"; services.httpd.adminAddr = "foo@example.org";
services.vsftpd.enable = true;
services.vsftpd.anonymousUser = true;
}; };
}; };
@ -46,6 +48,18 @@
$client->succeed("curl --fail http://server/ >&2"); $client->succeed("curl --fail http://server/ >&2");
$client->succeed("ping -c 1 server >&2"); $client->succeed("ping -c 1 server >&2");
# Test whether passive FTP works.
$server->waitForJob("vsftpd");
$server->succeed("echo Hello World > /home/ftp/foo.txt");
$client->succeed("curl -v ftp://server/foo.txt >&2");
# Test whether active FTP works.
$client->succeed("curl -v -P - ftp://server/foo.txt >&2");
# Test ICMP.
$client->succeed("ping -c 1 router >&2");
$router->succeed("ping -c 1 client >&2");
# If we turn off NAT, the client shouldn't be able to reach the server. # If we turn off NAT, the client shouldn't be able to reach the server.
$router->succeed("stop nat"); $router->succeed("stop nat");
$client->fail("curl --fail --connect-timeout 5 http://server/ >&2"); $client->fail("curl --fail --connect-timeout 5 http://server/ >&2");
@ -55,9 +69,6 @@
$router->succeed("start nat"); $router->succeed("start nat");
$client->succeed("curl --fail http://server/ >&2"); $client->succeed("curl --fail http://server/ >&2");
$client->succeed("ping -c 1 server >&2"); $client->succeed("ping -c 1 server >&2");
$client->succeed("ping -c 1 router >&2");
$router->succeed("ping -c 1 client >&2");
''; '';
} }