From 7aecdeeba22cfe94a180d722dc3506cd6f2b83a2 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Sat, 19 Aug 2023 22:37:25 +0100 Subject: [PATCH] Testsuite: DMARC history-file --- test/confs/4650 | 1 + test/dnszones-src/db.test.ex | 4 ++++ test/log/4650 | 15 ++++++++------- test/runtest | 2 ++ test/scripts/4650-DMARC/4650 | 10 ++++++++-- test/stdout/4650 | 26 +++++++++++++++++++++++--- 6 files changed, 46 insertions(+), 12 deletions(-) diff --git a/test/confs/4650 b/test/confs/4650 index 32e138313..5ad7adbc8 100644 --- a/test/confs/4650 +++ b/test/confs/4650 @@ -18,6 +18,7 @@ primary_hostname = myhost.test.ex # ----- Main settings ----- dmarc_tld_file = DIR/aux-fixed/TESTNUM.tldfile +dmarc_history_file = DIR/tmp/TESTNUM.hist.dmarc acl_smtp_rcpt = accept acl_smtp_data = check_data diff --git a/test/dnszones-src/db.test.ex b/test/dnszones-src/db.test.ex index 22749e4e2..d39e9cf1e 100644 --- a/test/dnszones-src/db.test.ex +++ b/test/dnszones-src/db.test.ex @@ -626,4 +626,8 @@ sed._domainkey TXT "v=DKIM1; k=ed25519; p=sPs07Vu29FpHT/80UXUcYHFOHifD4o2ZlP2+XU sedw._domainkey TXT "v=DKIM1; k=ed25519; p=MCowBQYDK2VwAyEAsPs07Vu29FpHT/80UXUcYHFOHifD4o2ZlP2+XUh9g6E=" +; ------- DMARC --------- + +_dmarc TXT v=DMARC1; p=none + ; End diff --git a/test/log/4650 b/test/log/4650 index 5e1990064..900f36156 100644 --- a/test/log/4650 +++ b/test/log/4650 @@ -1,9 +1,10 @@ ******** SERVER ******** -1999-03-02 09:44:33 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on port PORT_D -1999-03-02 09:44:33 10HmaX-0005vi-00 dmarc_status -1999-03-02 09:44:33 10HmaX-0005vi-00 dmarc_status_text -1999-03-02 09:44:33 10HmaX-0005vi-00 dmarc_used_domain -1999-03-02 09:44:33 10HmaX-0005vi-00 dmarc_domain_policy <> -1999-03-02 09:44:33 10HmaX-0005vi-00 Authentication-Results: myhost.test.ex;\n spf=fail smtp.mailfrom=example.com;\n dmarc=none header.from=example.com -1999-03-02 09:44:33 10HmaX-0005vi-00 <= a@example.com H=(testclient) [ip4.ip4.ip4.ip4] P=smtp S=sss +1999-03-02 09:44:33 exim x.yz daemon started: pid=p1234, no queue runs, listening for SMTP on port PORT_D +1999-03-02 09:44:33 10HmaX-000000005vi-0000 DMARC results: spf_domain=test.ex dmarc_domain=test.ex spf_align=no dkim_align=no enforcement='None, Accept' +1999-03-02 09:44:33 10HmaX-000000005vi-0000 dmarc_status +1999-03-02 09:44:33 10HmaX-000000005vi-0000 dmarc_status_text +1999-03-02 09:44:33 10HmaX-000000005vi-0000 dmarc_used_domain +1999-03-02 09:44:33 10HmaX-000000005vi-0000 dmarc_domain_policy +1999-03-02 09:44:33 10HmaX-000000005vi-0000 Authentication-Results: myhost.test.ex;\n spf=none smtp.mailfrom=test.ex;\n dmarc=none header.from=test.ex +1999-03-02 09:44:33 10HmaX-000000005vi-0000 <= a@test.ex H=(testclient) [ip4.ip4.ip4.ip4] P=smtp S=sss diff --git a/test/runtest b/test/runtest index 23551861a..1ed0ad73a 100755 --- a/test/runtest +++ b/test/runtest @@ -1056,6 +1056,8 @@ RESET_AFTER_EXTRA_LINE_READ: # DMARC is not always supported by the build next if /^dmarc_tld_file =/; + # timestamp in dmarc history file + s/received \K\d{10}$/1692480217/; # ARC is not always supported by the build next if /^arc_sign =/; diff --git a/test/scripts/4650-DMARC/4650 b/test/scripts/4650-DMARC/4650 index 5526a8bbe..40df619f3 100644 --- a/test/scripts/4650-DMARC/4650 +++ b/test/scripts/4650-DMARC/4650 @@ -6,20 +6,23 @@ # Be careful with envelope-domains used for testcases, as real DNS lookups will be done # for names not provided for in fakedns. # +mkdir DIR/tmp +sudo chmod 777 DIR/tmp +# exim -bd -DSERVER=server -oX PORT_D **** client HOSTIPV4 PORT_D ??? 220 HELO testclient ??? 250 -MAIL FROM: +MAIL FROM: ??? 250 RCPT TO: ??? 250 DATA ??? 3 Subject: test -From: z@example.com +From: body line . @@ -28,4 +31,7 @@ QUIT **** # killdaemon +cat DIR/tmp/TESTNUM.hist.dmarc +# +sudo rm -fr DIR/tmp no_msglog_check diff --git a/test/stdout/4650 b/test/stdout/4650 index acd347256..436f4bd41 100644 --- a/test/stdout/4650 +++ b/test/stdout/4650 @@ -4,7 +4,7 @@ Connecting to ip4.ip4.ip4.ip4 port 1225 ... connected >>> HELO testclient ??? 250 <<< 250 myhost.test.ex Hello testclient [ip4.ip4.ip4.ip4] ->>> MAIL FROM: +>>> MAIL FROM: ??? 250 <<< 250 OK >>> RCPT TO: @@ -14,11 +14,31 @@ Connecting to ip4.ip4.ip4.ip4 port 1225 ... connected ??? 3 <<< 354 Enter message, ending with "." on a line by itself >>> Subject: test ->>> From: z@example.com +>>> From: >>> >>> body line >>> . ??? 250 -<<< 250 OK id=10HmaX-0005vi-00 +<<< 250 OK id=10HmaX-000000005vi-0000 >>> QUIT End of script +job 10HmaX-000000005vi-0000 +reporter myhost.test.ex +received 1692480217 +ipaddr ip4.ip4.ip4.ip4 +from test.ex +mfrom test.ex +spf 7 +pdomain test.ex +policy 18 +rua - +pct 100 +adkim 114 +aspf 114 +p 110 +sp 0 +align_dkim 5 +align_spf 5 +action 2 +arc - +arc_policy - -- 2.30.2