From 82cf8db01d8ea9fe8b3ea66f023041e2722f8891 Mon Sep 17 00:00:00 2001 From: Robin Raymond Date: Wed, 20 Sep 2017 15:31:23 +0200 Subject: [PATCH] add test for sensitive data --- tests/extern.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/extern.nix b/tests/extern.nix index 811fa9a..147d218 100644 --- a/tests/extern.nix +++ b/tests/extern.nix @@ -90,6 +90,7 @@ import ./../../nixpkgs/nixos/tests/make-test.nix { $client->waitForUnit("multi-user.target"); subtest "imap retrieving mail", sub { + $client->succeed("mkdir ~/mail"); $client->succeed("echo '${fetchmailRc}' > ~/.fetchmailrc"); $client->succeed("echo '${procmailRc}' > ~/.procmailrc"); $client->succeed("sed -i s/SERVER/`getent hosts server | awk '{ print \$1 }'`/g ~/.fetchmailrc"); @@ -109,8 +110,16 @@ import ./../../nixpkgs/nixos/tests/make-test.nix { }; subtest "imap retrieving mail 2", sub { + # give the mail server some time to process the mail + $client->succeed("sleep 5"); # fetchmail returns EXIT_CODE 0 when it retrieves mail $client->succeed("fetchmail -v >&2"); }; + + subtest "remove sensitive information on submission port", sub { + $client->succeed("cat ~/mail/* >&2"); + # make sure our IP is _not_ in the email header + $client->fail("grep `ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print \$2}' | cut -f1 -d'/'` ~/mail/*"); + }; ''; }