nixos/tests/tlsrpt: init

(cherry picked from commit 2487dcbf51)
This commit is contained in:
Martin Weinelt
2025-06-14 17:05:35 +02:00
parent 335a3bd10b
commit 8f9e3ed788
3 changed files with 47 additions and 0 deletions

View File

@@ -1375,6 +1375,7 @@ in
tmate-ssh-server = handleTest ./tmate-ssh-server.nix { };
tomcat = handleTest ./tomcat.nix { };
tor = handleTest ./tor.nix { };
tlsrpt = runTest ./tlsrpt.nix;
tpm-ek = handleTest ./tpm-ek { };
traefik = runTestOn [ "aarch64-linux" "x86_64-linux" ] ./traefik.nix;
trafficserver = handleTest ./trafficserver.nix { };

41
nixos/tests/tlsrpt.nix Normal file
View File

@@ -0,0 +1,41 @@
{
pkgs,
...
}:
{
name = "tlsrpt";
meta = {
inherit (pkgs.tlsrpt-reporter.meta) maintainers;
};
nodes.machine = {
services.tlsrpt = {
enable = true;
reportd.settings = {
organization_name = "NixOS Testers United";
contact_info = "smtp-tls-report@localhost";
sender_address = "noreply@localhost";
};
};
# To test the postfix integration
services.postfix.enable = true;
};
testScript = ''
machine.wait_for_unit("tlsrpt-collectd.service")
machine.wait_for_unit("tlsrpt-reportd.service")
machine.wait_for_file("/run/tlsrpt/collectd.sock")
machine.wait_until_succeeds("journalctl -o cat -u tlsrpt-collectd | grep -Pq 'Database .* setup finished'")
machine.wait_until_succeeds("journalctl -o cat -u tlsrpt-reportd | grep -Pq 'Database .* setup finished'")
# Enabling postfix should put sendmail as the sendmail setting
machine.succeed("grep -q sendmail_script=sendmail /etc/tlsrpt/reportd.cfg")
machine.succeed("systemctl show --property SupplementaryGroups postfix.service | grep tlsrpt")
machine.log(machine.succeed("systemd-analyze security tlsrpt-collectd.service tlsrpt-reportd.service | grep -v "))
'';
}