From 15a5ad7fa3b877472b5ee7e14883623763eb2bed Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 11 Jun 2018 17:30:05 +0100 Subject: [PATCH] [Test] Add ed25519 tests --- test/functional/cases/130_dkim.robot | 8 ++++ test/functional/configs/dkim.conf | 49 ++++++++++++--------- test/functional/messages/ed25519-broken.eml | 14 ++++++ test/functional/messages/ed25519.eml | 14 ++++++ 4 files changed, 63 insertions(+), 22 deletions(-) create mode 100644 test/functional/messages/ed25519-broken.eml create mode 100644 test/functional/messages/ed25519.eml diff --git a/test/functional/cases/130_dkim.robot b/test/functional/cases/130_dkim.robot index 1bb08e639..ad0b27ac4 100644 --- a/test/functional/cases/130_dkim.robot +++ b/test/functional/cases/130_dkim.robot @@ -22,3 +22,11 @@ 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 + +DKIM Verify ED25519 PASS + ${result} = Scan Message With Rspamc ${TESTDIR}/messages/ed25519.eml + Check Rspamc ${result} R_DKIM_ALLOW + +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 diff --git a/test/functional/configs/dkim.conf b/test/functional/configs/dkim.conf index b10cff0c4..d3593a12d 100644 --- a/test/functional/configs/dkim.conf +++ b/test/functional/configs/dkim.conf @@ -1,33 +1,38 @@ options = { - filters = ["dkim"] - pidfile = "${TMPDIR}/rspamd.pid" - dns { - retransmits = 10; - timeout = 2s; - } + filters = ["dkim"] + pidfile = "${TMPDIR}/rspamd.pid" + dns { + retransmits = 10; + timeout = 2s; + fake_records = [{ # ed25519 + name = "test._domainkey.example.com"; + type = txt; + replies = ["k=ed25519; p=yi50DjK5O9pqbFpNHklsv9lqaS0ArSYu02qp1S0DW1Y="]; + }]; + } } logging = { - type = "file", - level = "debug" - filename = "${TMPDIR}/rspamd.log" + type = "file", + level = "debug" + filename = "${TMPDIR}/rspamd.log" } metric = { - name = "default", - actions = { - reject = 100500, - } - unknown_weight = 1 + 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}"; - } - task_timeout = 60s; + type = normal + bind_socket = ${LOCAL_ADDR}:${PORT_NORMAL} + count = 1 + keypair { + pubkey = "${KEY_PUB1}"; + privkey = "${KEY_PVT1}"; + } + task_timeout = 60s; } worker { diff --git a/test/functional/messages/ed25519-broken.eml b/test/functional/messages/ed25519-broken.eml new file mode 100644 index 000000000..187c9191d --- /dev/null +++ b/test/functional/messages/ed25519-broken.eml @@ -0,0 +1,14 @@ +DKIM-Signature: v=1; a=ed25519; c=relaxed/simple; d=example.com; + i=@example.com; q=dns/txt; s=test; t=5; h=message-id : + date : from : to : subject : date : from : subject; + bh=wE7NXSkgnx9PGiavN4OZhJztvkqPDlemV3OGuEnLwNo=; + b=wt7P+9DoBwcln1RKE3LN7069ZEEiSyVE/NH1YXnqnJy4JcrSCZUbeIEh + vXssPHelX4yNSXG9eTGTwwk5NxYqBw== +Received: from localhost +Message-ID: +Date: Mon, 02 Jan 2011 01:02:03 +0400 +From: Test User +To: somebody@example.com +Subject: Testing + +This is a test message. diff --git a/test/functional/messages/ed25519.eml b/test/functional/messages/ed25519.eml new file mode 100644 index 000000000..b3dfaaa01 --- /dev/null +++ b/test/functional/messages/ed25519.eml @@ -0,0 +1,14 @@ +DKIM-Signature: v=1; a=ed25519; c=relaxed/simple; d=example.com; + i=@example.com; q=dns/txt; s=test; t=5; h=message-id : + date : from : to : subject : date : from : subject; + bh=wE7NXSkgnx9PGiavN4OZhJztvkqPDlemV3OGuEnLwNo=; + b=wt7P+9DoBwcln1RKE3LN7069ZEEiSyVE/NH1YXnqnJy4JcrSCZUbeIEh + vXssPHelX4yNSXG9eTGTwwk5NxYqBw== +Received: from localhost +Message-ID: +Date: Mon, 01 Jan 2011 01:02:03 +0400 +From: Test User +To: somebody@example.com +Subject: Testing + +This is a test message. -- 2.39.5