From b76827ebc16be81e907cc46732cc8f3d7a29282b Mon Sep 17 00:00:00 2001 From: Andrew Lewis Date: Tue, 2 Aug 2016 19:22:53 +0100 Subject: [Test] Add DKIM sign + verify tests --- test/functional/cases/130_dkim.robot | 24 ++++++++++++++++++ test/functional/configs/dkim.conf | 47 ++++++++++++++++++++++++++++++++++++ test/functional/configs/dkim.key | 16 ++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 test/functional/cases/130_dkim.robot create mode 100644 test/functional/configs/dkim.conf create mode 100644 test/functional/configs/dkim.key (limited to 'test') diff --git a/test/functional/cases/130_dkim.robot b/test/functional/cases/130_dkim.robot new file mode 100644 index 000000000..88ce5eb28 --- /dev/null +++ b/test/functional/cases/130_dkim.robot @@ -0,0 +1,24 @@ +*** Settings *** +Suite Setup Generic Setup +Suite Teardown Generic Teardown +Library ${TESTDIR}/lib/rspamd.py +Resource ${TESTDIR}/lib/rspamd.robot +Variables ${TESTDIR}/lib/vars.py + +*** Variables *** +${CONFIG} ${TESTDIR}/configs/dkim.conf +${RSPAMD_SCOPE} Suite + +*** Test Cases *** +DKIM Sign + Set Suite Variable ${RAN_SIGNTEST} 0 + ${result} = Scan Message With Rspamc ${TESTDIR}/messages/spam_message.eml --mime --header=dodkim=1 + Check Rspamc ${result} DKIM-Signature + Set Suite Variable ${SIGNED_MESSAGE} ${TMPDIR}/dkim_sign_test.eml + Create File ${SIGNED_MESSAGE} ${result.stdout} + Set Suite Variable ${RAN_SIGNTEST} 1 + +DKIM Self Verify + Run Keyword If ${RAN_SIGNTEST} == 0 Fail "Sign test was not run" + ${result} = Scan Message With Rspamc ${SIGNED_MESSAGE} + Check Rspamc ${result} R_DKIM_ALLOW diff --git a/test/functional/configs/dkim.conf b/test/functional/configs/dkim.conf new file mode 100644 index 000000000..b5158564d --- /dev/null +++ b/test/functional/configs/dkim.conf @@ -0,0 +1,47 @@ +options = { + filters = ["dkim"] + pidfile = "${TMPDIR}/rspamd.pid" +} +logging = { + type = "file", + level = "debug" + filename = "${TMPDIR}/rspamd.log" +} +metric = { + name = "default", + actions = { + reject = 100500, + } + unknown_weight = 1 +} + +worker { + type = normal + bind_socket = ${LOCAL_ADDR}:${PORT_NORMAL} + count = 1 + keypair { + pubkey = "${KEY_PUB1}"; + privkey = "${KEY_PVT1}"; + } +} + +dkim { + +sign_condition =<