summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorajs124 <ajs124@users.noreply.github.com>2022-03-01 04:03:47 +0100
committerGitHub <noreply@github.com>2022-03-01 11:03:47 +0800
commit8289e6478beea99d7278891526d93bca62266509 (patch)
treea45bc21d98e98de7e3d9a3b04a841ef283fd475f /nixos
parente78a5bc15a0f32c6a2a203b1d759968b83f78bb0 (diff)
downloadnixpkgs-8289e6478beea99d7278891526d93bca62266509.tar
nixpkgs-8289e6478beea99d7278891526d93bca62266509.tar.gz
nixpkgs-8289e6478beea99d7278891526d93bca62266509.tar.bz2
nixpkgs-8289e6478beea99d7278891526d93bca62266509.tar.lz
nixpkgs-8289e6478beea99d7278891526d93bca62266509.tar.xz
nixpkgs-8289e6478beea99d7278891526d93bca62266509.tar.zst
nixpkgs-8289e6478beea99d7278891526d93bca62266509.zip
vsftpd: enable seccomp (#158974)
* vsftpd: enable seccomp

* nixos/tests/vsftpd: add basic test

* vsftpd: add test to passthru
Diffstat (limited to 'nixos')
-rw-r--r--nixos/tests/all-tests.nix1
-rw-r--r--nixos/tests/vsftpd.nix42
2 files changed, 43 insertions, 0 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index 5d03893a56b..b173c90c7f3 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -554,6 +554,7 @@ in
   vikunja = handleTest ./vikunja.nix {};
   virtualbox = handleTestOn ["x86_64-linux"] ./virtualbox.nix {};
   vscodium = discoverTests (import ./vscodium.nix);
+  vsftpd = handleTest ./vsftpd.nix {};
   wasabibackend = handleTest ./wasabibackend.nix {};
   wiki-js = handleTest ./wiki-js.nix {};
   wine = handleTest ./wine.nix {};
diff --git a/nixos/tests/vsftpd.nix b/nixos/tests/vsftpd.nix
new file mode 100644
index 00000000000..4bea27f0eb1
--- /dev/null
+++ b/nixos/tests/vsftpd.nix
@@ -0,0 +1,42 @@
+import ./make-test-python.nix ({ pkgs, ... }: {
+  name = "vsftpd";
+
+  nodes = {
+    server = {
+      services.vsftpd = {
+        enable = true;
+        userlistDeny = false;
+        localUsers = true;
+        userlist = [ "ftp-test-user" ];
+        writeEnable = true;
+        localRoot = "/tmp";
+      };
+      networking.firewall.enable = false;
+
+      users = {
+        users.ftp-test-user = {
+          isSystemUser = true;
+          password = "ftp-test-password";
+          group = "ftp-test-group";
+        };
+        groups.ftp-test-group = {};
+      };
+    };
+
+    client = {};
+  };
+
+  testScript = ''
+    client.start()
+    server.wait_for_unit("vsftpd")
+    server.wait_for_open_port("21")
+
+    client.succeed("curl -u ftp-test-user:ftp-test-password ftp://server")
+    client.succeed('echo "this is a test" > /tmp/test.file.up')
+    client.succeed("curl -v -T /tmp/test.file.up -u ftp-test-user:ftp-test-password ftp://server")
+    client.succeed("curl -u ftp-test-user:ftp-test-password ftp://server/test.file.up > /tmp/test.file.down")
+    client.succeed("diff /tmp/test.file.up /tmp/test.file.down")
+    assert client.succeed("cat /tmp/test.file.up") == server.succeed("cat /tmp/test.file.up")
+    assert client.succeed("cat /tmp/test.file.down") == server.succeed("cat /tmp/test.file.up")
+  '';
+})