2022-03-01 03:03:47 +00:00
|
|
|
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";
|
2024-12-10 19:26:33 +00:00
|
|
|
};
|
2022-03-01 03:03:47 +00:00
|
|
|
groups.ftp-test-group = { };
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
client = { };
|
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
|
|
|
client.start()
|
|
|
|
server.wait_for_unit("vsftpd")
|
2022-06-11 12:22:53 +00:00
|
|
|
server.wait_for_open_port(21)
|
2022-03-01 03:03:47 +00:00
|
|
|
|
|
|
|
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")
|
|
|
|
'';
|
|
|
|
}
|
|
|
|
)
|