1 import ./make-test-python.nix ({ pkgs, lib, ... }:
6 password = "correcthorsebatterystaple";
8 defaultUsername = "admin";
9 defaultPassword = "password";
10 adminCredentialsFile = pkgs.writeText "admin-credentials" ''
11 ADMIN_USERNAME=${defaultUsername}
12 ADMIN_PASSWORD=${defaultPassword}
14 customAdminCredentialsFile = pkgs.writeText "admin-credentials" ''
15 ADMIN_USERNAME=${username}
16 ADMIN_PASSWORD=${password}
22 meta.maintainers = [ ];
28 security.apparmor.enable = true;
31 inherit adminCredentialsFile;
38 security.apparmor.enable = true;
41 inherit adminCredentialsFile;
43 security.sudo.enable = false;
49 security.apparmor.enable = true;
53 CLEANUP_FREQUENCY = "48";
54 LISTEN_ADDR = "localhost:${toString port}";
56 adminCredentialsFile = customAdminCredentialsFile;
63 default.wait_for_unit("miniflux.service")
64 default.wait_for_open_port(${toString defaultPort})
65 default.succeed("curl --fail 'http://localhost:${toString defaultPort}/healthcheck' | grep OK")
67 "curl 'http://localhost:${toString defaultPort}/v1/me' -u '${defaultUsername}:${defaultPassword}' -H Content-Type:application/json | grep '\"is_admin\":true'"
69 default.fail('journalctl -b --no-pager --grep "^audit: .*apparmor=\\"DENIED\\""')
71 withoutSudo.wait_for_unit("miniflux.service")
72 withoutSudo.wait_for_open_port(${toString defaultPort})
73 withoutSudo.succeed("curl --fail 'http://localhost:${toString defaultPort}/healthcheck' | grep OK")
75 "curl 'http://localhost:${toString defaultPort}/v1/me' -u '${defaultUsername}:${defaultPassword}' -H Content-Type:application/json | grep '\"is_admin\":true'"
77 withoutSudo.fail('journalctl -b --no-pager --grep "^audit: .*apparmor=\\"DENIED\\""')
79 customized.wait_for_unit("miniflux.service")
80 customized.wait_for_open_port(${toString port})
81 customized.succeed("curl --fail 'http://localhost:${toString port}/healthcheck' | grep OK")
83 "curl 'http://localhost:${toString port}/v1/me' -u '${username}:${password}' -H Content-Type:application/json | grep '\"is_admin\":true'"
85 customized.fail('journalctl -b --no-pager --grep "^audit: .*apparmor=\\"DENIED\\""')