From db3812c3290586eb7b2836f880a8213911922bc1 Mon Sep 17 00:00:00 2001 From: Robin Raymond Date: Sat, 11 Nov 2017 16:07:03 +0100 Subject: [PATCH] add test for multidomain dkim --- tests/extern.nix | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/tests/extern.nix b/tests/extern.nix index 6b9feae..7820df4 100644 --- a/tests/extern.nix +++ b/tests/extern.nix @@ -35,6 +35,9 @@ import { "user2@example.com" = { hashedPassword = "$6$u61JrAtuI0a$nGEEfTP5.eefxoScUGVG/Tl0alqla2aGax4oTd85v3j3xSmhv/02gNfSemv/aaMinlv9j/ZABosVKBrRvN5Qv0"; }; + "user@example2.com" = { + hashedPassword = "$6$u61JrAtuI0a$nGEEfTP5.eefxoScUGVG/Tl0alqla2aGax4oTd85v3j3xSmhv/02gNfSemv/aaMinlv9j/ZABosVKBrRvN5Qv0"; + }; }; enableImap = true; @@ -68,6 +71,13 @@ import { from user2\@example.com user user2\@example.com password user2 + + account test2 + host SERVER + port 587 + from user\@example2.com + user user\@example2.com + password user2 ''; email1 = '' @@ -82,6 +92,21 @@ import { how are you doing today? ''; + email2 = + '' + From: User + To: User1 + Cc: + Bcc: + Subject: This is a test Email from user\@example2.com to user1 + Reply-To: + + Hello User1, + + how are you doing today? + + XOXO User1 + ''; in '' startAll; @@ -121,5 +146,19 @@ import { # 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/*"); }; + + subtest "dkim singing, multiple domains", sub { + $client->succeed("rm ~/mail/*"); + $client->succeed("rm mail.txt"); + $client->succeed("echo '${email2}' > mail.txt"); + # send email from user2 to user1 + $client->succeed("msmtp -a test2 --tls=on --tls-certcheck=off --auth=on user1\@example.com < mail.txt >&2"); + $client->succeed("sleep 5"); + # fetchmail returns EXIT_CODE 0 when it retrieves mail + $client->succeed("fetchmail -v >&2"); + $client->succeed("cat ~/mail/* >&2"); + # make sure it is dkim signed + $client->succeed("grep DKIM ~/mail/*"); + }; ''; }