vuls: init at 0.27.0
[NixPkgs.git] / nixos / tests / vsftpd.nix
blob6eaf32b2258380e0aec02266d829e09dd7cf9735
1 import ./make-test-python.nix ({ pkgs, ... }: {
2   name = "vsftpd";
4   nodes = {
5     server = {
6       services.vsftpd = {
7         enable = true;
8         userlistDeny = false;
9         localUsers = true;
10         userlist = [ "ftp-test-user" ];
11         writeEnable = true;
12         localRoot = "/tmp";
13       };
14       networking.firewall.enable = false;
16       users = {
17         users.ftp-test-user = {
18           isSystemUser = true;
19           password = "ftp-test-password";
20           group = "ftp-test-group";
21         };
22         groups.ftp-test-group = {};
23       };
24     };
26     client = {};
27   };
29   testScript = ''
30     client.start()
31     server.wait_for_unit("vsftpd")
32     server.wait_for_open_port(21)
34     client.succeed("curl -u ftp-test-user:ftp-test-password ftp://server")
35     client.succeed('echo "this is a test" > /tmp/test.file.up')
36     client.succeed("curl -v -T /tmp/test.file.up -u ftp-test-user:ftp-test-password ftp://server")
37     client.succeed("curl -u ftp-test-user:ftp-test-password ftp://server/test.file.up > /tmp/test.file.down")
38     client.succeed("diff /tmp/test.file.up /tmp/test.file.down")
39     assert client.succeed("cat /tmp/test.file.up") == server.succeed("cat /tmp/test.file.up")
40     assert client.succeed("cat /tmp/test.file.down") == server.succeed("cat /tmp/test.file.up")
41   '';