commit 479e97e: [Test] Add some tests for arc signing
Vsevolod Stakhov
vsevolod at highsecure.ru
Tue May 14 09:56:06 UTC 2019
Author: Vsevolod Stakhov
Date: 2019-05-14 10:53:17 +0100
URL: https://github.com/rspamd/rspamd/commit/479e97e8c044d3bc2f711c25a276a9ea5aec567a (HEAD -> master)
[Test] Add some tests for arc signing
---
.../cases/320_arc_signing/001_simple.robot | 40 ++++++++++++++++++++++
.../002_redis.robot | 20 +++++------
.../{dkim_signing => arc_signing}/redis.conf | 2 +-
.../{dkim_signing => arc_signing}/simple.conf | 3 +-
4 files changed, 52 insertions(+), 13 deletions(-)
diff --git a/test/functional/cases/320_arc_signing/001_simple.robot b/test/functional/cases/320_arc_signing/001_simple.robot
new file mode 100644
index 000000000..73623574b
--- /dev/null
+++ b/test/functional/cases/320_arc_signing/001_simple.robot
@@ -0,0 +1,40 @@
+*** Settings ***
+Suite Setup ARC Signing Setup
+Suite Teardown ARC Signing Teardown
+Library ${TESTDIR}/lib/rspamd.py
+Resource ${TESTDIR}/lib/rspamd.robot
+Variables ${TESTDIR}/lib/vars.py
+
+*** Variables ***
+${CONFIG} ${TESTDIR}/configs/plugins.conf
+${MESSAGE} ${TESTDIR}/messages/dmarc/fail_none.eml
+${MESSAGE_FAIL} ${TESTDIR}/messages/dmarc/fail_none1.eml
+${REDIS_SCOPE} Suite
+${RSPAMD_SCOPE} Suite
+${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat
+
+*** Test Cases ***
+TEST SIGNED
+ ${result} = Scan Message With Rspamc ${MESSAGE} -u bob at cacophony.za.org
+ Should Contain ${result.stdout} ARC_SIGNED
+
+TEST SIGNED HTTP HEADERS
+ ${result} = Scan Message With Rspamc ${MESSAGE} -u bob at cacophony.za.org --header=PerformArcSign:yes --header=DkimDomain:cacophony.za.org --header=DkimSelector:dkim --header=DkimPrivateKey:MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBANe3EETkiI1Exyrb+VzbMSt90K8MXJA0GcyNs6MFCs9JPaTh90Zu2l7ki7m5LTUx6350AR/3hcvwjSHCZjD6fvQ8/zfjN8kaLZ6DAaqtqSlpawIM+8glkuTEkIkpBED/OtDrba4Rd29iLFVuwQZXDtTjAAZKZPmtTZ5TXLrcCU6VAgMBAAECgYEA1BFvmBsIN8Gu/+6kNupya2xUNVM0yLu/xT5lpNV3LBO325oejAq8+d87kkl/LTW3a2jGFlQ0ICuLw+2mo24QUWRyv8if3oeBMlnLqHE+6wNjFVqo5sOjKzjO363xSXwXNUrBT7jDhnZcDN8w3/FecYKjifGTVtUs1SLsYwhlc8ECQQDuCRymLZQ/imPn5eFVIydwUzg8ptZlvoA7bfIxUL9BQRX33s59kLCilA0tTed8Dd+GnxsT93XOj1ApIfBwmTSlAkEA5/63PDsN7fH+WInqVD8nU07M9S8LcGDlPbVVBr2S2I78/iwrSDAYtbkU2vEbhFK/JuKNML2j8OkzV3v1QulfMQJBALDzhx+l/HHr3+8RPhx7QKNIyiKUaAdEwbDsP8IXY8YPq1QThu9jM1v4sX7/TdkzuvoppwiFykbe1NlvCH279p0CQCmTg4Ee0DtBcCSr6rvYaZLLf329RZ6JLuwlMCy6ErQOxBZFEiiovfTrS2qFZToMnkc4uLbwdY36LQJTq7unGTECQCCok8LzBeZtAw+TJofpOM3F2Rlm2qXiBVBeubhRedsiljG0hpvvLJBMppnQ6r27p5Jk39SmaTRkxEKrxPWWLNM=
+ Should Contain ${result.stdout} ARC_SIGNED
+
+TEST NOT SIGNED - USERNAME WRONG DOMAIN
+ ${result} = Scan Message With Rspamc ${MESSAGE} -u bob at example.tk
+ Should Not Contain ${result.stdout} ARC_SIGNED
+
+TEST NOT SIGNED - USERNAME WRONG PUBKEY
+ ${result} = Scan Message With Rspamc ${MESSAGE_FAIL} -u bob at invalid.za.org
+ Should Not Contain ${result.stdout} ARC_SIGNED
+
+*** Keywords ***
+ARC Signing Setup
+ ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/arc_signing/simple.conf
+ Set Suite Variable ${PLUGIN_CONFIG}
+ Generic Setup PLUGIN_CONFIG
+
+ARC Signing Teardown
+ Normal Teardown
diff --git a/test/functional/cases/131_dkim_signing/002_redis.robot b/test/functional/cases/320_arc_signing/002_redis.robot
similarity index 61%
copy from test/functional/cases/131_dkim_signing/002_redis.robot
copy to test/functional/cases/320_arc_signing/002_redis.robot
index e87749a0a..2fde59164 100644
--- a/test/functional/cases/131_dkim_signing/002_redis.robot
+++ b/test/functional/cases/320_arc_signing/002_redis.robot
@@ -1,6 +1,6 @@
*** Settings ***
-Suite Setup DKIM Signing Setup
-Suite Teardown DKIM Signing Teardown
+Suite Setup ARC Signing Setup
+Suite Teardown ARC Signing Teardown
Library ${TESTDIR}/lib/rspamd.py
Resource ${TESTDIR}/lib/rspamd.robot
Variables ${TESTDIR}/lib/vars.py
@@ -15,24 +15,22 @@ ${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat
*** Test Cases ***
TEST SIGNED
${result} = Scan Message With Rspamc ${MESSAGE} -u bob at cacophony.za.org
- Check Rspamc ${result} DKIM-Signature:
- Should Contain ${result.stdout} DKIM_SIGNED
+ Should Contain ${result.stdout} ARC_SIGNED
TEST NOT SIGNED - USERNAME WRONG DOMAIN
${result} = Scan Message With Rspamc ${MESSAGE} -u bob at example.tk
- Check Rspamc ${result} DKIM-Signature: inverse=1
- Should Not Contain ${result.stdout} DKIM_SIGNED
+ Should Not Contain ${result.stdout} ARC_SIGNED
*** Keywords ***
-DKIM Signing Setup
- ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/dkim_signing/redis.conf
+ARC Signing Setup
+ ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/arc_signing/redis.conf
Set Suite Variable ${PLUGIN_CONFIG}
Generic Setup PLUGIN_CONFIG
Run Redis
- Redis HSET TEST_DKIM_SELECTORS cacophony.za.org dkim
+ Redis HSET TEST_DKIM_SELECTORS cacophony.za.org arc
${key} = Get File ${TESTDIR}/configs/dkim.key
- Redis HSET TEST_DKIM_KEYS dkim.cacophony.za.org ${key}
+ Redis HSET TEST_DKIM_KEYS arc.cacophony.za.org ${key}
-DKIM Signing Teardown
+ARC Signing Teardown
Normal Teardown
Shutdown Process With Children ${REDIS_PID}
diff --git a/test/functional/configs/dkim_signing/redis.conf b/test/functional/configs/arc_signing/redis.conf
similarity index 90%
copy from test/functional/configs/dkim_signing/redis.conf
copy to test/functional/configs/arc_signing/redis.conf
index 903a13cf4..b2a9aa134 100644
--- a/test/functional/configs/dkim_signing/redis.conf
+++ b/test/functional/configs/arc_signing/redis.conf
@@ -1,4 +1,4 @@
-dkim_signing {
+arc {
use_redis = true;
key_prefix = "TEST_DKIM_KEYS";
selector_prefix = "TEST_DKIM_SELECTORS";
diff --git a/test/functional/configs/dkim_signing/simple.conf b/test/functional/configs/arc_signing/simple.conf
similarity index 85%
copy from test/functional/configs/dkim_signing/simple.conf
copy to test/functional/configs/arc_signing/simple.conf
index 14b8d5ec6..5807d7346 100644
--- a/test/functional/configs/dkim_signing/simple.conf
+++ b/test/functional/configs/arc_signing/simple.conf
@@ -1,7 +1,8 @@
-dkim_signing {
+arc {
path = "${TESTDIR}/configs/dkim.key";
check_pubkey = true;
allow_pubkey_mismatch = false;
+ selector = "dkim";
use_http_headers = true;
allow_headers_fallback = true;
}
More information about the Commits
mailing list