Skip to content

Commit eef9c4d

Browse files
authored
Release v1.2.0 (#7)
- dnswl: sending OK on helo & mail hooks disabled by default - check_zones: check all zones concurrently (test speedup)
1 parent eb1f94d commit eef9c4d

File tree

7 files changed

+46
-11
lines changed

7 files changed

+46
-11
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
44

55
### Unreleased
66

7+
### [1.2.0] - 2024-04-13
8+
9+
- dnswl: sending OK on helo & mail hooks disabled by default
10+
- check_zones: check all zones concurrently (test speedup)
11+
712
### [1.1.0] - 2024-04-10
813

914
- feat: imported backscatterer from haraka/Haraka
@@ -29,3 +34,4 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
2934
[1.0.2]: https://github.com/haraka/haraka-plugin-dns-list/releases/tag/v1.0.2
3035
[1.0.3]: https://github.com/haraka/haraka-plugin-dns-list/releases/tag/v1.0.3
3136
[1.1.0]: https://github.com/haraka/haraka-plugin-dns-list/releases/tag/v1.1.0
37+
[1.2.0]: https://github.com/haraka/haraka-plugin-dns-list/releases/tag/v1.2.0

CONTRIBUTORS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This handcrafted artisinal software is brought to you by:
44

5-
| <img height="80" src="https://avatars.githubusercontent.com/u/261635?v=4"><br><a href="https://github.com/msimerson">msimerson</a> (<a href="https://github.com/haraka/haraka-plugin-dns-list/commits?author=msimerson">6</a>) | <img height="80" src="https://avatars.githubusercontent.com/u/203240?v=4"><br><a href="https://github.com/lnedry">lnedry</a> (<a href="https://github.com/haraka/haraka-plugin-dns-list/commits?author=lnedry">1</a>) |
5+
| <img height="80" src="https://avatars.githubusercontent.com/u/261635?v=4"><br><a href="https://github.com/msimerson">msimerson</a> (<a href="https://github.com/haraka/haraka-plugin-dns-list/commits?author=msimerson">7</a>) | <img height="80" src="https://avatars.githubusercontent.com/u/203240?v=4"><br><a href="https://github.com/lnedry">lnedry</a> (<a href="https://github.com/haraka/haraka-plugin-dns-list/commits?author=lnedry">1</a>) |
66
| :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
77

88
<sub>this file is maintained by [.release](https://github.com/msimerson/.release)</sub>

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,15 @@ The exact name of the DNS zone (as specified above in main.zones) may contain se
102102
- reject=true (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](https://github.com/haraka/haraka-plugin-karma) that employ a scoring engine to make choices about message delivery.
103103
- ipv6=true | false
104104

105+
#### dnswl
106+
107+
```ini
108+
ok_helo=false
109+
ok_mail=false
110+
```
111+
112+
if DNSBL returns OK on the mail hook, it prevents any subsequent mail hooks in other plugins from running. This might include [SPF](haraka-plugin-spf), [known senders](https://github.com/haraka/haraka-plugin-known-senders), [karma](https://github.com/haraka/haraka-plugin-karma), recipient plugins, and any other plugins that want to do transaction initialization on `hook_mail`. It can be dangerous.
113+
105114
[ci-img]: https://github.com/haraka/haraka-plugin-dns-list/actions/workflows/ci.yml/badge.svg
106115
[ci-url]: https://github.com/haraka/haraka-plugin-dns-list/actions/workflows/ci.yml
107116
[clim-img]: https://codeclimate.com/github/haraka/haraka-plugin-dns-list/badges/gpa.svg

config/dns-list.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ loopback_is_rejected=true
9494
[list.dnswl.org]
9595
; https://www.dnswl.org/?page_id=15
9696
type=allow
97+
; see docs
98+
ok_helo=false
99+
ok_mail=false
97100

98101

99102
; 127.0.{2-20}.{0-3}

index.js

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,18 @@ exports.register = function () {
1616

1717
this.register_hook('connect', 'onConnect')
1818

19-
// IMPORTANT: don't run this on hook_rcpt otherwise we're an open relay...
20-
for (const hook of ['ehlo', 'helo', 'mail']) {
21-
this.register_hook(hook, 'check_dnswl')
19+
if (this.cfg['ips.backscatterer.org'].enable) {
20+
this.register_hook('mail', 'check_backscatterer')
21+
}
22+
23+
// IMPORTANT: don't run this on hook_rcpt else we're an open relay...
24+
if (this.cfg['list.dnswl.org'].ok_helo) {
25+
this.register_hook('helo', 'check_dnswl')
26+
this.register_hook('ehlo', 'check_dnswl')
27+
}
28+
if (this.cfg['list.dnswl.org'].ok_mail) {
29+
this.register_hook('mail', 'check_dnswl')
2230
}
23-
this.register_hook('mail', 'check_backscatterer')
2431
}
2532

2633
exports.load_config = function () {
@@ -33,6 +40,8 @@ exports.load_config = function () {
3340
'*.ipv6',
3441
'*.loopback_is_rejected',
3542
'-ips.backscatterer.org.enable',
43+
'-list.dnswl.org.ok_helo',
44+
'-list.dnswl.org.ok_mail',
3645
],
3746
},
3847
() => {
@@ -375,12 +384,15 @@ exports.check_zone = async function (zone) {
375384
exports.check_zones = async function (interval) {
376385
if (interval) interval = parseInt(interval)
377386

387+
const promises = []
378388
for (const zone of this.cfg.main.zones) {
379-
try {
380-
await this.check_zone(zone)
381-
} catch (err) {
382-
console.error(`zone ${zone} err: ${err}`)
383-
}
389+
promises.push(this.check_zone(zone))
390+
}
391+
392+
try {
393+
await Promise.all(promises)
394+
} catch (err) {
395+
console.error(err)
384396
}
385397

386398
// Set a timer to re-test

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "haraka-plugin-dns-list",
3-
"version": "1.1.0",
3+
"version": "1.2.0",
44
"description": "Haraka plugin for DNS lists (DNSBL, DNSWL)",
55
"main": "index.js",
66
"files": [

test/dns-list.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,26 +40,31 @@ describe('dns-list', function () {
4040

4141
describe('lookup', function () {
4242
it('Spamcop, test IPv4', async function () {
43+
this.timeout=4000
4344
const a = await this.plugin.lookup('127.0.0.2', 'bl.spamcop.net')
4445
assert.deepStrictEqual(['127.0.0.2'], a)
4546
})
4647

4748
it('Spamcop, unlisted IPv6', async function () {
49+
this.timeout=4000
4850
const r = await this.plugin.lookup('::1', 'bl.spamcop.net')
4951
assert.deepStrictEqual(undefined, r)
5052
})
5153

5254
it('b.barracudacentral.org, unlisted IPv6', async function () {
55+
this.timeout=4000
5356
const r = await this.plugin.lookup('::1', 'b.barracudacentral.org')
5457
assert.deepStrictEqual(undefined, r)
5558
})
5659

5760
it('Spamcop, unlisted IPv4', async function () {
61+
this.timeout=4000
5862
const a = await this.plugin.lookup('127.0.0.1', 'bl.spamcop.net')
5963
assert.deepStrictEqual(undefined, a)
6064
})
6165

6266
it('CBL', async function () {
67+
this.timeout=4000
6368
const a = await this.plugin.lookup('127.0.0.2', 'xbl.spamhaus.org')
6469
assert.deepStrictEqual(a, ['127.0.0.4'])
6570
})

0 commit comments

Comments
 (0)