diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-12-03 09:43:03 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-03 09:43:03 +0000 |
commit | 8c437fa7c9138042217840ca8c45167ae6cb78da (patch) | |
tree | dbbc3ec9fa44dfe7045ae32ef6701bec504b67f7 | |
parent | 7774b5f0ac4ddfb00de40d7c682a79fb7daea7f9 (diff) | |
parent | ff4dadc87a5a6073001f4105f08c0e83578c80da (diff) | |
download | rspamd-8c437fa7c9138042217840ca8c45167ae6cb78da.tar.gz rspamd-8c437fa7c9138042217840ca8c45167ae6cb78da.zip |
Merge pull request #3172 from korgoth1/master
[Test] 115 Dmarc is now separated by 115 dmarc, 116 dkim, 117 spf.
-rw-r--r-- | test/functional/cases/115_dmarc.robot | 132 | ||||
-rw-r--r-- | test/functional/cases/116_dkim.robot (renamed from test/functional/cases/130_dkim.robot) | 33 | ||||
-rw-r--r-- | test/functional/cases/117_spf.robot | 129 | ||||
-rw-r--r-- | test/functional/configs/plugins.conf | 10 | ||||
-rw-r--r-- | test/functional/configs/spf.conf | 1 |
5 files changed, 170 insertions, 135 deletions
diff --git a/test/functional/cases/115_dmarc.robot b/test/functional/cases/115_dmarc.robot index 597a6a330..a3c60f83f 100644 --- a/test/functional/cases/115_dmarc.robot +++ b/test/functional/cases/115_dmarc.robot @@ -87,138 +87,6 @@ DMARC PCT ZERO SP QUARANTINE ... -i 37.48.67.26 --from foo@mom.za.org Check Rspamc ${result} DMARC_POLICY_SOFTFAIL -DKIM PERMFAIL NXDOMAIN - ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim2.eml - ... -i 37.48.67.26 - Check Rspamc ${result} R_DKIM_PERMFAIL - -DKIM PERMFAIL BAD RECORD - ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim1.eml - ... -i 37.48.67.26 - Check Rspamc ${result} R_DKIM_PERMFAIL - -DKIM TEMPFAIL SERVFAIL UNALIGNED - ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim3.eml - ... -i 37.48.67.26 - Check Rspamc ${result} R_DKIM_TEMPFAIL - Should Contain ${result.stdout} DMARC_POLICY_SOFTFAIL - -DKIM NA NOSIG - ${result} = Scan Message With Rspamc ${TESTDIR}/messages/utf.eml - ... -i 37.48.67.26 - Check Rspamc ${result} R_DKIM_NA - -SPF PERMFAIL UNRESOLVEABLE INCLUDE - ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim1.eml - ... -i 37.48.67.26 -F x@fail3.org.org.za - Check Rspamc ${result} R_SPF_PERMFAIL - -SPF DNSFAIL FAILED INCLUDE UNALIGNED - ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim1.eml - ... -i 8.8.8.8 -F x@fail2.org.org.za - Check Rspamc ${result} R_SPF_DNSFAIL - Should Contain ${result.stdout} DMARC_POLICY_SOFTFAIL - -SPF ALLOW UNRESOLVEABLE INCLUDE - ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim1.eml - ... -i 8.8.8.8 -F x@fail3.org.org.za - Check Rspamc ${result} R_SPF_ALLOW - -SPF ALLOW FAILED INCLUDE - ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim1.eml - ... -i 8.8.4.4 -F x@fail2.org.org.za - Check Rspamc ${result} R_SPF_ALLOW - -SPF NA NA - ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim1.eml - ... -i 8.8.8.8 -F x@za - Check Rspamc ${result} R_SPF_NA - -SPF NA NOREC - ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim1.eml - ... -i 8.8.8.8 -F x@co.za - Check Rspamc ${result} R_SPF_NA - -SPF NA NXDOMAIN - ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim1.eml - ... -i 8.8.8.8 -F x@zzzzaaaa - Check Rspamc ${result} R_SPF_NA - -SPF PERMFAIL UNRESOLVEABLE REDIRECT - ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim1.eml - ... -i 8.8.8.8 -F x@fail4.org.org.za - Check Rspamc ${result} R_SPF_PERMFAIL - -SPF REDIRECT NO USEABLE ELEMENTS - ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim1.eml - ... -i 8.8.8.8 -F x@fail10.org.org.za - Check Rspamc ${result} R_SPF_PERMFAIL - -SPF DNSFAIL FAILED REDIRECT - ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim1.eml - ... -i 8.8.8.8 -F x@fail1.org.org.za - Check Rspamc ${result} R_SPF_DNSFAIL - -SPF PERMFAIL NO USEABLE ELEMENTS - ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim1.eml - ... -i 8.8.8.8 -F x@fail5.org.org.za - Check Rspamc ${result} R_SPF_PERMFAIL - -SPF FAIL - ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim1.eml - ... -i 8.8.8.8 -F x@example.net - Check Rspamc ${result} R_SPF_FAIL - -SPF PERMFAIL UNRESOLVEABLE MX - ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim1.eml - ... -i 1.2.3.4 -F x@fail6.org.org.za - Check Rspamc ${result} R_SPF_PERMFAIL - -SPF PERMFAIL UNRESOLVEABLE A - ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim1.eml - ... -i 1.2.3.4 -F x@fail7.org.org.za - Check Rspamc ${result} R_SPF_PERMFAIL - -SPF DNSFAIL FAILED A - ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim1.eml - ... -i 1.2.3.4 -F x@fail8.org.org.za - Check Rspamc ${result} R_SPF_DNSFAIL - -SPF DNSFAIL FAILED MX - ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim1.eml - ... -i 1.2.3.4 -F x@fail9.org.org.za - Check Rspamc ${result} R_SPF_DNSFAIL - -SPF DNSFAIL FAILED RECORD - ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim1.eml - ... -i 1.2.3.4 -F x@www.dnssec-failed.org - Check Rspamc ${result} R_SPF_DNSFAIL - -SPF PASS INCLUDE - ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim1.eml - ... -i 8.8.8.8 -F x@pass1.org.org.za - Check Rspamc ${result} R_SPF_ALLOW - -SPF PTRS - ${result} = Scan Message With Rspamc /dev/null - ... -i 88.99.142.95 -F foo@crazyspf.cacophony.za.org - Check Rspamc ${result} R_SPF_ALLOW - ${result} = Scan Message With Rspamc /dev/null - ... -i 128.66.0.1 -F foo@crazyspf.cacophony.za.org - Check Rspamc ${result} R_SPF_PERMFAIL - ${result} = Scan Message With Rspamc /dev/null - ... -i 209.85.216.182 -F foo@crazyspf.cacophony.za.org - Check Rspamc ${result} R_SPF_FAIL - #${result} = Scan Message With Rspamc /dev/null - #... -i 98.138.91.166 -F foo@crazyspf.cacophony.za.org - #Check Rspamc ${result} R_SPF_ALLOW - #${result} = Scan Message With Rspamc /dev/null - #... -i 98.138.91.167 -F foo@crazyspf.cacophony.za.org - #Check Rspamc ${result} R_SPF_ALLOW - #${result} = Scan Message With Rspamc /dev/null - #... -i 98.138.91.168 -F foo@crazyspf.cacophony.za.org - #Check Rspamc ${result} R_SPF_ALLOW - *** Keywords *** DMARC Setup ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/dmarc.conf diff --git a/test/functional/cases/130_dkim.robot b/test/functional/cases/116_dkim.robot index ad0b27ac4..79a40b1e6 100644 --- a/test/functional/cases/130_dkim.robot +++ b/test/functional/cases/116_dkim.robot @@ -1,15 +1,36 @@ *** Settings *** -Suite Setup Generic Setup +Suite Setup DKIM Setup Suite Teardown Simple Teardown Library ${TESTDIR}/lib/rspamd.py Resource ${TESTDIR}/lib/rspamd.robot Variables ${TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/dkim.conf +${CONFIG} ${TESTDIR}/configs/plugins.conf ${RSPAMD_SCOPE} Suite +${URL_TLD} ${TESTDIR}/../../contrib/publicsuffix/effective_tld_names.dat *** Test Cases *** +DKIM PERMFAIL NXDOMAIN + ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim2.eml + ... -i 37.48.67.26 + Check Rspamc ${result} R_DKIM_PERMFAIL + +DKIM PERMFAIL BAD RECORD + ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim1.eml + ... -i 37.48.67.26 + Check Rspamc ${result} R_DKIM_PERMFAIL + +DKIM TEMPFAIL SERVFAIL UNALIGNED + ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim3.eml + ... -i 37.48.67.26 + Check Rspamc ${result} R_DKIM_TEMPFAIL + +DKIM NA NOSIG + ${result} = Scan Message With Rspamc ${TESTDIR}/messages/utf.eml + ... -i 37.48.67.26 + Check Rspamc ${result} R_DKIM_NA + DKIM Sign Set Suite Variable ${RAN_SIGNTEST} 0 ${result} = Scan Message With Rspamc ${TESTDIR}/messages/spam_message.eml --mime --header=dodkim=1 @@ -29,4 +50,10 @@ DKIM Verify ED25519 PASS DKIM Verify ED25519 REJECT ${result} = Scan Message With Rspamc ${TESTDIR}/messages/ed25519-broken.eml - Check Rspamc ${result} R_DKIM_REJECT
\ No newline at end of file + Check Rspamc ${result} R_DKIM_REJECT + +*** Keywords *** +DKIM Setup + ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/dkim.conf + Set Suite Variable ${PLUGIN_CONFIG} + Generic Setup PLUGIN_CONFIG diff --git a/test/functional/cases/117_spf.robot b/test/functional/cases/117_spf.robot new file mode 100644 index 000000000..2ac6997b6 --- /dev/null +++ b/test/functional/cases/117_spf.robot @@ -0,0 +1,129 @@ +*** Settings *** +Suite Setup SPF Setup +Suite Teardown Simple Teardown +Library ${TESTDIR}/lib/rspamd.py +Resource ${TESTDIR}/lib/rspamd.robot +Variables ${TESTDIR}/lib/vars.py + +*** Variables *** +${CONFIG} ${TESTDIR}/configs/plugins.conf +${RSPAMD_SCOPE} Suite +${URL_TLD} ${TESTDIR}/../../contrib/publicsuffix/effective_tld_names.dat + +*** Test Cases *** +SPF PERMFAIL UNRESOLVEABLE INCLUDE + ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim1.eml + ... -i 37.48.67.26 -F x@fail3.org.org.za + Check Rspamc ${result} R_SPF_PERMFAIL + +SPF DNSFAIL FAILED INCLUDE UNALIGNED + ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim1.eml + ... -i 8.8.8.8 -F x@fail2.org.org.za + Check Rspamc ${result} R_SPF_DNSFAIL + Should Contain ${result.stdout} DMARC_POLICY_SOFTFAIL + +SPF ALLOW UNRESOLVEABLE INCLUDE + ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim1.eml + ... -i 8.8.8.8 -F x@fail3.org.org.za + Check Rspamc ${result} R_SPF_ALLOW + +SPF ALLOW FAILED INCLUDE + ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim1.eml + ... -i 8.8.4.4 -F x@fail2.org.org.za + Check Rspamc ${result} R_SPF_ALLOW + +SPF NA NA + ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim1.eml + ... -i 8.8.8.8 -F x@za + Check Rspamc ${result} R_SPF_NA + +SPF NA NOREC + ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim1.eml + ... -i 8.8.8.8 -F x@co.za + Check Rspamc ${result} R_SPF_NA + +SPF NA NXDOMAIN + ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim1.eml + ... -i 8.8.8.8 -F x@zzzzaaaa + Check Rspamc ${result} R_SPF_NA + +SPF PERMFAIL UNRESOLVEABLE REDIRECT + ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim1.eml + ... -i 8.8.8.8 -F x@fail4.org.org.za + Check Rspamc ${result} R_SPF_PERMFAIL + +SPF REDIRECT NO USEABLE ELEMENTS + ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim1.eml + ... -i 8.8.8.8 -F x@fail10.org.org.za + Check Rspamc ${result} R_SPF_PERMFAIL + +SPF DNSFAIL FAILED REDIRECT + ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim1.eml + ... -i 8.8.8.8 -F x@fail1.org.org.za + Check Rspamc ${result} R_SPF_DNSFAIL + +SPF PERMFAIL NO USEABLE ELEMENTS + ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim1.eml + ... -i 8.8.8.8 -F x@fail5.org.org.za + Check Rspamc ${result} R_SPF_PERMFAIL + +SPF FAIL + ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim1.eml + ... -i 8.8.8.8 -F x@example.net + Check Rspamc ${result} R_SPF_FAIL + +SPF PERMFAIL UNRESOLVEABLE MX + ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim1.eml + ... -i 1.2.3.4 -F x@fail6.org.org.za + Check Rspamc ${result} R_SPF_PERMFAIL + +SPF PERMFAIL UNRESOLVEABLE A + ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim1.eml + ... -i 1.2.3.4 -F x@fail7.org.org.za + Check Rspamc ${result} R_SPF_PERMFAIL + +SPF DNSFAIL FAILED A + ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim1.eml + ... -i 1.2.3.4 -F x@fail8.org.org.za + Check Rspamc ${result} R_SPF_DNSFAIL + +SPF DNSFAIL FAILED MX + ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim1.eml + ... -i 1.2.3.4 -F x@fail9.org.org.za + Check Rspamc ${result} R_SPF_DNSFAIL + +SPF DNSFAIL FAILED RECORD + ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim1.eml + ... -i 1.2.3.4 -F x@www.dnssec-failed.org + Check Rspamc ${result} R_SPF_DNSFAIL + +SPF PASS INCLUDE + ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/bad_dkim1.eml + ... -i 8.8.8.8 -F x@pass1.org.org.za + Check Rspamc ${result} R_SPF_ALLOW + +SPF PTRS + ${result} = Scan Message With Rspamc /dev/null + ... -i 88.99.142.95 -F foo@crazyspf.cacophony.za.org + Check Rspamc ${result} R_SPF_ALLOW + ${result} = Scan Message With Rspamc /dev/null + ... -i 128.66.0.1 -F foo@crazyspf.cacophony.za.org + Check Rspamc ${result} R_SPF_PERMFAIL + ${result} = Scan Message With Rspamc /dev/null + ... -i 209.85.216.182 -F foo@crazyspf.cacophony.za.org + Check Rspamc ${result} R_SPF_FAIL + #${result} = Scan Message With Rspamc /dev/null + #... -i 98.138.91.166 -F foo@crazyspf.cacophony.za.org + #Check Rspamc ${result} R_SPF_ALLOW + #${result} = Scan Message With Rspamc /dev/null + #... -i 98.138.91.167 -F foo@crazyspf.cacophony.za.org + #Check Rspamc ${result} R_SPF_ALLOW + #${result} = Scan Message With Rspamc /dev/null + #... -i 98.138.91.168 -F foo@crazyspf.cacophony.za.org + #Check Rspamc ${result} R_SPF_ALLOW + +*** Keywords *** +SPF Setup + ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/dmarc.conf + Set Suite Variable ${PLUGIN_CONFIG} + Generic Setup PLUGIN_CONFIG diff --git a/test/functional/configs/plugins.conf b/test/functional/configs/plugins.conf index 8511c7a3c..851f280d9 100644 --- a/test/functional/configs/plugins.conf +++ b/test/functional/configs/plugins.conf @@ -14,6 +14,16 @@ options = { replies = ["k=ed25519; p=yi50DjK5O9pqbFpNHklsv9lqaS0ArSYu02qp1S0DW1Y="]; }, { + name = "brisbane._domainkey.football.example.com"; + type = txt; + replies = ["v=DKIM1; k=ed25519; p=11qYAYKxCrfVS/7TyWQHOg7hcvPapiMlrwIaaPcHURo="]; + }, + { + name = "test._domainkey.football.example.com"; + type = txt; + replies = ["v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDkHlOQoBTzWRiGs5V6NpP3idY6Wk08a5qhdR6wy5bdOKb2jLQiY/J16JYi0Qvx/byYzCNb3W91y3FutACDfzwQ/BC/e/8uBsCR+yz1Lxj+PL6lHvqMKrM3rG4hstT5QjvHO9PzoxZyVYLzBfO2EeC3Ip3G+2kryOTIKT+l/K4w3QIDAQAB"], + }, + { name = "dkim._domainkey.cacophony.za.org", type = "txt"; replies = ["v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDXtxBE5IiNRMcq2/lc2zErfdCvDFyQNBnMjbOjBQrPST2k4fdGbtpe5Iu5uS01Met+dAEf94XL8I0hwmYw+n70PP834zfJGi2egwGqrakpaWsCDPvIJZLkxJCJKQRA/zrQ622uEXdvYixVbsEGVw7U4wAGSmT5rU2eU1y63AlOlQIDAQAB"]; diff --git a/test/functional/configs/spf.conf b/test/functional/configs/spf.conf new file mode 100644 index 000000000..37028b1a7 --- /dev/null +++ b/test/functional/configs/spf.conf @@ -0,0 +1 @@ +spf { } |