haraka-plugin-karma 2.1.7 → 2.1.8

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/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
4
4
 
5
5
  ### Unreleased
6
6
 
7
+ ### [2.1.8] - 2025-10-27
8
+
9
+ - fix: use optional chaining in should_we_skip, fixes #63
10
+ - reduce ASN details saved to results store
11
+ - config: update plugin names
12
+
7
13
  ### [2.1.7] - 2025-01-31
8
14
 
9
15
  - replace utils.in_array with [].includes
@@ -141,3 +147,5 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
141
147
  [2.1.4]: https://github.com/haraka/haraka-plugin-karma/releases/tag/v2.1.4
142
148
  [2.1.5]: https://github.com/haraka/haraka-plugin-karma/releases/tag/v2.1.5
143
149
  [2.1.6]: https://github.com/haraka/haraka-plugin-karma/releases/tag/v2.1.6
150
+ [2.1.7]: https://github.com/haraka/haraka-plugin-karma/releases/tag/v2.1.7
151
+ [2.1.8]: https://github.com/haraka/haraka-plugin-karma/releases/tag/v2.1.8
package/config/karma.ini CHANGED
@@ -57,7 +57,7 @@ hooks=unrecognized_command,data,data_post,queue,queue_outbound
57
57
  ; karma captures and scores deny requests from other plugins, permitting finer
58
58
  ; control over connection handling. For plugins that should be able to reject
59
59
  ; the connection, add their name to the plugin list:
60
- plugins=send_email, tls, access, helo.checks, data.headers, rspamd, spamassassin, clamd, attachment, limit
60
+ plugins=send_email, tls, access, helo.checks, headers, rspamd, spamassassin, clamd, attachment, limit
61
61
 
62
62
  ; hooks whose DENY rejections should be not be captured.
63
63
  hooks=rcpt, queue, queue_outbound
@@ -227,16 +227,16 @@ early_talker = -3
227
227
  104 = access | pass | equals | rcpt_to.access.whitelist | 8
228
228
 
229
229
  ; Scores for specific DNSBLs
230
- 111 = dnsbl | fail | equals | b.barracudacentral.org | -7 | DNS Blacklist | Disinfect your host/network
231
- 112 = dnsbl | fail | equals | truncate.gbudb.net | -5 | DNS Blacklist | Disinfect your host/network
232
- 113 = dnsbl | fail | equals | psbl.surriel.com | -6 | DNS Blacklist | Disinfect your host/network
233
- 114 = dnsbl | fail | equals | bl.spamcop.net | -3 | DNS Blacklist | Disinfect your host/network
234
- 115 = dnsbl | fail | equals | dnsbl-1.uceprotect.net | -3 | DNS Blacklist | Disinfect your host/network
235
- 116 = dnsbl | fail | equals | zen.spamhaus.org | -5 | DNS Blacklist | Disinfect your host/network
236
- 117 = dnsbl | fail | equals | xbl.spamhaus.org | -6 | DNS Blacklist | Disinfect your host/network
237
- 118 = dnsbl | fail | equals | cbl.abuseat.org | -5 | DNS Blacklist | Disinfect your host/network
238
- 119 = dnsbl | fail | equals | dnsbl.justspam.org | -1 | DNS Blacklist | Disinfect your host/network
239
- 120 = dnsbl | fail | equals | dnsbl.sorbs.net | -2 | DNS Blacklist | Clean up DNSBL listing
230
+ 111 = dns-list | fail | equals | b.barracudacentral.org | -7 | DNS Blacklist | Disinfect your host/network
231
+ 112 = dns-list | fail | equals | truncate.gbudb.net | -5 | DNS Blacklist | Disinfect your host/network
232
+ 113 = dns-list | fail | equals | psbl.surriel.com | -6 | DNS Blacklist | Disinfect your host/network
233
+ 114 = dns-list | fail | equals | bl.spamcop.net | -3 | DNS Blacklist | Disinfect your host/network
234
+ 115 = dns-list | fail | equals | dnsbl-1.uceprotect.net | -3 | DNS Blacklist | Disinfect your host/network
235
+ 116 = dns-list | fail | equals | zen.spamhaus.org | -5 | DNS Blacklist | Disinfect your host/network
236
+ 117 = dns-list | fail | equals | xbl.spamhaus.org | -6 | DNS Blacklist | Disinfect your host/network
237
+ 118 = dns-list | fail | equals | cbl.abuseat.org | -5 | DNS Blacklist | Disinfect your host/network
238
+ 119 = dns-list | fail | equals | dnsbl.justspam.org | -1 | DNS Blacklist | Disinfect your host/network
239
+ 120 = dns-list | fail | equals | dnsbl.sorbs.net | -2 | DNS Blacklist | Clean up DNSBL listing
240
240
 
241
241
  130 = helo.checks | fail | match | valid_hostname | -1 | HELO host invalid | Use valid HELO hostname
242
242
  131 = helo.checks | pass | match | forward_dns | 1 | HELO host has forward DNS
package/index.js CHANGED
@@ -394,7 +394,7 @@ exports.tarpit_delay_msa = function (connection, delay, k) {
394
394
  // Reduce delay for good ASN history
395
395
  let asn = connection.results.get('asn')
396
396
  if (!asn) asn = connection.results.get('geoip')
397
- if (asn && asn.asn && k.neighbors > 0) {
397
+ if (asn && asn.asn && asn.asn_score > 0) {
398
398
  connection.logdebug(this, `${trg} neighbors: ${delay}`)
399
399
  delay = delay - 2
400
400
  }
@@ -409,8 +409,8 @@ exports.tarpit_delay_msa = function (connection, delay, k) {
409
409
  }
410
410
 
411
411
  exports.should_we_skip = function (connection) {
412
- if (connection.remote.is_private) return true
413
- if (connection.notes.disable_karma) return true
412
+ if (connection.remote?.is_private) return true
413
+ if (connection.notes?.disable_karma) return true
414
414
  return false
415
415
  }
416
416
 
@@ -980,7 +980,6 @@ exports.check_asn = function (connection, asnkey) {
980
980
  if (!this.db) return
981
981
 
982
982
  const report_as = { name: this.name }
983
-
984
983
  if (this.cfg.asn.report_as) report_as.name = this.cfg.asn.report_as
985
984
 
986
985
  this.db
@@ -994,30 +993,24 @@ exports.check_asn = function (connection, asnkey) {
994
993
 
995
994
  this.db.hIncrBy(asnkey, 'connections', 1)
996
995
  const asn_score = parseInt(res.good || 0) - (res.bad || 0)
997
- const asn_results = {
998
- asn_score,
999
- asn_connections: res.connections,
1000
- asn_good: res.good,
1001
- asn_bad: res.bad,
1002
- emit: true,
1003
- }
1004
996
 
1005
997
  if (asn_score) {
998
+ connection.results.add(report_as, { asn_score: asn_score })
1006
999
  if (asn_score < -5) {
1007
- asn_results.fail = 'asn:history'
1000
+ connection.results.add(report_as, { fail: 'asn:history' })
1008
1001
  } else if (asn_score > 5) {
1009
- asn_results.pass = 'asn:history'
1002
+ connection.results.add(report_as, { pass: 'asn:history' })
1010
1003
  }
1011
1004
  }
1012
1005
 
1013
1006
  if (parseInt(res.bad) > 5 && parseInt(res.good) === 0) {
1014
- asn_results.fail = 'asn:all_bad'
1007
+ connection.results.add(report_as, { fail: 'asn:all_bad' })
1015
1008
  }
1016
1009
  if (parseInt(res.good) > 5 && parseInt(res.bad) === 0) {
1017
- asn_results.pass = 'asn:all_good'
1010
+ connection.results.add(report_as, { pass: 'asn:all_good' })
1018
1011
  }
1019
1012
 
1020
- connection.results.add(report_as, asn_results)
1013
+ connection.results.add(report_as, { emit: true })
1021
1014
  })
1022
1015
  .catch((err) => {
1023
1016
  connection.results.add(this, { err })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "haraka-plugin-karma",
3
- "version": "2.1.7",
3
+ "version": "2.1.8",
4
4
  "description": "A heuristics scoring and reputation engine for SMTP connections",
5
5
  "main": "index.js",
6
6
  "files": [