aboutsummaryrefslogtreecommitdiffstats
path: root/test/functional/cases/115_dmarc.robot
blob: 4e504ebd00b472a78397fe7ebb962be42eca0dad (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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
*** Settings ***
Suite Setup     DMARC Setup
Suite Teardown  Simple Teardown
Library         ${TESTDIR}/lib/rspamd.py
Resource        ${TESTDIR}/lib/rspamd.robot
Variables       ${TESTDIR}/lib/vars.py

*** Variables ***
${CONFIG}        ${TESTDIR}/configs/plugins.conf
${RSPAMD_SCOPE}  Suite
${URL_TLD}       ${TESTDIR}/../../contrib/publicsuffix/effective_tld_names.dat

*** Test Cases ***
DMARC NONE PASS DKIM
  ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/dmarc/pass_none.eml
  Check Rspamc  ${result}  DMARC_POLICY_ALLOW

DMARC NONE PASS SPF
  ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/dmarc/fail_none.eml
  ...  -i  8.8.4.4  --from  foo@spf.cacophony.za.org
  Check Rspamc  ${result}  DMARC_POLICY_ALLOW

DMARC NONE FAIL
  ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/dmarc/fail_none.eml
  Check Rspamc  ${result}  DMARC_POLICY_SOFTFAIL

DMARC REJECT FAIL
  ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/dmarc/fail_reject.eml
  Check Rspamc  ${result}  DMARC_POLICY_REJECT

DMARC QUARANTINE FAIL
  ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/dmarc/fail_quarantine.eml
  Check Rspamc  ${result}  DMARC_POLICY_QUARANTINE

DMARC SP NONE FAIL
  ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/dmarc/subdomain_fail_none.eml
  Check Rspamc  ${result}  DMARC_POLICY_SOFTFAIL

DMARC SP REJECT FAIL
  ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/dmarc/subdomain_fail_reject.eml
  Check Rspamc  ${result}  DMARC_POLICY_REJECT

DMARC SP QUARANTINE FAIL
  ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/dmarc/subdomain_fail_quarantine.eml
  Check Rspamc  ${result}  DMARC_POLICY_QUARANTINE

DMARC SUBDOMAIN FAIL DKIM STRICT ALIGNMENT
  ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/dmarc/onsubdomain_fail_alignment.eml
  Check Rspamc  ${result}  DMARC_POLICY_REJECT

DMARC SUBDOMAIN PASS DKIM RELAXED ALIGNMENT
  ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/dmarc/onsubdomain_pass_relaxed.eml
  Check Rspamc  ${result}  DMARC_POLICY_ALLOW

DMARC SUBDOMAIN PASS SPF STRICT ALIGNMENT
  ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/dmarc/onsubdomain_fail_alignment.eml
  ...  -i  37.48.67.26  --from  foo@yo.mom.za.org
  Check Rspamc  ${result}  DMARC_POLICY_ALLOW

DMARC SUBDOMAIN FAIL SPF STRICT ALIGNMENT
  ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/dmarc/onsubdomain_fail_alignment.eml
  ...  -i  37.48.67.26  --from  foo@mom.za.org
  Check Rspamc  ${result}  DMARC_POLICY_REJECT

DMARC SUBDOMAIN PASS SPF RELAXED ALIGNMENT
  ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/dmarc/onsubdomain_fail.eml
  ...  -i  37.48.67.26  --from  foo@mom.za.org
  Check Rspamc  ${result}  DMARC_POLICY_ALLOW

DMARC DNSFAIL
  ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/dmarc/dmarc_tmpfail.eml
  ...  -i  37.48.67.26  --from  foo@mom.za.org
  Check Rspamc  ${result}  DMARC_DNSFAIL

DMARC NA NXDOMAIN
  ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/utf.eml
  ...  -i  37.48.67.26  --from  foo@mom.za.org
  Check Rspamc  ${result}  DMARC_NA

DKIM PERMFAIL NXDOMAIN
  ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/dmarc/bad_dkim2.eml
  ...  -i  37.48.67.26
  Check Rspamc  ${result}  R_DKIM_PERMFAIL

DKIM PERMFAIL BAD RECORD
  ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/dmarc/bad_dkim1.eml
  ...  -i  37.48.67.26
  Check Rspamc  ${result}  R_DKIM_PERMFAIL

DKIM TEMPFAIL SERVFAIL
  ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/dmarc/bad_dkim3.eml
  ...  -i  37.48.67.26
  Check Rspamc  ${result}  R_DKIM_TEMPFAIL
  Should Contain  ${result.stdout}  DMARC_DNSFAIL

DKIM NA NOSIG
  ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/utf.eml
  ...  -i  37.48.67.26
  Check Rspamc  ${result}  R_DKIM_NA

SPF PERMFAIL UNRESOLVEABLE INCLUDE
  ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/dmarc/bad_dkim1.eml
  ...  -i  37.48.67.26  -F  x@fail3.org.org.za
  Check Rspamc  ${result}  R_SPF_PERMFAIL

SPF DNSFAIL FAILED INCLUDE
  ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/dmarc/bad_dkim1.eml
  ...  -i  8.8.8.8  -F  x@fail2.org.org.za
  Check Rspamc  ${result}  R_SPF_DNSFAIL
  Should Contain  ${result.stdout}  DMARC_DNSFAIL

SPF ALLOW UNRESOLVEABLE INCLUDE
  ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/dmarc/bad_dkim1.eml
  ...  -i  8.8.8.8  -F  x@fail3.org.org.za
  Check Rspamc  ${result}  R_SPF_ALLOW

SPF ALLOW FAILED INCLUDE
  ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/dmarc/bad_dkim1.eml
  ...  -i  8.8.4.4  -F  x@fail2.org.org.za
  Check Rspamc  ${result}  R_SPF_ALLOW

SPF NA NA
  ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/dmarc/bad_dkim1.eml
  ...  -i  8.8.8.8  -F  x@za
  Check Rspamc  ${result}  R_SPF_NA

SPF NA NOREC
  ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/dmarc/bad_dkim1.eml
  ...  -i  8.8.8.8  -F  x@co.za
  Check Rspamc  ${result}  R_SPF_NA

SPF NA NXDOMAIN
  ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/dmarc/bad_dkim1.eml
  ...  -i  8.8.8.8  -F  x@zzzzaaaa
  Check Rspamc  ${result}  R_SPF_NA

SPF PERMFAIL UNRESOLVEABLE REDIRECT
  ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/dmarc/bad_dkim1.eml
  ...  -i  8.8.8.8  -F  x@fail4.org.org.za
  Check Rspamc  ${result}  R_SPF_PERMFAIL

SPF REDIRECT NO USEABLE ELEMENTS
  ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/dmarc/bad_dkim1.eml
  ...  -i  8.8.8.8  -F  x@fail10.org.org.za
  Check Rspamc  ${result}  R_SPF_PERMFAIL

SPF DNSFAIL FAILED REDIRECT
  ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/dmarc/bad_dkim1.eml
  ...  -i  8.8.8.8  -F  x@fail1.org.org.za
  Check Rspamc  ${result}  R_SPF_DNSFAIL

SPF PERMFAIL NO USEABLE ELEMENTS
  ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/dmarc/bad_dkim1.eml
  ...  -i  8.8.8.8  -F  x@fail5.org.org.za
  Check Rspamc  ${result}  R_SPF_PERMFAIL

SPF FAIL
  ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/dmarc/bad_dkim1.eml
  ...  -i  8.8.8.8  -F  x@example.net
  Check Rspamc  ${result}  R_SPF_FAIL

SPF PERMFAIL UNRESOLVEABLE MX
  ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/dmarc/bad_dkim1.eml
  ...  -i  1.2.3.4  -F  x@fail6.org.org.za
  Check Rspamc  ${result}  R_SPF_PERMFAIL

SPF PERMFAIL UNRESOLVEABLE A
  ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/dmarc/bad_dkim1.eml
  ...  -i  1.2.3.4  -F  x@fail7.org.org.za
  Check Rspamc  ${result}  R_SPF_PERMFAIL

SPF DNSFAIL FAILED A
  ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/dmarc/bad_dkim1.eml
  ...  -i  1.2.3.4  -F  x@fail8.org.org.za
  Check Rspamc  ${result}  R_SPF_DNSFAIL

SPF DNSFAIL FAILED MX
  ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/dmarc/bad_dkim1.eml
  ...  -i  1.2.3.4  -F  x@fail9.org.org.za
  Check Rspamc  ${result}  R_SPF_DNSFAIL

SPF DNSFAIL FAILED RECORD
  ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/dmarc/bad_dkim1.eml
  ...  -i  1.2.3.4  -F  x@www.dnssec-failed.org
  Check Rspamc  ${result}  R_SPF_DNSFAIL

SPF PASS INCLUDE
  ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/dmarc/bad_dkim1.eml
  ...  -i  8.8.8.8  -F  x@pass1.org.org.za
  Check Rspamc  ${result}  R_SPF_ALLOW

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