Testsuite: SPF testcases. Bug 1789
authorJeremy Harris <jgh146exb@wizmail.org>
Tue, 2 Jan 2018 19:57:15 +0000 (19:57 +0000)
committerJeremy Harris <jgh146exb@wizmail.org>
Tue, 2 Jan 2018 21:21:57 +0000 (21:21 +0000)
test/confs/4600 [new file with mode: 0644]
test/confs/4601 [new file with mode: 0644]
test/log/4600 [new file with mode: 0644]
test/log/4601 [new file with mode: 0644]
test/rejectlog/4600 [new file with mode: 0644]
test/scripts/4600-SPF/4600 [new file with mode: 0644]
test/scripts/4600-SPF/4601 [new file with mode: 0644]
test/scripts/4600-SPF/REQUIRES [new file with mode: 0644]
test/stdout/4600 [new file with mode: 0644]
test/stdout/4601 [new file with mode: 0644]

diff --git a/test/confs/4600 b/test/confs/4600
new file mode 100644 (file)
index 0000000..ba21359
--- /dev/null
@@ -0,0 +1,40 @@
+# Exim test configuration 4600
+
+SERVER=
+
+.include DIR/aux-var/std_conf_prefix
+
+primary_hostname = myhost.test.ex
+
+# ----- Main settings -----
+
+acl_smtp_rcpt = check_rcpt
+
+queue_only
+queue_run_in_order
+
+
+begin acl
+
+check_rcpt:
+  accept       hosts =         HOSTIPV4
+               spf_guess =     pass
+               logwrite =      spf_result         $spf_result
+               logwrite =      spf_header_comment $spf_header_comment
+               logwrite =      spf_smtp_comment   $spf_smtp_comment
+               logwrite =      spf_received       $spf_received
+
+  accept       hosts =         127.0.0.1
+               spf =           pass : softfail : neutral
+               logwrite =      spf_result         $spf_result
+               logwrite =      spf_header_comment $spf_header_comment
+               logwrite =      spf_smtp_comment   $spf_smtp_comment
+               logwrite =      spf_received       $spf_received
+
+  deny
+               logwrite =      spf_result         $spf_result
+               logwrite =      spf_header_comment $spf_header_comment
+               logwrite =      spf_smtp_comment   $spf_smtp_comment
+               logwrite =      spf_received       $spf_received
+
+# End
diff --git a/test/confs/4601 b/test/confs/4601
new file mode 100644 (file)
index 0000000..00731d5
--- /dev/null
@@ -0,0 +1,13 @@
+# Exim test configuration 4601
+
+.include DIR/aux-var/std_conf_prefix
+
+primary_hostname = myhost.test.ex
+
+# ----- Main settings -----
+
+acl_smtp_rcpt = \
+  accept       logwrite =      $sender_address [$sender_host_address] \
+                               ${lookup {$sender_address} spf {$sender_host_address} \
+                                               {lookup: '$value'}{FAILED}}
+# End
diff --git a/test/log/4600 b/test/log/4600
new file mode 100644 (file)
index 0000000..9c07c17
--- /dev/null
@@ -0,0 +1,12 @@
+
+******** SERVER ********
+1999-03-02 09:44:33 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on port 1225
+1999-03-02 09:44:33 spf_result         fail
+1999-03-02 09:44:33 spf_header_comment myhost.test.ex: domain of example.com does not designate ip4.ip4.ip4.ip4 as permitted sender
+1999-03-02 09:44:33 spf_smtp_comment   Please see http://www.openspf.org/Why?id=a%40example.com&ip=ip4.ip4.ip4.ip4&receiver=myhost.test.ex : Reason: mechanism
+1999-03-02 09:44:33 spf_received       Received-SPF: fail (myhost.test.ex: domain of example.com does not designate ip4.ip4.ip4.ip4 as permitted sender) client-ip=ip4.ip4.ip4.ip4; envelope-from=a@example.com; helo=testclient;
+1999-03-02 09:44:33 H=(testclient) [ip4.ip4.ip4.ip4] F=<a@example.com> rejected RCPT <fred@test.ex>
+1999-03-02 09:44:33 spf_result         pass
+1999-03-02 09:44:33 spf_header_comment myhost.test.ex: localhost is always allowed.
+1999-03-02 09:44:33 spf_smtp_comment   
+1999-03-02 09:44:33 spf_received       Received-SPF: pass (myhost.test.ex: localhost is always allowed.) client-ip=127.0.0.1; envelope-from=b@example.com; helo=testclient;
diff --git a/test/log/4601 b/test/log/4601
new file mode 100644 (file)
index 0000000..e874ff1
--- /dev/null
@@ -0,0 +1,5 @@
+
+******** SERVER ********
+1999-03-02 09:44:33 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on port 1225
+1999-03-02 09:44:33 a@example.com [ip4.ip4.ip4.ip4] lookup: 'fail'
+1999-03-02 09:44:33 b@example.com [127.0.0.1] lookup: 'pass'
diff --git a/test/rejectlog/4600 b/test/rejectlog/4600
new file mode 100644 (file)
index 0000000..6eeab86
--- /dev/null
@@ -0,0 +1,3 @@
+
+******** SERVER ********
+1999-03-02 09:44:33 H=(testclient) [ip4.ip4.ip4.ip4] F=<a@example.com> rejected RCPT <fred@test.ex>
diff --git a/test/scripts/4600-SPF/4600 b/test/scripts/4600-SPF/4600
new file mode 100644 (file)
index 0000000..3907f68
--- /dev/null
@@ -0,0 +1,33 @@
+# acl condition and variables
+#
+# It is rather difficult to properly test spf.  We use libspf2 to do the work, and it
+# does the DNS lookups, so we cannot intercept them in the testsuite's usual fashion
+# to provide values for testcases.
+#
+# For now just check that what should be working syntax does not cause us to fall over.
+# Be careful with envelope-domains used for testcases, as real DNS lookups will be done.
+#
+exim -bd -DSERVER=server -oX PORT_D
+****
+client HOSTIPV4 PORT_D
+??? 220
+helo testclient
+??? 250
+mail from:<a@example.com>
+??? 250
+rcpt to:<fred@test.ex>
+??? 550
+quit
+****
+client 127.0.0.1 PORT_D
+??? 220
+helo testclient
+??? 250
+mail from:<b@example.com>
+??? 250
+rcpt to:<fred@test.ex>
+??? 250
+quit
+****
+#
+killdaemon
diff --git a/test/scripts/4600-SPF/4601 b/test/scripts/4600-SPF/4601
new file mode 100644 (file)
index 0000000..096b64e
--- /dev/null
@@ -0,0 +1,33 @@
+# lookup string-expansion
+#
+# It is rather difficult to properly test spf.  We use libspf2 to do the work, and it
+# does the DNS lookups, so we cannot intercept them in the testsuite's usual fashion
+# to provide values for testcases.
+#
+# For now just check that what should be working syntax does not cause us to fall over.
+# Be careful with envelope-domains used for testcases, as real DNS lookups will be done.
+#
+exim -bd -DSERVER=server -oX PORT_D
+****
+client HOSTIPV4 PORT_D
+??? 220
+helo testclient
+??? 250
+mail from:<a@example.com>
+??? 250
+rcpt to:<fred@test.ex>
+??? 250
+quit
+****
+client 127.0.0.1 PORT_D
+??? 220
+helo testclient
+??? 250
+mail from:<b@example.com>
+??? 250
+rcpt to:<fred@test.ex>
+??? 250
+quit
+****
+#
+killdaemon
diff --git a/test/scripts/4600-SPF/REQUIRES b/test/scripts/4600-SPF/REQUIRES
new file mode 100644 (file)
index 0000000..c4c4339
--- /dev/null
@@ -0,0 +1 @@
+support Experimental_SPF
diff --git a/test/stdout/4600 b/test/stdout/4600
new file mode 100644 (file)
index 0000000..c33a531
--- /dev/null
@@ -0,0 +1,28 @@
+Connecting to ip4.ip4.ip4.ip4 port 1225 ... connected
+??? 220
+<<< 220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
+>>> helo testclient
+??? 250
+<<< 250 myhost.test.ex Hello testclient [ip4.ip4.ip4.ip4]
+>>> mail from:<a@example.com>
+??? 250
+<<< 250 OK
+>>> rcpt to:<fred@test.ex>
+??? 550
+<<< 550 Administrative prohibition
+>>> quit
+End of script
+Connecting to 127.0.0.1 port 1225 ... connected
+??? 220
+<<< 220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
+>>> helo testclient
+??? 250
+<<< 250 myhost.test.ex Hello testclient [127.0.0.1]
+>>> mail from:<b@example.com>
+??? 250
+<<< 250 OK
+>>> rcpt to:<fred@test.ex>
+??? 250
+<<< 250 Accepted
+>>> quit
+End of script
diff --git a/test/stdout/4601 b/test/stdout/4601
new file mode 100644 (file)
index 0000000..9abbcf5
--- /dev/null
@@ -0,0 +1,28 @@
+Connecting to ip4.ip4.ip4.ip4 port 1225 ... connected
+??? 220
+<<< 220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
+>>> helo testclient
+??? 250
+<<< 250 myhost.test.ex Hello testclient [ip4.ip4.ip4.ip4]
+>>> mail from:<a@example.com>
+??? 250
+<<< 250 OK
+>>> rcpt to:<fred@test.ex>
+??? 250
+<<< 250 Accepted
+>>> quit
+End of script
+Connecting to 127.0.0.1 port 1225 ... connected
+??? 220
+<<< 220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
+>>> helo testclient
+??? 250
+<<< 250 myhost.test.ex Hello testclient [127.0.0.1]
+>>> mail from:<b@example.com>
+??? 250
+<<< 250 OK
+>>> rcpt to:<fred@test.ex>
+??? 250
+<<< 250 Accepted
+>>> quit
+End of script