Skip to content

Commit

Permalink
- initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
msimerson committed Dec 27, 2023
0 parents commit 0062b26
Show file tree
Hide file tree
Showing 19 changed files with 1,145 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
engines:
eslint:
enabled: true
channel: "eslint-8"
config:
config: ".eslintrc.yaml"

ratings:
paths:
- "**.js"

checks:
return-statements:
enabled: false
file-lines:
config:
threshold: 400
method-lines:
config:
threshold: 30
method-complexity:
config:
threshold: 6
25 changes: 25 additions & 0 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
env:
node: true
es6: true
mocha: true
es2020: true

plugins:
- haraka

extends:
- eslint:recommended
- plugin:haraka/recommended

rules:
indent: [2, 2, {"SwitchCase": 1}]

root: true

globals:
OK: true
CONT: true
DENY: true
DENYSOFT: true
DENYDISCONNECT: true
DENYSOFTDISCONNECT: true
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
### system info

Please report your OS, Node version, and Haraka version by running this shell script on your Haraka server and replacing this section with the output.

echo "Haraka | $(haraka -v)"; echo " --- | :--- "; echo "Node | $(node -v)"; echo "OS | $(uname -a)"; echo "openssl | $(openssl version)"

### Expected behavior

### Observed behavior

### Steps to reproduce
12 changes: 12 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Changes proposed in this pull request:

-
-

Fixes #

Checklist:
- [ ] docs updated
- [ ] tests updated
- [ ] Changes.md updated
- [ ] package.json.version bumped
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "monthly"
allow:
- dependency-type: production
22 changes: 22 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: CI

on: [ push, pull_request ]

env:
CI: true

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

# coverage:
# uses: haraka/.github/.github/workflows/coverage.yml@master
# secrets: inherit

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

windows:
needs: [ lint ]
uses: haraka/.github/.github/workflows/windows.yml@master
13 changes: 13 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: "CodeQL"

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
schedule:
- cron: '18 7 * * 4'

jobs:
codeql:
uses: haraka/.github/.github/workflows/codeql.yml@master
17 changes: 17 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: publish

on:
push:
branches:
- master
paths:
- package.json

env:
CI: true

jobs:
publish:
uses: haraka/.github/.github/workflows/publish.yml@master
secrets: inherit

45 changes: 45 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules
jspm_packages

# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history

package-lock.json
bower_components
# Optional npm cache directory
.npmrc
.idea
.DS_Store
haraka-update.sh
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule ".release"]
path = .release
url = git@github.com:msimerson/.release.git
59 changes: 59 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules
jspm_packages

# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history

package-lock.json
bower_components
# Optional npm cache directory
.npmrc

.idea
.DS_Store
haraka-update.sh

.github
.release
.codeclimate.yml
.editorconfig
.gitignore
.gitmodules
.lgtm.yml
appveyor.yml
codecov.yml
.travis.yml
.eslintrc.yaml
.eslintrc.json
1 change: 1 addition & 0 deletions .release
Submodule .release added at 0890e9
3 changes: 3 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 1.0.0 - 2023-12-15

- Initial release
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 Haraka

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
113 changes: 113 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
[![CI Test Status][ci-img]][ci-url]
[![Code Climate][clim-img]][clim-url]

[![NPM][npm-img]][npm-url]

# haraka-plugin-dns-lists

## dns lists

Looks up the IP address of the remote host in a IP list(s). There are several types of DNS based lists:

### block

Block lists (aka: DNSBL) are designed to be used for blocking mail from any host listed in them. Block lists are the most common DNS list type and lists without a type specifier are considered block lists. The default action for block lists is the reject the connection. This can be changed by setting `reject=false` in the zone's settings block.


### allow

When the remote IP is found in an allow list, this plugin returns OK for the ehlo, helo, and mail hooks.

IMPORTANT! The order of plugins in config/plugins is important when this feature is used. It should be listed *before* any plugins that you wish to skip, but after any plugins that accept recipients.


## INSTALL

```sh
cd /path/to/local/haraka
npm install haraka-plugin-dns-list
echo "dns-list" >> config/plugins
service haraka restart
```

### Configuration

If the default configuration is insufficient, copy the config file from the distribution into your haraka config dir and modify it:

```sh
cp node_modules/haraka-plugin-dns-list/config/dns-list.ini config/dns-list.ini
$EDITOR config/dns-list.ini
```

dns-lists.ini - INI format with options described below:

#### [main] periodic_checks=30

Check every DNS zone every `N` minutes. When the value is less than 5, checks will only be run at start-up.

The checks confirm that lists are responding correctly. When errors are detected, the zone is disabled and will be checked at the next interval. When a zone resumes working correctly it will be enabled.


#### [main] zones

An array or comma separated list of zones to query.


#### [main] search: (default: all)

- first: consider first DNSBL response conclusive. End processing.
- all: process all DNSBL results


#### [stats] enable=true

To use this feature you must have installed and configured the 'redis' plugin.

When enabled, this will record several list statistics to redis.

It will track the total number of queries (TOTAL) and the average response time (AVG\_RT) and the return type (e.g. LISTED or ERROR) to a redis hash where the key is 'dns-list-stat:zone' and the hash field is the response type.

It will also track the positive response overlap between the lists in another redis hash where the key is 'dns-list-overlap:zone' and the hash field is the other list names.

Example:
<pre><code>redis 127.0.0.1:6379> hgetall dns-list-stat:zen.spamhaus.org
1) "TOTAL"
2) "23"
3) "ENOTFOUND"
4) "11"
5) "LISTED"
6) "12"
7) "AVG_RT"
8) "45.5"
redis 127.0.0.1:6379> hgetall dns-list-overlap:zen.spamhaus.org
1) "b.barracudacentral.org"
2) "1"
3) "bl.spamcop.net"
4) "1"
5) "TOTAL"
6) "1"
</code></pre>

#### [stats] redis\_host

In the form of `host:port` this option allows you to specify a different host on which redis runs.


### Per-Zone DNS list settings

The exact name of the DNS zone (as specified above in main.zones) may contain settings about that DNS list.

* type=[ block, allow, karma ]
* reject (default: true)
Reject connections from IPs on block lists. Setting this to false makes dnsbl informational. reject=false is best used in conjunction with plugins like [karma](/manual/plugins/karma.html) that employ a scoring engine to make choices about message delivery.
* ipv6=true | false


<!-- leave these buried at the bottom of the document -->
[ci-img]: https://github.com/haraka/haraka-plugin-dns-list/actions/workflows/ci.yml/badge.svg
[ci-url]: https://github.com/haraka/haraka-plugin-dns-list/actions/workflows/ci.yml
[clim-img]: https://codeclimate.com/github/haraka/haraka-plugin-dns-list/badges/gpa.svg
[clim-url]: https://codeclimate.com/github/haraka/haraka-plugin-dns-list
[npm-img]: https://nodei.co/npm/haraka-plugin-dns-list.png
[npm-url]: https://www.npmjs.com/package/haraka-plugin-dns-list

Loading

0 comments on commit 0062b26

Please sign in to comment.