-
Notifications
You must be signed in to change notification settings - Fork 70
/
authres.t
executable file
·144 lines (114 loc) · 4.85 KB
/
authres.t
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
#!/usr/bin/perl -T
use lib '.'; use lib 't';
use SATest; sa_t_init("authres");
use Test::More;
plan tests => 44;
# ---------------------------------------------------------------------------
tstpre ("
loadplugin Mail::SpamAssassin::Plugin::AuthRes
");
## with internal networks
tstprefs("
clear_internal_networks
clear_trusted_networks
internal_networks 212.17.35.15
trusted_networks 212.17.35.15
trusted_networks 141.154.95.22
");
%patterns = (
'parsing Authentication-Results: authrestest1int', 'hdr1',
'parsing Authentication-Results: authrestest2int', 'hdr2',
'parsing Authentication-Results: authrestest3int', 'hdr3',
'parsing Authentication-Results: authrestest4int', 'hdr4',
'parsing Authentication-Results: authrestest5int', 'hdr5',
'parsing Authentication-Results: authrestest6int', 'hdr6',
'authres: results: dkim=pass dmarc=none spf=pass', 'results',
);
%anti_patterns = (
'parsing Authentication-Results: authrestest7tru', 'hdr7',
'parsing Authentication-Results: authrestest8ext', 'hdr8',
'authres: no Authentication-Results headers found', 'nohdr',
'authres: skipping header,', 'skipping',
);
sarun ("-D authres -L -t < data/nice/authres 2>&1", \&patterns_run_cb);
ok_all_patterns();
## with trusted networks included
tstprefs("
clear_internal_networks
clear_trusted_networks
internal_networks 212.17.35.15
trusted_networks 212.17.35.15
trusted_networks 141.154.95.22
authres_networks trusted
");
%patterns = (
'parsing Authentication-Results: authrestest1int', 'hdr1',
'parsing Authentication-Results: authrestest2int', 'hdr2',
'parsing Authentication-Results: authrestest3int', 'hdr3',
'parsing Authentication-Results: authrestest4int', 'hdr4',
'parsing Authentication-Results: authrestest5int', 'hdr5',
'parsing Authentication-Results: authrestest6int', 'hdr6',
'parsing Authentication-Results: authrestest7tru', 'hdr7',
'authres: results: dkim=pass dmarc=none spf=pass', 'results',
);
%anti_patterns = (
'parsing Authentication-Results: authrestest8ext', 'hdr8',
'authres: no Authentication-Results headers found', 'nohdr',
'authres: skipping header,', 'skipping',
);
sarun ("-D authres -L -t < data/nice/authres 2>&1", \&patterns_run_cb);
ok_all_patterns();
## with all networks (test ignore also)
tstprefs("
clear_internal_networks
clear_trusted_networks
internal_networks 212.17.35.15
trusted_networks 212.17.35.15
trusted_networks 141.154.95.22
authres_networks all
authres_ignored_authserv authrestest3int authrestest4int
");
%patterns = (
'parsing Authentication-Results: authrestest1int', 'hdr1',
'parsing Authentication-Results: authrestest2int', 'hdr2',
'parsing Authentication-Results: authrestest3int', 'hdr3',
'parsing Authentication-Results: authrestest4int', 'hdr4',
'parsing Authentication-Results: authrestest5int', 'hdr5',
'parsing Authentication-Results: authrestest6int', 'hdr6',
'parsing Authentication-Results: authrestest7tru', 'hdr7',
'parsing Authentication-Results: authrestest8ext', 'hdr8',
'authres: results: dkim=pass dmarc=none spf=pass', 'results',
'authres: skipping header, ignored authserv: authrestest3int', 'skip3',
'authres: skipping header, ignored authserv: authrestest4int', 'skip4',
);
%anti_patterns = (
'authres: no Authentication-Results headers found', 'nohdr',
);
sarun ("-D authres -L -t < data/nice/authres 2>&1", \&patterns_run_cb);
ok_all_patterns();
## with all networks (test trusted also)
tstprefs("
clear_internal_networks
clear_trusted_networks
internal_networks 212.17.35.15
trusted_networks 212.17.35.15
trusted_networks 141.154.95.22
authres_networks all
authres_trusted_authserv authrestest6int
");
%patterns = (
'dbg: authres: skipping header, authserv not trusted: authrestest1int', 'skip1',
'dbg: authres: skipping header, authserv not trusted: authrestest2int', 'skip2',
'dbg: authres: skipping header, authserv not trusted: authrestest3int', 'skip3',
'dbg: authres: skipping header, authserv not trusted: authrestest4int', 'skip4',
'dbg: authres: skipping header, authserv not trusted: authrestest5int', 'skip5',
'dbg: authres: skipping header, authserv not trusted: authrestest7tru', 'skip6',
'dbg: authres: skipping header, authserv not trusted: authrestest8ext', 'skip7',
'parsing Authentication-Results: authrestest6int', 'parsing',
'authres: results: dkim=fail', 'results',
);
%anti_patterns = (
'authres: no Authentication-Results headers found', 'nohdr',
);
sarun ("-D authres -L -t < data/nice/authres 2>&1", \&patterns_run_cb);
ok_all_patterns();