Skip to content

Commit

Permalink
Release 2.1.4 (#57)
Browse files Browse the repository at this point in the history
- eslint: reduce config to depending on @haraka
- package.json: added scripts
- doc(CHANGELOG): ordered urls
- prettier, eslint config
- chore: populate package.json [files]
  • Loading branch information
msimerson authored Apr 7, 2024
1 parent 19e2fff commit 2aa33ed
Show file tree
Hide file tree
Showing 14 changed files with 521 additions and 412 deletions.
8 changes: 4 additions & 4 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
engines:
eslint:
enabled: true
channel: "eslint-8"
channel: 'eslint-8'
config:
config: ".eslintrc.yaml"
config: '.eslintrc.yaml'

checks:
return-statements:
Expand All @@ -21,5 +21,5 @@ checks:
threshold: 900

ratings:
paths:
- "**.js"
paths:
- '**.js'
21 changes: 2 additions & 19 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,6 @@ env:
node: true
es6: true
mocha: true
es2020: true
es2022: true

plugins: [ haraka ]

extends: [ eslint:recommended, plugin:haraka/recommended ]

root: true

rules:
indent: [2, 2, { SwitchCase: 1 } ]
semi: [ error, never ]
semi-style: [ error, last ]

globals:
OK: true
CONT: true
DENY: true
DENYSOFT: true
DENYDISCONNECT: true
DENYSOFTDISCONNECT: true
extends: '@haraka'
3 changes: 0 additions & 3 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**System Info:**
Expand All @@ -21,9 +20,7 @@ A clear and concise description of what you expected to happen.

**Observed behavior**


**Steps To Reproduce**


**Additional context**
Add any other context about the problem here.
3 changes: 0 additions & 3 deletions .github/ISSUE_TEMPLATE/custom.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,4 @@ about: Issues that aren't bug reports or feature requests
title: ''
labels: ''
assignees: ''

---


1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
name: CI

on: [ push, pull_request ]
on: [push, pull_request]

env:
CI: true

jobs:

lint:
uses: haraka/.github/.github/workflows/lint.yml@master

ubuntu:
needs: [ lint ]
needs: [lint]
uses: haraka/.github/.github/workflows/ubuntu.yml@master

windows:
needs: [ lint ]
uses: haraka/.github/.github/workflows/windows.yml@master
needs: [lint]
uses: haraka/.github/.github/workflows/windows.yml@master
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: CodeQL

on:
push:
branches: [ master ]
branches: [master]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
branches: [master]
schedule:
- cron: '18 7 * * 4'

Expand Down
2 changes: 2 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
singleQuote: true
semi: false
2 changes: 1 addition & 1 deletion .release
58 changes: 29 additions & 29 deletions Changes.md → CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,126 +1,126 @@
# Changelog

#### N.N.N - YYYY-MM-DD
The format is based on [Keep a Changelog](https://keepachangelog.com/).

### Unreleased

### [2.1.4] - 2024-04-06

- eslint: reduce config to depending on @haraka
- package.json: added scripts
- doc(CHANGELOG): ordered urls
- doc(Changes) -> CHANGELOG
- prettier & eslint configs
- chore: populate package.json [files]

### [2.1.3] - 2023-12-12

- ci: use shared configs
- style(es6): replace for..i with for...of
- deps(*): bump versions to latest

- deps(\*): bump versions to latest

### [2.1.2] - 2023-12-11

- config: update several plugin names
- style(es6): refer to plugin as 'this'


### [2.1.1] - 2023-08-22

- fix: check_result unexpected return #50


### [2.1.0] - 2022-11-29

- fix: in disconnect, call redis_unsub after skip check
- dep(redis): 4 -> 4.1
- dep(pi-redis): 2 -> 2.0.5


#### 2.0.4 - 2022-05-28
#### [2.0.4] - 2022-05-28

- use .release as submodule


#### 2.0.3 - 2022-05-28
#### [2.0.3] - 2022-05-28

- fix: depend directly on redis
- fix: update redis command names for v4 compatibility
- fix: update redis commands to be async


#### 2.0.1 - 2022-05-27
#### [2.0.1] - 2022-05-27

- chore(ci): depend on shared GHA workflows


#### 2.0.0 - 2022-03-29
#### [2.0.0] - 2022-03-29

- remove lots of plugin=this
- remove unnecessary braces and trailing ;
- some promises.


#### 1.0.14 - 2022-02-14

- try to unsubscribe in case connection is marked to skip during transaction


#### 1.0.13 - 2019-04-23

- add 'exists' pattern


#### 1.0.12 - 2019-03-08

- don't interfere with STARTLS and AUTH when karma is listed above those plugins in config/plugins


#### 1.0.11 - 2017-10-25

- private addresses and flagged connections exemption


#### 1.0.10 - 2017-08-30

- add TLS awards #19


#### 1.0.9 - 2017-07-29

- splash on some es6
- add AppVeyor CI testing


#### 1.0.8 - 2017-06-26

- revert #9, it breaks current Haraka deployments


#### 1.0.7 - 2017-06-16

- update for eslint 4 compat
- Add results_redis_publish=true for haraka-results changes #9


#### 1.0.6 - 2017-05-04

- emit error if redis plugin didn't create connection


#### 1.0.5 - 2017-02-06

- move merge_redis_ini into load_karma_ini, so it also gets applied
after a karma.ini change
- skip redis operations when no connection exists


#### 1.0.4 - 2017-01-29

- use the new haraka-plugin-redis
- remove exceptions for soft denials. This makes denial time simpler.
- rules updates


#### 1.0.3 - 2017-01-27

- add rule #280 for known-senders
- add support for 'length' type, with eq, gt, and lt operators
- use shared haraka-eslint


#### 1.0.2 - 2017-01-24

- use redis.merge_redis_ini()
[2.1.0]: https://github.com/haraka/haraka-plugin-karma/releases/tag/2.1.0
[2.1.1]: https://github.com/haraka/haraka-plugin-karma/releases/tag/2.1.1
[2.1.2]: https://github.com/haraka/haraka-plugin-karma/releases/tag/2.1.2

[2.0.0]: https://github.com/haraka/haraka-plugin-karma/releases/tag/2.0.0
[2.0.1]: https://github.com/haraka/haraka-plugin-karma/releases/tag/2.0.1
[2.0.2]: https://github.com/haraka/haraka-plugin-karma/releases/tag/2.0.2
[2.0.3]: https://github.com/haraka/haraka-plugin-karma/releases/tag/2.0.3
[2.0.4]: https://github.com/haraka/haraka-plugin-karma/releases/tag/2.0.4
[2.1.0]: https://github.com/haraka/haraka-plugin-karma/releases/tag/v2.1.0
[2.1.1]: https://github.com/haraka/haraka-plugin-karma/releases/tag/v2.1.1
[2.1.2]: https://github.com/haraka/haraka-plugin-karma/releases/tag/v2.1.2
[2.1.3]: https://github.com/haraka/haraka-plugin-karma/releases/tag/v2.1.3
[2.1.4]: https://github.com/haraka/haraka-plugin-karma/releases/tag/v2.1.4
34 changes: 13 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ One challenge for mail filtering is that filters (or plugins, in Haraka's case)

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`.


## How Karma Works

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.
Expand All @@ -32,14 +31,12 @@ The scoring mechanism is not dissimilar to [SpamAssassin][sa-url], but Karma has
* Access to raw SMTP commands (data + formatting inspection)
* Can reject connections before DATA (save lots of bandwidth)

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.

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.

# CONFIG

See config/karma.ini for options and inline documentation.


## <a name="awards"></a>AWARDS

Karma allows the site administrator to control how much weight to assign to
Expand All @@ -50,7 +47,6 @@ Karma begins scoring the connection when the first packet arrives. The IP reputa

Karma performs checks early and often, maximizing the penality it can exact upon bad mailers.


## <a name="penalties"></a>Penalties

### Deny / Reject
Expand All @@ -61,7 +57,7 @@ When connections become worse than [thresholds]negative, they are denied during

Karma history is computed as the number of good - bad connections.

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.
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.

The reward is purposefully small, to permit good senders in bad neighborhoods to still send.

Expand Down Expand Up @@ -98,21 +94,20 @@ When using `karma`, do not use Haraka's `tarpit` plugin.

Connection data that karma considers:

* [IP Reputation](#IP_Reputation)
* [ASN reputation](#Neighbor_Reputation)
* DENY events by other plugins
* envelope sender from a spammy TLD
* [malformed envelope addresses](#malformed_env)
* [unrecognized SMTP commands](#unrecognized)
* matching *env from* and *env to* name (rare in ham, frequent in spam)
- [IP Reputation](#IP_Reputation)
- [ASN reputation](#Neighbor_Reputation)
- DENY events by other plugins
- envelope sender from a spammy TLD
- [malformed envelope addresses](#malformed_env)
- [unrecognized SMTP commands](#unrecognized)
- matching _env from_ and _env to_ name (rare in ham, frequent in spam)

The data from these tests are helpful but the real power of karma is [scoring
the results](#awards) of other plugins. See karma.ini for a rich set of examples.


### <a name="IP_Reputation"></a>IP Reputation

Karma records the number of good, bad, and total connections. The results
Karma records the number of good, bad, and total connections. The results
are accessible to other plugins as well.

var karma = connection.results.get('karma');
Expand Down Expand Up @@ -142,14 +137,14 @@ connections from each ASN.

ASNs with less than 5 karma points in either direction are ignored.

#### report\_as
#### report_as

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:

NNN karma | pass | equals | asn_all_good | 2
NNN karma | fail | equals | asn_all_bad | -3

to:
to:

NNN asn | pass | equals | asn_all_good | 2
NNN asn | fail | equals | asn_all_bad | -3
Expand All @@ -158,7 +153,6 @@ to:

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.


### <a name="unrecognized"></a>Unrecognized SMTP verbs/commands

Certain bruteforce password hacking tools have a pre-programmed SMTP path
Expand Down Expand Up @@ -190,9 +184,7 @@ Karma plugin is disabled for all private IP addresses according to RFC1918. Opti

Karma is most effective at filtering mail delivered by bots and rogue servers.
Spam delivered by servers with good reputations normally pass karma's checks.
Expect to use karma *with* content filters.


Expect to use karma _with_ content filters.

[p0f-url]: /manual/plugins/connect.p0f.html
[geoip-url]: https://github.com/haraka/haraka-plugin-geoip
Expand Down
Loading

0 comments on commit 2aa33ed

Please sign in to comment.