Skip to content

Commit

Permalink
prettier, eslint config
Browse files Browse the repository at this point in the history
  • Loading branch information
msimerson committed Apr 6, 2024
1 parent 70ff10e commit 372b2a1
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 50 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'
10 changes: 1 addition & 9 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1 @@

# plugins: [ haraka ]

extends: @haraka

rules:
indent: [2, 2, { SwitchCase: 1 } ]
semi: [ error, never ]
semi-style: [ error, last ]
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
7 changes: 3 additions & 4 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 ]
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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).

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

-
-

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

Expand Down
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"redis": "^4.6.11"
},
"devDependencies": {
"@haraka/eslint-config": "*",
"@haraka/eslint-config": "^1.1.2",
"haraka-test-fixtures": "*"
}
}

0 comments on commit 372b2a1

Please sign in to comment.