]> source.dussan.org Git - rspamd.git/commitdiff
Add ed25519 signing tests
authorJohn McKay <adenosine3p@gmail.com>
Mon, 21 Jan 2019 01:45:16 +0000 (01:45 +0000)
committerJohn McKay <adenosine3p@gmail.com>
Sat, 2 Feb 2019 05:30:00 +0000 (05:30 +0000)
test/functional/cases/131_dkim_signing/003_eddsa.robot [new file with mode: 0644]
test/functional/configs/dkim-eddsa.key [new file with mode: 0644]
test/functional/configs/dkim_signing/eddsa.conf [new file with mode: 0644]
test/functional/configs/plugins.conf

diff --git a/test/functional/cases/131_dkim_signing/003_eddsa.robot b/test/functional/cases/131_dkim_signing/003_eddsa.robot
new file mode 100644 (file)
index 0000000..ea2fe03
--- /dev/null
@@ -0,0 +1,39 @@
+*** Settings ***
+Suite Setup     DKIM Signing Setup
+Suite Teardown  DKIM 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@cacophony.za.org
+  Check Rspamc  ${result}  DKIM-Signature:
+  Should Contain  ${result.stdout}  DKIM_SIGNED
+
+TEST NOT SIGNED - USERNAME WRONG DOMAIN
+  ${result} =  Scan Message With Rspamc  ${MESSAGE}  -u  bob@example.tk
+  Check Rspamc  ${result}  DKIM-Signature:  inverse=1
+  Should Not Contain  ${result.stdout}  DKIM_SIGNED
+
+TEST NOT SIGNED - USERNAME WRONG PUBKEY
+  ${result} =  Scan Message With Rspamc  ${MESSAGE_FAIL}  -u  bob@invalid.za.org
+  Check Rspamc  ${result}  DKIM-Signature:  inverse=1
+  Should Not Contain  ${result.stdout}  DKIM_SIGNED
+
+*** Keywords ***
+DKIM Signing Setup
+  ${PLUGIN_CONFIG} =  Get File  ${TESTDIR}/configs/dkim_signing/eddsa.conf
+  Set Suite Variable  ${PLUGIN_CONFIG}
+  Generic Setup  PLUGIN_CONFIG
+
+DKIM Signing Teardown
+  Normal Teardown
diff --git a/test/functional/configs/dkim-eddsa.key b/test/functional/configs/dkim-eddsa.key
new file mode 100644 (file)
index 0000000..45282e1
--- /dev/null
@@ -0,0 +1 @@
+m5kGxtckRfsNe5EuYTe7bvkDjSh7LXaX3aXyIMPGLR0=
diff --git a/test/functional/configs/dkim_signing/eddsa.conf b/test/functional/configs/dkim_signing/eddsa.conf
new file mode 100644 (file)
index 0000000..1a93c9e
--- /dev/null
@@ -0,0 +1,6 @@
+dkim_signing {
+  path = "${TESTDIR}/configs/dkim-eddsa.key";
+  selector = "eddsa";
+  check_pubkey = true;
+  allow_pubkey_mismatch = false;
+}
index d7a5b009c58e4b1a768da5440324fe801212b41a..507f00b76748f71df9434eabadea62e8bc073bf2 100644 (file)
@@ -17,11 +17,21 @@ options = {
           type = "txt";
           replies = ["v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDXtxBE5IiNRMcq2/lc2zErfdCvDFyQNBnMjbOjBQrPST2k4fdGbtpe5Iu5uS01Met+dAEf94XL8I0hwmYw+n70PP834zfJGi2egwGqrakpaWsCDPvIJZLkxJCJKQRA/zrQ622uEXdvYixVbsEGVw7U4wAGSmT5rU2eU1y63AlOlQIDAQAB"];
         },
+        {
+          name = "eddsa._domainkey.cacophony.za.org",
+          type = "txt";
+          replies = ["v=DKIM1; k=ed25519; p=+nU+aC33ICeS4zx8VUjFYCtxj0fRbHWQn2gP2hTkm9w="];
+        },
         {
           name = "dkim._domainkey.invalid.za.org",
           type = "txt";
           replies = ["v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDEEXmNGQq7PUrr9Mg4UakTFHgXBCy2DOztkrZm+0OrVWtiRzGluxBkbOWTBwuU3/Yw97yTphBMQxzWFN603/f/KPAQcF/Lc1l+6kmIBBxNXjjGuOK/3PYKZVntUdKmqcQBYfnHdzH2Tohbuyx1a7xqnv6VSChqQrZU4CwkeT3+eQIDAQAB"];
         },
+        {
+          name = "eddsa._domainkey.invalid.za.org",
+          type = "txt";
+          replies = ["v=DKIM1; k=ed25519; p=Wkkrp5DJTvknDMGWYv8vm3p3sZjiQp03LZo80RregY8="];
+        },
         {
           name = "dkim._domainkey.rspamd.com",
           type = "txt";