From: Vsevolod Stakhov Date: Mon, 11 Jun 2018 16:30:05 +0000 (+0100) Subject: [Test] Add ed25519 tests X-Git-Tag: 1.7.6~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=15a5ad7fa3b877472b5ee7e14883623763eb2bed;p=thirdparty%2Frspamd.git [Test] Add ed25519 tests --- diff --git a/test/functional/cases/130_dkim.robot b/test/functional/cases/130_dkim.robot index 1bb08e6391..ad0b27ac47 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 b10cff0c47..d3593a12d7 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 0000000000..187c9191d1 --- /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 0000000000..b3dfaaa01e --- /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.