Author: eelco
Date: Thu Mar 10 13:03:47 2011
New Revision: 26247
URL: https://svn.nixos.org/websvn/nix/?rev=26247&sc=1

Log:
* NAT module: support active FTP.

Modified:
   nixos/trunk/modules/services/networking/nat.nix
   nixos/trunk/tests/nat.nix

Modified: nixos/trunk/modules/services/networking/nat.nix
==============================================================================
--- nixos/trunk/modules/services/networking/nat.nix     Thu Mar 10 12:08:39 
2011        (r26246)
+++ nixos/trunk/modules/services/networking/nat.nix     Thu Mar 10 13:03:47 
2011        (r26247)
@@ -63,6 +63,8 @@
 
     environment.systemPackages = [ pkgs.iptables ];
 
+    boot.kernelModules = [ "nf_nat_ftp" ];
+
     jobs.nat =
       { description = "Network Address Translation";
 

Modified: nixos/trunk/tests/nat.nix
==============================================================================
--- nixos/trunk/tests/nat.nix   Thu Mar 10 12:08:39 2011        (r26246)
+++ nixos/trunk/tests/nat.nix   Thu Mar 10 13:03:47 2011        (r26247)
@@ -29,6 +29,8 @@
         { virtualisation.vlans = [ 2 ];
           services.httpd.enable = true;
           services.httpd.adminAddr = "[email protected]";
+          services.vsftpd.enable = true;
+          services.vsftpd.anonymousUser = true;
         };
     };
 
@@ -46,6 +48,18 @@
       $client->succeed("curl --fail http://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.
       $router->succeed("stop nat");
       $client->fail("curl --fail --connect-timeout 5 http://server/ >&2");
@@ -55,9 +69,6 @@
       $router->succeed("start nat");
       $client->succeed("curl --fail http://server/ >&2");
       $client->succeed("ping -c 1 server >&2");
-
-      $client->succeed("ping -c 1 router >&2");
-      $router->succeed("ping -c 1 client >&2");
     '';
 
 }
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits

Reply via email to