haraka-plugin-karma 2.1.2 → 2.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{Changes.md → CHANGELOG.md} +33 -27
- package/README.md +13 -21
- package/index.js +230 -202
- package/package.json +21 -14
- package/test/karma.js +227 -123
- package/.codeclimate.yml +0 -25
- package/.eslintrc.yaml +0 -24
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -29
- package/.github/ISSUE_TEMPLATE/custom.md +0 -10
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- package/.github/workflows/ci.yml +0 -50
- package/.github/workflows/codeql.yml +0 -14
- package/.github/workflows/publish.yml +0 -16
- package/.gitmodules +0 -3
|
@@ -1,120 +1,126 @@
|
|
|
1
|
+
# Changelog
|
|
1
2
|
|
|
2
|
-
|
|
3
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/).
|
|
3
4
|
|
|
5
|
+
### Unreleased
|
|
6
|
+
|
|
7
|
+
### [2.1.4] - 2024-04-06
|
|
8
|
+
|
|
9
|
+
- eslint: reduce config to depending on @haraka
|
|
10
|
+
- package.json: added scripts
|
|
11
|
+
- doc(CHANGELOG): ordered urls
|
|
12
|
+
- doc(Changes) -> CHANGELOG
|
|
13
|
+
- prettier & eslint configs
|
|
14
|
+
- chore: populate package.json [files]
|
|
15
|
+
|
|
16
|
+
### [2.1.3] - 2023-12-12
|
|
17
|
+
|
|
18
|
+
- ci: use shared configs
|
|
19
|
+
- style(es6): replace for..i with for...of
|
|
20
|
+
- deps(\*): bump versions to latest
|
|
4
21
|
|
|
5
22
|
### [2.1.2] - 2023-12-11
|
|
6
23
|
|
|
7
24
|
- config: update several plugin names
|
|
8
25
|
- style(es6): refer to plugin as 'this'
|
|
9
26
|
|
|
10
|
-
|
|
11
27
|
### [2.1.1] - 2023-08-22
|
|
12
28
|
|
|
13
29
|
- fix: check_result unexpected return #50
|
|
14
30
|
|
|
15
|
-
|
|
16
31
|
### [2.1.0] - 2022-11-29
|
|
17
32
|
|
|
18
33
|
- fix: in disconnect, call redis_unsub after skip check
|
|
19
34
|
- dep(redis): 4 -> 4.1
|
|
20
35
|
- dep(pi-redis): 2 -> 2.0.5
|
|
21
36
|
|
|
22
|
-
|
|
23
|
-
#### 2.0.4 - 2022-05-28
|
|
37
|
+
#### [2.0.4] - 2022-05-28
|
|
24
38
|
|
|
25
39
|
- use .release as submodule
|
|
26
40
|
|
|
27
|
-
|
|
28
|
-
#### 2.0.3 - 2022-05-28
|
|
41
|
+
#### [2.0.3] - 2022-05-28
|
|
29
42
|
|
|
30
43
|
- fix: depend directly on redis
|
|
31
44
|
- fix: update redis command names for v4 compatibility
|
|
32
45
|
- fix: update redis commands to be async
|
|
33
46
|
|
|
34
|
-
|
|
35
|
-
#### 2.0.1 - 2022-05-27
|
|
47
|
+
#### [2.0.1] - 2022-05-27
|
|
36
48
|
|
|
37
49
|
- chore(ci): depend on shared GHA workflows
|
|
38
50
|
|
|
39
|
-
|
|
40
|
-
#### 2.0.0 - 2022-03-29
|
|
51
|
+
#### [2.0.0] - 2022-03-29
|
|
41
52
|
|
|
42
53
|
- remove lots of plugin=this
|
|
43
54
|
- remove unnecessary braces and trailing ;
|
|
44
55
|
- some promises.
|
|
45
56
|
|
|
46
|
-
|
|
47
57
|
#### 1.0.14 - 2022-02-14
|
|
48
58
|
|
|
49
59
|
- try to unsubscribe in case connection is marked to skip during transaction
|
|
50
60
|
|
|
51
|
-
|
|
52
61
|
#### 1.0.13 - 2019-04-23
|
|
53
62
|
|
|
54
63
|
- add 'exists' pattern
|
|
55
64
|
|
|
56
|
-
|
|
57
65
|
#### 1.0.12 - 2019-03-08
|
|
58
66
|
|
|
59
67
|
- don't interfere with STARTLS and AUTH when karma is listed above those plugins in config/plugins
|
|
60
68
|
|
|
61
|
-
|
|
62
69
|
#### 1.0.11 - 2017-10-25
|
|
63
70
|
|
|
64
71
|
- private addresses and flagged connections exemption
|
|
65
72
|
|
|
66
|
-
|
|
67
73
|
#### 1.0.10 - 2017-08-30
|
|
68
74
|
|
|
69
75
|
- add TLS awards #19
|
|
70
76
|
|
|
71
|
-
|
|
72
77
|
#### 1.0.9 - 2017-07-29
|
|
73
78
|
|
|
74
79
|
- splash on some es6
|
|
75
80
|
- add AppVeyor CI testing
|
|
76
81
|
|
|
77
|
-
|
|
78
82
|
#### 1.0.8 - 2017-06-26
|
|
79
83
|
|
|
80
84
|
- revert #9, it breaks current Haraka deployments
|
|
81
85
|
|
|
82
|
-
|
|
83
86
|
#### 1.0.7 - 2017-06-16
|
|
84
87
|
|
|
85
88
|
- update for eslint 4 compat
|
|
86
89
|
- Add results_redis_publish=true for haraka-results changes #9
|
|
87
90
|
|
|
88
|
-
|
|
89
91
|
#### 1.0.6 - 2017-05-04
|
|
90
92
|
|
|
91
93
|
- emit error if redis plugin didn't create connection
|
|
92
94
|
|
|
93
|
-
|
|
94
95
|
#### 1.0.5 - 2017-02-06
|
|
95
96
|
|
|
96
97
|
- move merge_redis_ini into load_karma_ini, so it also gets applied
|
|
97
98
|
after a karma.ini change
|
|
98
99
|
- skip redis operations when no connection exists
|
|
99
100
|
|
|
100
|
-
|
|
101
101
|
#### 1.0.4 - 2017-01-29
|
|
102
102
|
|
|
103
103
|
- use the new haraka-plugin-redis
|
|
104
104
|
- remove exceptions for soft denials. This makes denial time simpler.
|
|
105
105
|
- rules updates
|
|
106
106
|
|
|
107
|
-
|
|
108
107
|
#### 1.0.3 - 2017-01-27
|
|
109
108
|
|
|
110
109
|
- add rule #280 for known-senders
|
|
111
110
|
- add support for 'length' type, with eq, gt, and lt operators
|
|
112
111
|
- use shared haraka-eslint
|
|
113
112
|
|
|
114
|
-
|
|
115
113
|
#### 1.0.2 - 2017-01-24
|
|
116
114
|
|
|
117
115
|
- use redis.merge_redis_ini()
|
|
118
|
-
|
|
119
|
-
[2.
|
|
120
|
-
[2.1
|
|
116
|
+
|
|
117
|
+
[2.0.0]: https://github.com/haraka/haraka-plugin-karma/releases/tag/2.0.0
|
|
118
|
+
[2.0.1]: https://github.com/haraka/haraka-plugin-karma/releases/tag/2.0.1
|
|
119
|
+
[2.0.2]: https://github.com/haraka/haraka-plugin-karma/releases/tag/2.0.2
|
|
120
|
+
[2.0.3]: https://github.com/haraka/haraka-plugin-karma/releases/tag/2.0.3
|
|
121
|
+
[2.0.4]: https://github.com/haraka/haraka-plugin-karma/releases/tag/2.0.4
|
|
122
|
+
[2.1.0]: https://github.com/haraka/haraka-plugin-karma/releases/tag/v2.1.0
|
|
123
|
+
[2.1.1]: https://github.com/haraka/haraka-plugin-karma/releases/tag/v2.1.1
|
|
124
|
+
[2.1.2]: https://github.com/haraka/haraka-plugin-karma/releases/tag/v2.1.2
|
|
125
|
+
[2.1.3]: https://github.com/haraka/haraka-plugin-karma/releases/tag/v2.1.3
|
|
126
|
+
[2.1.4]: https://github.com/haraka/haraka-plugin-karma/releases/tag/v2.1.4
|
package/README.md
CHANGED
|
@@ -18,7 +18,6 @@ One challenge for mail filtering is that filters (or plugins, in Haraka's case)
|
|
|
18
18
|
|
|
19
19
|
In order to score a plugins results, plugins must save their results to the [Result Store][results-url]. Karma will see that and apply the awards specified in `karma.ini`.
|
|
20
20
|
|
|
21
|
-
|
|
22
21
|
## How Karma Works
|
|
23
22
|
|
|
24
23
|
Karma takes a holistic view of **connections**. During the connection, karma collects these results and applies the [result_awards](#awards) defined in `karma.ini`. Once a connection/message exceeds the threshold.negative score (default: -8), karma rejects it at the next [deny]hook.
|
|
@@ -32,14 +31,12 @@ The scoring mechanism is not dissimilar to [SpamAssassin][sa-url], but Karma has
|
|
|
32
31
|
* Access to raw SMTP commands (data + formatting inspection)
|
|
33
32
|
* Can reject connections before DATA (save lots of bandwidth)
|
|
34
33
|
|
|
35
|
-
Karma is not a replacement for content filters. Karma focuses on the quality of the **connection**. Content filters (bayes\*) focus on the content of the **message**. Karma works best
|
|
36
|
-
|
|
34
|
+
Karma is not a replacement for content filters. Karma focuses on the quality of the **connection**. Content filters (bayes\*) focus on the content of the **message**. Karma works best _with_ content filters.
|
|
37
35
|
|
|
38
36
|
# CONFIG
|
|
39
37
|
|
|
40
38
|
See config/karma.ini for options and inline documentation.
|
|
41
39
|
|
|
42
|
-
|
|
43
40
|
## <a name="awards"></a>AWARDS
|
|
44
41
|
|
|
45
42
|
Karma allows the site administrator to control how much weight to assign to
|
|
@@ -50,7 +47,6 @@ Karma begins scoring the connection when the first packet arrives. The IP reputa
|
|
|
50
47
|
|
|
51
48
|
Karma performs checks early and often, maximizing the penality it can exact upon bad mailers.
|
|
52
49
|
|
|
53
|
-
|
|
54
50
|
## <a name="penalties"></a>Penalties
|
|
55
51
|
|
|
56
52
|
### Deny / Reject
|
|
@@ -61,7 +57,7 @@ When connections become worse than [thresholds]negative, they are denied during
|
|
|
61
57
|
|
|
62
58
|
Karma history is computed as the number of good - bad connections.
|
|
63
59
|
|
|
64
|
-
When each connection ends,
|
|
60
|
+
When each connection ends, _karma_ records the result. When a sufficient history has been built for an IP or ASN, future connections from that address(es) will get a positive or negative karma award.
|
|
65
61
|
|
|
66
62
|
The reward is purposefully small, to permit good senders in bad neighborhoods to still send.
|
|
67
63
|
|
|
@@ -98,21 +94,20 @@ When using `karma`, do not use Haraka's `tarpit` plugin.
|
|
|
98
94
|
|
|
99
95
|
Connection data that karma considers:
|
|
100
96
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
97
|
+
- [IP Reputation](#IP_Reputation)
|
|
98
|
+
- [ASN reputation](#Neighbor_Reputation)
|
|
99
|
+
- DENY events by other plugins
|
|
100
|
+
- envelope sender from a spammy TLD
|
|
101
|
+
- [malformed envelope addresses](#malformed_env)
|
|
102
|
+
- [unrecognized SMTP commands](#unrecognized)
|
|
103
|
+
- matching _env from_ and _env to_ name (rare in ham, frequent in spam)
|
|
108
104
|
|
|
109
105
|
The data from these tests are helpful but the real power of karma is [scoring
|
|
110
106
|
the results](#awards) of other plugins. See karma.ini for a rich set of examples.
|
|
111
107
|
|
|
112
|
-
|
|
113
108
|
### <a name="IP_Reputation"></a>IP Reputation
|
|
114
109
|
|
|
115
|
-
Karma records the number of good, bad, and total connections.
|
|
110
|
+
Karma records the number of good, bad, and total connections. The results
|
|
116
111
|
are accessible to other plugins as well.
|
|
117
112
|
|
|
118
113
|
var karma = connection.results.get('karma');
|
|
@@ -142,14 +137,14 @@ connections from each ASN.
|
|
|
142
137
|
|
|
143
138
|
ASNs with less than 5 karma points in either direction are ignored.
|
|
144
139
|
|
|
145
|
-
####
|
|
140
|
+
#### report_as
|
|
146
141
|
|
|
147
142
|
Store the ASN results as another plugin. Example: I set `report_as=asn`, so that karma history for an ASN is reported with the ASN plugin data. A practical consequence of changing report_as is that the award location in karma.ini would need to change from:
|
|
148
143
|
|
|
149
144
|
NNN karma | pass | equals | asn_all_good | 2
|
|
150
145
|
NNN karma | fail | equals | asn_all_bad | -3
|
|
151
146
|
|
|
152
|
-
to:
|
|
147
|
+
to:
|
|
153
148
|
|
|
154
149
|
NNN asn | pass | equals | asn_all_good | 2
|
|
155
150
|
NNN asn | fail | equals | asn_all_bad | -3
|
|
@@ -158,7 +153,6 @@ to:
|
|
|
158
153
|
|
|
159
154
|
Very old versions of Outlook Express and some malware senders don't bother complying with the RFC (5321, 2821, 821) address format. Karma checks the envelope from and to addresses for a common RFC ignorant pattern that is highly correlated with malware.
|
|
160
155
|
|
|
161
|
-
|
|
162
156
|
### <a name="unrecognized"></a>Unrecognized SMTP verbs/commands
|
|
163
157
|
|
|
164
158
|
Certain bruteforce password hacking tools have a pre-programmed SMTP path
|
|
@@ -190,9 +184,7 @@ Karma plugin is disabled for all private IP addresses according to RFC1918. Opti
|
|
|
190
184
|
|
|
191
185
|
Karma is most effective at filtering mail delivered by bots and rogue servers.
|
|
192
186
|
Spam delivered by servers with good reputations normally pass karma's checks.
|
|
193
|
-
Expect to use karma
|
|
194
|
-
|
|
195
|
-
|
|
187
|
+
Expect to use karma _with_ content filters.
|
|
196
188
|
|
|
197
189
|
[p0f-url]: /manual/plugins/connect.p0f.html
|
|
198
190
|
[geoip-url]: https://github.com/haraka/haraka-plugin-geoip
|