haraka-plugin-limit
Advanced tools
Comparing version 1.1.1 to 1.2.0
@@ -5,2 +5,8 @@ | ||
### [1.2.0] - 2023-12-27 | ||
- disable history by default (match docs) | ||
- ci: use shared workflows | ||
### [1.1.1] - 2022-12-18 | ||
@@ -66,1 +72,2 @@ | ||
[1.1.1]: https://github.com/haraka/haraka-plugin-limit/releases/tag/1.1.1 | ||
[1.2.0]: https://github.com/haraka/haraka-plugin-limit/releases/tag/1.2.0 |
12
index.js
@@ -71,4 +71,3 @@ 'use strict'; | ||
exports.load_limit_ini = function () { | ||
const plugin = this; | ||
plugin.cfg = plugin.config.get('limit.ini', { | ||
this.cfg = this.config.get('limit.ini', { | ||
booleans: [ | ||
@@ -84,6 +83,9 @@ '-outbound.enabled', | ||
'-rate_rcpt_null.enabled', | ||
'-concurrency_history.enabled', | ||
'-recipients_history.enabled', | ||
'-rate_conn_history.enabled' | ||
] | ||
}, | ||
function () { | ||
plugin.load_limit_ini(); | ||
() => { | ||
this.load_limit_ini(); | ||
}); | ||
@@ -149,3 +151,3 @@ | ||
const history_cfg = `${type}_history`; | ||
if (!this.cfg[history_cfg]) return; | ||
if (!this.cfg[history_cfg] || !this.cfg[history_cfg].enabled) return; | ||
@@ -152,0 +154,0 @@ const history_plugin = this.cfg[history_cfg].plugin; |
{ | ||
"name": "haraka-plugin-limit", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "enforce various types of limits on remote MTAs", | ||
@@ -10,12 +10,12 @@ "directories": { | ||
"haraka-constants": "*", | ||
"haraka-plugin-redis": "2", | ||
"ipaddr.js": "^2.0.1", | ||
"redis": "4" | ||
"haraka-plugin-redis": "^2.0.6", | ||
"ipaddr.js": "^2.1.0", | ||
"redis": "^4.6.12" | ||
}, | ||
"devDependencies": { | ||
"address-rfc2821": "*", | ||
"eslint": "8", | ||
"eslint": "^8.56.0", | ||
"eslint-plugin-haraka": "*", | ||
"haraka-test-fixtures": "*", | ||
"mocha": "9" | ||
"mocha": "^10.2.0" | ||
}, | ||
@@ -22,0 +22,0 @@ "scripts": { |
@@ -5,2 +5,3 @@ # haraka-plugin-limit | ||
[![Code Climate][clim-img]][clim-url] | ||
[![NPM][npm-img]][npm-url] | ||
@@ -36,3 +37,3 @@ | ||
Each limit type is disabled until `enabled=true` is set within it's block in limit.ini. | ||
Each limit type is disabled until `enabled=true` is set within its block in limit.ini. | ||
@@ -46,4 +47,3 @@ Haraka's config loader loads the defaults from limit.ini within this plugins installed config directory and applies any overrides found in the limit.ini within your Haraka install/config directory. | ||
Set this to the length in seconds that you want to delay every SMTP | ||
response to a remote client that has exceeded the rate limits. | ||
Set this to the length in seconds that you want to delay every SMTP response to a remote client that has exceeded the rate limits. | ||
@@ -66,5 +66,3 @@ | ||
This works well in conjunction with a history / reputation database, so that | ||
one can assign very low concurrency (1) to bad or unknown senders and higher | ||
limits for reputable mail servers. | ||
This works well in conjunction with a history / reputation database, so that one can assign very low concurrency (1) to bad or unknown senders and higher limits for reputable mail servers. | ||
@@ -86,4 +84,3 @@ | ||
Unrecognized commands are normally SMTP verbs invalidly issued by the client. | ||
Examples: | ||
Unrecognized commands are normally SMTP verbs invalidly issued by the client. Examples: | ||
@@ -97,6 +94,3 @@ * issuing AUTH when we didn't advertise AUTH extension | ||
The unrecognized_command hook is used by the `tls` and `auth` plugins, so | ||
running this plugin before those would result in valid operations getting | ||
counted against that connections limits. The solution is simple: list | ||
`limit` in config/plugins after those. | ||
The unrecognized_command hook is used by the `tls` and `auth` plugins, so running this plugin before those would result in valid operations getting counted against that connections limits. The solution is simple: list `limit` in config/plugins after those. | ||
@@ -125,12 +119,9 @@ | ||
'lookup' is based upon the limit being enforced and is either an IP | ||
address, rDNS name, sender address or recipient address either in full | ||
or part. | ||
The lookup order is as follows and the first match in this order is | ||
returned and is used as the record key in Redis (except for 'default' | ||
which always uses the full lookup for that test as the record key): | ||
'lookup' is based upon the limit being enforced and is either an IP address, rDNS name, sender address or recipient address either in full or part. | ||
**IPv4/IPv6 address or rDNS hostname:** | ||
The lookup order is as follows and the first match in this order is returned and is used as the record key in Redis (except for 'default' which always uses the full lookup for that test as the record key): | ||
<pre> | ||
**IPv4/IPv6 address or rDNS hostname:** | ||
```` | ||
fe80:0:0:0:202:b3ff:fe1e:8329 | ||
@@ -153,7 +144,7 @@ fe80:0:0:0:202:b3ff:fe1e | ||
default | ||
</pre> | ||
```` | ||
**Sender or Recipient address:** | ||
**Sender or Recipient address:** | ||
<pre> | ||
``` | ||
user@host.sub.part.domain.com | ||
@@ -166,12 +157,9 @@ host.sub.part.domain.com | ||
default | ||
</pre> | ||
```` | ||
In all tests 'default' is used to specify a default limit if nothing else has | ||
matched. | ||
In all tests 'default' is used to specify a default limit if nothing else has matched. | ||
'limit' specifies the limit for this lookup. Specify 0 (zero) to disable | ||
limits on a matching lookup. | ||
'limit' specifies the limit for this lookup. Specify 0 (zero) to disable limits on a matching lookup. | ||
'time' is optional and if missing defaults to 60 seconds. You can optionally | ||
specify the following time units (case-insensitive): | ||
'time' is optional and if missing defaults to 60 seconds. You can optionally specify the following time units (case-insensitive): | ||
@@ -186,4 +174,3 @@ - s (seconds) | ||
This section limits the number of connections per interval from a given host | ||
or set of hosts. | ||
This section limits the number of connections per interval from a given host or set of hosts. | ||
@@ -195,4 +182,3 @@ IP and rDNS names are looked up by this test. | ||
This section limits the number of recipients per interval from a given host or | ||
set of hosts. | ||
This section limits the number of recipients per interval from a given host or set of hosts. | ||
@@ -204,4 +190,3 @@ IP and rDNS names are looked up by this test. | ||
This section limits the number of recipients per interval from a sender or | ||
sender domain. | ||
This section limits the number of recipients per interval from a sender or sender domain. | ||
@@ -213,4 +198,3 @@ The sender is looked up by this test. | ||
This section limits the rate which a recipient or recipient domain can | ||
receive messages over an interval. | ||
This section limits the rate which a recipient or recipient domain can receive messages over an interval. | ||
@@ -222,4 +206,3 @@ Each recipient is looked up by this test. | ||
This section limits the rate at which a recipient can receive messages from | ||
a null sender (e.g. DSN, MDN etc.) over an interval. | ||
This section limits the rate at which a recipient can receive messages from a null sender (e.g. DSN, MDN etc.) over an interval. | ||
@@ -226,0 +209,0 @@ Each recipient is looked up by this test. |
@@ -12,5 +12,7 @@ 'use strict'; | ||
recipients: { enabled: false }, | ||
recipients_history: { enabled: false }, | ||
unrecognized_commands: { enabled: false }, | ||
errors: { enabled: false }, | ||
rate_conn: { '127': 0, enabled: false, default: 5 }, | ||
rate_conn_history: { enabled: false }, | ||
rate_rcpt: { '127': 0, enabled: false, default: '50/5m' }, | ||
@@ -21,3 +23,4 @@ rate_rcpt_host: { '127': 0, enabled: false, default: '50/5m' }, | ||
redis: { database: 4, socket: { host: '127.0.0.1', port: '6379' } }, | ||
concurrency: { plugin: 'karma', good: 10, bad: 1, none: 2 } | ||
concurrency: { plugin: 'karma', good: 10, bad: 1, none: 2 }, | ||
concurrency_history: { enabled: false }, | ||
}; | ||
@@ -24,0 +27,0 @@ |
@@ -21,2 +21,3 @@ 'use strict'; | ||
this.plugin.cfg.concurrency_history = { | ||
enabled: true, | ||
plugin: 'karma', | ||
@@ -23,0 +24,0 @@ good: 5, |
Sorry, the diff of this file is not supported yet
48061
869
225
Updatedharaka-plugin-redis@^2.0.6
Updatedipaddr.js@^2.1.0
Updatedredis@^4.6.12