Actually reject mails sent to system accounts and add respective testcase

This commit is contained in:
Thomas Preisner 2025-01-02 23:06:14 +01:00
parent 55183f5585
commit 30532bbfca
3 changed files with 30 additions and 0 deletions

View file

@ -9,6 +9,11 @@ with (import ./common/lib.nix {inherit pkgs;}); let
address = "user2@example.com";
password = "secret-password2";
};
"system" = {
address = "system@example.com";
password = "secret-password3";
isSystemUser = true;
};
};
in
pkgs.nixosTest {
@ -77,6 +82,14 @@ in
I'm pretending to be someotheraddress@example.com and the mailserver should reject this attempt.
''}")
with subtest("mail sent to system-account is rejected"):
client.fail("${sendMail "normal" "someotheraddress@example.com" accounts."system".address ''
Subject: Mail to system-account
Hello System user,
this mail should never reach you as it should be rejected by postfix.
''}")
with subtest("server issues no warnings nor errors"):
${checkLogs "server"}
'';