aboutsummaryrefslogtreecommitdiffstats
path: root/test/functional/cases/123_whitelist.robot
blob: 6482793a3a8813c792e2a7b435cf5c48ad23b58e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
*** Settings ***
Suite Setup     Whitelist Setup
Suite Teardown  Normal Teardown
Library         ${TESTDIR}/lib/rspamd.py
Resource        ${TESTDIR}/lib/rspamd.robot
Variables       ${TESTDIR}/lib/vars.py

*** Variables ***
${CONFIG}       ${TESTDIR}/configs/plugins.conf
${M_DMARC_OK}   ${TESTDIR}/messages/dmarc/pass_none.eml
${M_DMARC_BAD}  ${TESTDIR}/messages/dmarc/fail_none.eml

${M_DKIM_RSPAMD_OK}   ${TESTDIR}/messages/dmarc/good_dkim_rspamd.eml
${M_DKIM_RSPAMD_BAD}  ${TESTDIR}/messages/dmarc/bad_dkim_rspamd.eml
${M_NO_DKIM_VALID_SPF}  ${TESTDIR}/messages/dmarc/no_dkim_valid_spf.eml

${UTF_MESSAGE}  ${TESTDIR}/messages/utf.eml
${RSPAMD_SCOPE}  Suite
${URL_TLD}      ${TESTDIR}/../lua/unit/test_tld.dat

*** Test Cases ***
WHITELISTS
  Scan File  ${M_DMARC_OK}  IP=8.8.4.4  From=foo@spf.cacophony.za.org
  Expect Symbol With Score  WHITELIST_DKIM  -1
  Expect Symbol With Score  STRICT_DMARC  -3
  Expect Symbol With Score  WHITELIST_SPF_DKIM  -3
  Expect Symbol With Score  WHITELIST_DDS  -3
  Expect Symbol With Score  WHITELIST_DMARC  -2
  Expect Symbol With Score  WHITELIST_DMARC_DKIM  -2
  Expect Symbol With Score  WHITELIST_SPF  -1
  Do Not Expect Symbol  BLACKLIST_SPF
  Do Not Expect Symbol  BLACKLIST_DKIM
  Do Not Expect Symbol  BLACKLIST_DMARC

BLACKLIST SHOULD FIRE IF ANY CONSTRAINT FAILED
  Scan File  ${M_DMARC_OK}  IP=9.8.4.4  From=foo@spf.cacophony.za.org
  Expect Symbol With Score  BLACKLIST_DDS  3
  Do Not Expect Symbol  WHITELIST_DDS
  Do Not Expect Symbol  WHITELIST_SPF

BLACKLISTS
  Scan File  ${M_DMARC_BAD}  IP=9.8.4.4  From=foo@cacophony.za.org
  Expect Symbol With Score  BLACKLIST_SPF  3
  Expect Symbol With Score  BLACKLIST_SPF  3
  Expect Symbol With Score  STRICT_DMARC  3
  Expect Symbol With Score  BLACKLIST_DDS  3
  Expect Symbol With Score  BLACKLIST_DMARC  2
  Do Not Expect Symbol  WHITELIST_DDS
  Do Not Expect Symbol  WHITELIST_SPF
  Do Not Expect Symbol  WHITELIST_DKIM
  Do Not Expect Symbol  WHITELIST_DMARC
  Do Not Expect Symbol  WHITELIST_DMARC_DKIM

WHITELIST_WL_ONLY - VALID SPF AND VALID DKIM
  Scan File  ${M_DKIM_RSPAMD_OK}
  Expect Symbol With Score  WHITELIST_DKIM  -2
  Do Not Expect Symbol  BLACKLIST_DKIM
  Expect Symbol With Score  R_SPF_ALLOW  1
  Expect Symbol With Score  R_DKIM_ALLOW  1
  Expect Symbol With Score  WHITELIST_SPF_DKIM  -6

BLACKLISTS_WL_ONLY - VALID SPF AND INVALID DKIM
  Scan File  ${M_DKIM_RSPAMD_BAD}
  Expect Symbol With Score  R_DKIM_REJECT  1
  Do Not Expect Symbol  WHITELIST_DKIM
  Do Not Expect Symbol  BLACKLIST_DKIM
  Expect Symbol With Score  R_SPF_ALLOW  1
  Expect Symbol With Score  R_DKIM_REJECT  1
  Do Not Expect Symbol  WHITELIST_SPF_DKIM
  Do Not Expect Symbol  R_DKIM_ALLOW

VALID SPF and NO DKIM
  Scan File  ${M_NO_DKIM_VALID_SPF}
  Expect Symbol With Score  R_SPF_ALLOW  1
  Expect Symbol With Score  R_DKIM_NA  1
  Do Not Expect Symbol  R_DKIM_REJECT
  Do Not Expect Symbol  WHITELIST_SPF_DKIM
  Do Not Expect Symbol  R_DKIM_ALLOW

*** Keywords ***
Whitelist Setup
  ${PLUGIN_CONFIG} =  Get File  ${TESTDIR}/configs/whitelist.conf
  Set Suite Variable  ${PLUGIN_CONFIG}
  Generic Setup  PLUGIN_CONFIG