Haraka 3.0.1 → 3.0.3
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/Changes.md +56 -0
- package/Dockerfile +3 -3
- package/Plugins.md +5 -4
- package/README.md +4 -4
- package/TODO +1 -24
- package/config/access.domains +1 -1
- package/config/auth_flat_file.ini +1 -0
- package/config/auth_vpopmaild.ini +4 -2
- package/config/helo.checks.ini +1 -1
- package/config/outbound.ini +1 -1
- package/config/rabbitmq_amqplib.ini +8 -1
- package/connection.js +32 -10
- package/docs/Connection.md +1 -1
- package/docs/Outbound.md +6 -15
- package/docs/Plugins.md +46 -39
- package/docs/Transaction.md +1 -1
- package/docs/{plugins → deprecated}/connect.rdns_access.md +1 -1
- package/docs/{plugins → deprecated}/mail_from.access.md +1 -1
- package/docs/{plugins → deprecated}/rcpt_to.access.md +1 -1
- package/docs/plugins/auth/auth_vpopmaild.md +15 -19
- package/docs/plugins/auth/flat_file.md +23 -30
- package/docs/plugins/clamd.md +1 -1
- package/docs/plugins/queue/rabbitmq_amqplib.md +7 -0
- package/docs/plugins/queue/smtp_forward.md +16 -38
- package/docs/plugins/queue/smtp_proxy.md +9 -11
- package/docs/plugins/relay.md +2 -2
- package/outbound/hmail.js +2 -2
- package/outbound/queue.js +5 -0
- package/outbound/tls.js +1 -1
- package/package.json +31 -31
- package/plugins/auth/auth_base.js +27 -11
- package/plugins/auth/auth_vpopmaild.js +29 -19
- package/plugins/auth/flat_file.js +17 -12
- package/plugins/clamd.js +1 -0
- package/plugins/dns_list_base.js +3 -3
- package/plugins/helo.checks.js +15 -7
- package/plugins/queue/rabbitmq_amqplib.js +1 -1
- package/plugins/queue/smtp_forward.js +21 -15
- package/plugins/tls.js +1 -1
- package/plugins.js +1 -0
- package/tests/config/helo.checks.ini +52 -0
- package/tests/plugins/dns_list_base.js +41 -31
- package/tests/plugins/helo.checks.js +212 -239
- package/tests/plugins/queue/smtp_forward.js +36 -7
- package/tests/queue/multibyte +0 -0
- package/tests/queue/plain +0 -0
- package/transaction.js +1 -1
- package/config/lookup_rdns.strict.ini +0 -12
- package/config/lookup_rdns.strict.timeout +0 -1
- package/config/lookup_rdns.strict.whitelist +0 -1
- package/config/lookup_rdns.strict.whitelist_regex +0 -5
- package/config/rcpt_to.blocklist +0 -1
- package/config/rdns.allow_regexps +0 -0
- package/config/rdns.deny_regexps +0 -0
- package/config.js +0 -6
- package/coverage/lcov.info +0 -13863
- package/coverage/tmp/coverage-42958-1658373250585-0.json +0 -1
- package/coverage/tmp/coverage-42961-1658373250529-0.json +0 -1
- package/docs/plugins/relay_acl.md +0 -29
- package/docs/plugins/relay_all.md +0 -15
- package/docs/plugins/relay_force_routing.md +0 -33
- package/plugins/data.headers.js +0 -4
- package/plugins/relay_all.js +0 -13
- /package/docs/{plugins → deprecated}/rcpt_to.routes.md +0 -0
package/Changes.md
CHANGED
|
@@ -1,6 +1,60 @@
|
|
|
1
1
|
|
|
2
2
|
### Unreleased
|
|
3
3
|
|
|
4
|
+
### [3.0.3] - 2024-02-07
|
|
5
|
+
|
|
6
|
+
#### Added
|
|
7
|
+
|
|
8
|
+
- feat(auth_vpopmaild): when outbound, assure the envelope domain matches AUTH domain #3265
|
|
9
|
+
- docs(outbound): remove example setting outbound_ip #3253
|
|
10
|
+
- doc(Plugins.md): add pi-queue-kafka #3247
|
|
11
|
+
- feat(rabbitmq_amqplib): configurable optional queue arguments #3239
|
|
12
|
+
- feat(clamd): add x-haraka-virus header #3207
|
|
13
|
+
|
|
14
|
+
#### Fixed
|
|
15
|
+
|
|
16
|
+
- Fix: add empty string as param to .join() on bounce. #3237
|
|
17
|
+
- Update links in documentation #3234
|
|
18
|
+
- fix(ob/hmail):Add filename to the error for easy debugging
|
|
19
|
+
- fix(ob/queue): Ignore 'error.' prefixed files in the queue because corrupted
|
|
20
|
+
|
|
21
|
+
#### Changed
|
|
22
|
+
|
|
23
|
+
- docs(outbound): remove example of outbound_ip #3253
|
|
24
|
+
- transaction: simplify else condition in add_data #3252
|
|
25
|
+
- q/smtp_forward: always register get_mx hook #3204
|
|
26
|
+
- dep(pi-es): bump version to 8.0.2 #3206
|
|
27
|
+
- dep(redis): bump version to 4.6.7 #3193
|
|
28
|
+
- dep(pi-spf): bump version to 1.2.4
|
|
29
|
+
- dep(net-utils): bump version to 1.5.3
|
|
30
|
+
- dep(pi-redis): bump version to 2.0.6
|
|
31
|
+
- dep(tld): bump version to 1.2.0
|
|
32
|
+
- remove defunct config files: lookup_rdns.strict.ini, lookup_rdns.strict.timeout, lookup_rdns.strict.whitelist, lookup_rdns.strict.whitelist_regex, rcpt_to.blocklist, rdns.allow_regexps, rdns.deny_regexps
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### [3.0.2] - 2023-06-12
|
|
36
|
+
|
|
37
|
+
#### Fixed
|
|
38
|
+
|
|
39
|
+
- feat(q_forward): add LMTP routing handling #3199
|
|
40
|
+
- chore(q_forward): tighten up queue.wants handling #3199
|
|
41
|
+
- doc(q_forward): improve markdown formatting #3199
|
|
42
|
+
- helo.checks: several fixes, #3191
|
|
43
|
+
- q/smtp_forward: correct path to next_hop #3186
|
|
44
|
+
- don't leak addr parsing errors into SMTP conversation #3185
|
|
45
|
+
- connection: handle dns.reverse invalid throws on node v20 #3184
|
|
46
|
+
- rename redis command setex to setEx #3181
|
|
47
|
+
|
|
48
|
+
#### Changed
|
|
49
|
+
|
|
50
|
+
- test(helo.checks): add regression tests for #3191 #3195
|
|
51
|
+
- connection: handle dns.reverse invalid throws on node v20
|
|
52
|
+
- build(deps): bump ipaddr.js from 2.0.1 to 2.1.0 #3194
|
|
53
|
+
- chore: bump a few dependency versions #3184
|
|
54
|
+
- dns_list_base: avoid test failure when public DNS used #3184
|
|
55
|
+
- doc(outbound.ini) update link #3159
|
|
56
|
+
- doc(clamd.md) fixed spelling error #3155
|
|
57
|
+
|
|
4
58
|
|
|
5
59
|
### [3.0.1] - 2023-01-19
|
|
6
60
|
|
|
@@ -1345,3 +1399,5 @@
|
|
|
1345
1399
|
|
|
1346
1400
|
[3.0.0]: https://github.com/haraka/Haraka/releases/tag/3.0.0
|
|
1347
1401
|
[3.0.1]: https://github.com/haraka/Haraka/releases/tag/3.0.1
|
|
1402
|
+
[3.0.2]: https://github.com/haraka/Haraka/releases/tag/3.0.2
|
|
1403
|
+
[3.0.3]: https://github.com/haraka/Haraka/releases/tag/3.0.3
|
package/Dockerfile
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
# DOCKER-VERSION 0.5.3
|
|
14
14
|
|
|
15
15
|
# See http://phusion.github.io/baseimage-docker/
|
|
16
|
-
FROM phusion/baseimage:
|
|
16
|
+
FROM phusion/baseimage:focal-1.2.0
|
|
17
17
|
|
|
18
18
|
MAINTAINER Justin Plock <jplock@gmail.com>
|
|
19
19
|
|
|
@@ -23,8 +23,8 @@ RUN /etc/my_init.d/00_regen_ssh_host_keys.sh
|
|
|
23
23
|
|
|
24
24
|
RUN sed 's/main$/main universe/' -i /etc/apt/sources.list
|
|
25
25
|
RUN DEBIAN_FRONTEND=noninteractive apt-get -y -q update
|
|
26
|
-
RUN DEBIAN_FRONTEND=noninteractive apt-get -y -q install
|
|
27
|
-
RUN curl -sL https://deb.nodesource.com/
|
|
26
|
+
RUN DEBIAN_FRONTEND=noninteractive apt-get -y -q install software-properties-common g++ make git curl
|
|
27
|
+
RUN curl -sL https://deb.nodesource.com/setup_18.x | setuser root bash -
|
|
28
28
|
RUN DEBIAN_FRONTEND=noninteractive apt-get -y -q install nodejs && \
|
|
29
29
|
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
|
30
30
|
|
package/Plugins.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
To create your own plugin, see:
|
|
4
4
|
- the [plugin template][template] that includes all the boilerplate
|
|
5
5
|
- the [Write a Plugin][write-plugin] tutorial
|
|
6
|
-
- the [Plugins]
|
|
6
|
+
- the [Plugins][plugins-doc] section of [the manual](https://haraka.github.io)
|
|
7
7
|
|
|
8
8
|
## Installing NPM packaged plugins
|
|
9
9
|
|
|
@@ -40,7 +40,6 @@ Create a PR adding yours to this list.
|
|
|
40
40
|
| [block_me][url-blockme] | Populate block list via forwarded emails |
|
|
41
41
|
| [bounce][url-bounce] | Many options for bounce processing |
|
|
42
42
|
| [clamd][url-clamd] | Anti-Virus scanning with ClamAV |
|
|
43
|
-
| [connect.p0f][url-p0f] | TCP Fingerprinting |
|
|
44
43
|
| [data.signatures][url-sigs] | Block emails whose bodies match signatures |
|
|
45
44
|
| [uribl][url-uribl] | Block based on URI blacklists |
|
|
46
45
|
| [dcc][url-dcc] | Distributed Checksum Clearinghouse |
|
|
@@ -70,6 +69,7 @@ Create a PR adding yours to this list.
|
|
|
70
69
|
| [milter][url-milter] | milter support |
|
|
71
70
|
| [mongodb][mongo-url] | Queue emails to MongoDB |
|
|
72
71
|
| [outbound-logger][url-outbound-logger] | JSON logging of outbound email traffic. Logs useful metadata about delivered/bounced emails |
|
|
72
|
+
| [p0f][url-p0f] | TCP Fingerprinting |
|
|
73
73
|
| [prevent_credential_leaks][url-creds] | Prevent users from emailing their credentials |
|
|
74
74
|
| [process_title][url-proctitle] | Populate `ps` output with activity counters |
|
|
75
75
|
| queue/[discard][url-qdisc] | queues messages to /dev/null |
|
|
@@ -82,6 +82,7 @@ Create a PR adding yours to this list.
|
|
|
82
82
|
| queue/[smtp_bridge][url-qbridge] | Bridge SMTP sessions to another MTA |
|
|
83
83
|
| queue/[smtp_forward][url-qforward] | Forward emails to another MTA |
|
|
84
84
|
| queue/[smtp_proxy][url-qproxy] | Proxy SMTP connections to another MTA |
|
|
85
|
+
| [queue-kafka][url-kafka] | Queue inbound mail to a Kafka topic |
|
|
85
86
|
| [recipient-routes][url-rroutes] | Route emails based on their recipient(s) |
|
|
86
87
|
| [redis][url-redis] | multi-purpose Redis db connection(s) |
|
|
87
88
|
| [rcpt_to.in_host_list][url-rhost] | Define local email domains in a file |
|
|
@@ -109,7 +110,7 @@ Create a PR adding yours to this list.
|
|
|
109
110
|
|
|
110
111
|
[template]: https://github.com/haraka/haraka-plugin-template
|
|
111
112
|
[write-plugin]: https://github.com/haraka/Haraka/wiki/Write-a-Plugin
|
|
112
|
-
[plugins-doc]: https://haraka.github.io/
|
|
113
|
+
[plugins-doc]: https://haraka.github.io/core/Plugins
|
|
113
114
|
[url-access]: https://github.com/haraka/haraka-plugin-access
|
|
114
115
|
[url-acc-files]: https://github.com/acharkizakaria/haraka-plugin-accounting-files/blob/master/README.md
|
|
115
116
|
[url-action-mailbox]: https://guides.rubyonrails.org/action_mailbox_basics.html
|
|
@@ -192,4 +193,4 @@ Create a PR adding yours to this list.
|
|
|
192
193
|
[url-xclient]: https://github.com/haraka/Haraka/blob/master/docs/plugins/xclient.md
|
|
193
194
|
[mongo-url]: https://github.com/Helpmonks/haraka-plugin-mongodb
|
|
194
195
|
[url-outbound-logger]: https://github.com/mr-karan/haraka-plugin-outbound-logger
|
|
195
|
-
|
|
196
|
+
[url-kafka]: https://github.com/benjamonnguyen/haraka-plugin-queue-kafka
|
package/README.md
CHANGED
|
@@ -140,10 +140,10 @@ SpamAssassin and a hacker on [Qpsmtpd][13].
|
|
|
140
140
|
[6]: https://github.com/haraka/Haraka/blob/master/docs/plugins/dkim_sign.md
|
|
141
141
|
[7]: https://en.wikipedia.org/wiki/Mail_delivery_agent
|
|
142
142
|
[8]: mailto:haraka-sub@harakamail.com
|
|
143
|
-
[9]:
|
|
144
|
-
[10]: https://haraka.github.io/
|
|
145
|
-
[11]: https://haraka.github.io/
|
|
146
|
-
[12]: https://github.com/haraka/Haraka/
|
|
143
|
+
[9]: https://haraka.github.io/plugins/spamassassin
|
|
144
|
+
[10]: https://haraka.github.io/plugins/helo.checks
|
|
145
|
+
[11]: https://haraka.github.io/plugins/dnsbl
|
|
146
|
+
[12]: https://github.com/haraka/Haraka/blob/master/Plugins.md
|
|
147
147
|
[13]: https://github.com/smtpd/qpsmtpd/
|
|
148
148
|
[15]: https://github.com/haraka/Haraka/issues
|
|
149
149
|
[16]: https://github.com/haraka/Haraka/blob/master/LICENSE
|
package/TODO
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
- Milter support
|
|
2
2
|
- Ability to modify the body of email
|
|
3
3
|
- Done for banners. Modifying the rest, not so much.
|
|
4
|
-
- Plugins to copy from Qpsmtpd:
|
|
5
|
-
- dspam
|
|
6
4
|
|
|
7
5
|
Outbound improvements
|
|
8
6
|
- Provide better command line tools for manipulating/inspecting the queue
|
|
@@ -16,29 +14,8 @@ Plugin behavior changes
|
|
|
16
14
|
only when requested, with a sunset date.
|
|
17
15
|
- data.uribl; expand short URLs before lookups, add support for uri-a (sbl.spamhaus.org), uri-ns, uri-ns-a lookup types.
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
Remove the following deprecated plugins
|
|
21
|
-
- rdns.regexp
|
|
22
|
-
- data.nomsgid (subsumed into data.headers.js)
|
|
23
|
-
- data.noreceived ""
|
|
24
|
-
- data.rfc5322_header_checks ""
|
|
25
|
-
- daemonize
|
|
26
|
-
- mail_from.nobounces (subsumed into bounce.js)
|
|
27
|
-
- mail_from.blocklist
|
|
28
|
-
- rcpt_to.blocklist
|
|
29
|
-
- lookup_rdns_strict
|
|
30
|
-
- mail_from.access (replaced by access.js)
|
|
31
|
-
- rcpt_to.access ""
|
|
32
|
-
- connect.rdns_access ""
|
|
33
|
-
- relay_acl (replaced by relay.js)
|
|
34
|
-
- relay_all ""
|
|
35
|
-
- relay_force_routing ""
|
|
36
|
-
|
|
37
|
-
Move the following plugins:
|
|
38
|
-
- test_queue -> queue/test_queue
|
|
39
|
-
|
|
40
17
|
Built-in HTTP server
|
|
41
|
-
-
|
|
18
|
+
- use the same TLS/SSL certs as smtpd
|
|
42
19
|
- auth against SMTP-AUTH provider
|
|
43
20
|
|
|
44
21
|
Update tests to detect HARAKA_NETWORK_TESTS and skip network tests unless it's set
|
package/config/access.domains
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
[main]
|
|
1
2
|
host=127.0.0.6
|
|
2
3
|
port=89
|
|
3
|
-
;sysadmin=postmaster@example.com:sekret
|
|
4
|
+
; sysadmin=postmaster@example.com:sekret
|
|
5
|
+
; constrain_sender=true
|
|
4
6
|
|
|
5
7
|
[example.com]
|
|
6
8
|
host=127.0.0.10
|
|
7
|
-
;sysadmin=postmaster@example.com:sekret
|
|
9
|
+
; sysadmin=postmaster@example.com:sekret
|
package/config/helo.checks.ini
CHANGED
package/config/outbound.ini
CHANGED
|
@@ -9,4 +9,11 @@ queueName = emails
|
|
|
9
9
|
deliveryMode = 2
|
|
10
10
|
confirm = true
|
|
11
11
|
durable = true
|
|
12
|
-
autoDelete = false
|
|
12
|
+
autoDelete = false
|
|
13
|
+
|
|
14
|
+
; Optional queue arguments
|
|
15
|
+
; [queue_args]
|
|
16
|
+
; x-dead-letter-exchange =
|
|
17
|
+
; x-dead-letter-routing-key = emails_dlq
|
|
18
|
+
; x-overflow = reject-publish
|
|
19
|
+
; x-queue-type = quorum
|
package/connection.js
CHANGED
|
@@ -15,7 +15,7 @@ const constants = require('haraka-constants');
|
|
|
15
15
|
const net_utils = require('haraka-net-utils');
|
|
16
16
|
const Notes = require('haraka-notes');
|
|
17
17
|
const utils = require('haraka-utils');
|
|
18
|
-
const { Address }
|
|
18
|
+
const { Address } = require('address-rfc2821');
|
|
19
19
|
const ResultStore = require('haraka-results');
|
|
20
20
|
|
|
21
21
|
// Haraka libs
|
|
@@ -734,9 +734,16 @@ class Connection {
|
|
|
734
734
|
});
|
|
735
735
|
break;
|
|
736
736
|
default:
|
|
737
|
-
dns.reverse
|
|
738
|
-
|
|
739
|
-
|
|
737
|
+
// BUG: dns.reverse throws on invalid input (and sometimes valid
|
|
738
|
+
// input nodejs/node#47847). Also throws when empty results
|
|
739
|
+
try {
|
|
740
|
+
dns.reverse(this.remote.ip, (err, domains) => {
|
|
741
|
+
this.rdns_response(err, domains);
|
|
742
|
+
})
|
|
743
|
+
}
|
|
744
|
+
catch (err) {
|
|
745
|
+
this.rdns_response(err, []);
|
|
746
|
+
}
|
|
740
747
|
}
|
|
741
748
|
}
|
|
742
749
|
rdns_response (err, domains) {
|
|
@@ -1319,16 +1326,15 @@ class Connection {
|
|
|
1319
1326
|
this.errors++;
|
|
1320
1327
|
return this.respond(503, 'Use EHLO/HELO before MAIL');
|
|
1321
1328
|
}
|
|
1322
|
-
// Require authentication on
|
|
1329
|
+
// Require authentication on ports 587 & 465
|
|
1323
1330
|
if (!this.relaying && [587,465].includes(this.local.port)) {
|
|
1324
1331
|
this.errors++;
|
|
1325
1332
|
return this.respond(550, 'Authentication required');
|
|
1326
1333
|
}
|
|
1334
|
+
|
|
1327
1335
|
let results;
|
|
1328
|
-
let from;
|
|
1329
1336
|
try {
|
|
1330
1337
|
results = rfc1869.parse('mail', line, this.cfg.main.strict_rfc1869 && !this.relaying);
|
|
1331
|
-
from = new Address (results.shift());
|
|
1332
1338
|
}
|
|
1333
1339
|
catch (err) {
|
|
1334
1340
|
this.errors++;
|
|
@@ -1343,9 +1349,18 @@ class Connection {
|
|
|
1343
1349
|
return this.respond(452, 'Internal Server Error');
|
|
1344
1350
|
}
|
|
1345
1351
|
else {
|
|
1346
|
-
return this.respond(501, [
|
|
1352
|
+
return this.respond(501, ['Command parsing failed', err]);
|
|
1347
1353
|
}
|
|
1348
1354
|
}
|
|
1355
|
+
|
|
1356
|
+
let from;
|
|
1357
|
+
try {
|
|
1358
|
+
from = new Address(results.shift());
|
|
1359
|
+
}
|
|
1360
|
+
catch (err) {
|
|
1361
|
+
return this.respond(501, `Invalid MAIL FROM address`);
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1349
1364
|
// Get rest of key=value pairs
|
|
1350
1365
|
const params = {};
|
|
1351
1366
|
results.forEach(param => {
|
|
@@ -1382,10 +1397,8 @@ class Connection {
|
|
|
1382
1397
|
}
|
|
1383
1398
|
|
|
1384
1399
|
let results;
|
|
1385
|
-
let recip;
|
|
1386
1400
|
try {
|
|
1387
1401
|
results = rfc1869.parse('rcpt', line, this.cfg.main.strict_rfc1869 && !this.relaying);
|
|
1388
|
-
recip = new Address(results.shift());
|
|
1389
1402
|
}
|
|
1390
1403
|
catch (err) {
|
|
1391
1404
|
this.errors++;
|
|
@@ -1403,6 +1416,15 @@ class Connection {
|
|
|
1403
1416
|
return this.respond(501, ["Command parsing failed", err]);
|
|
1404
1417
|
}
|
|
1405
1418
|
}
|
|
1419
|
+
|
|
1420
|
+
let recip;
|
|
1421
|
+
try {
|
|
1422
|
+
recip = new Address(results.shift());
|
|
1423
|
+
}
|
|
1424
|
+
catch (err) {
|
|
1425
|
+
return this.respond(501, `Invalid RCPT TO address`);
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1406
1428
|
// Get rest of key=value pairs
|
|
1407
1429
|
const params = {};
|
|
1408
1430
|
results.forEach((param) => {
|
package/docs/Connection.md
CHANGED
|
@@ -63,5 +63,5 @@ For low level use. This value is set when the remote host drops the connection.
|
|
|
63
63
|
|
|
64
64
|
* connection.results
|
|
65
65
|
|
|
66
|
-
Store results of processing in a structured format. See [
|
|
66
|
+
Store results of processing in a structured format. See [haraka-results](https://github.com/haraka/haraka-results)
|
|
67
67
|
|
package/docs/Outbound.md
CHANGED
|
@@ -38,9 +38,9 @@ of CPUs that you have.
|
|
|
38
38
|
|
|
39
39
|
Default: true. Switch to false to disable TLS for outbound mail.
|
|
40
40
|
|
|
41
|
-
This uses the same `tls_key.pem` and `tls_cert.pem` files that the `
|
|
42
|
-
plugin uses, along with other values in `tls.ini`. See the [
|
|
43
|
-
docs](http://haraka.github.io/
|
|
41
|
+
This uses the same `tls_key.pem` and `tls_cert.pem` files that the `TLS`
|
|
42
|
+
plugin uses, along with other values in `tls.ini`. See the [TLS plugin
|
|
43
|
+
docs](http://haraka.github.io/plugins/tls) for information on generating those files.
|
|
44
44
|
|
|
45
45
|
Within `tls.ini` you can specify global options for the values `ciphers`, `minVersion`, `requestCert` and `rejectUnauthorized`, alternatively you can provide separate values by putting them under a key: `[outbound]`, such as:
|
|
46
46
|
|
|
@@ -117,7 +117,7 @@ you may be interested in are:
|
|
|
117
117
|
* domain - the domain this mail is going to (see `always_split` above)
|
|
118
118
|
* notes - the original transaction.notes for this mail, also contains the
|
|
119
119
|
following useful keys:
|
|
120
|
-
** outbound_ip - the IP address to bind to (
|
|
120
|
+
** outbound_ip - the IP address to bind to (do not set manually,
|
|
121
121
|
use the `get_mx` hook)
|
|
122
122
|
** outbound_helo - the EHLO domain to use (again, do not set manually)
|
|
123
123
|
* queue_time - the epoch milliseconds time when this mail was queued
|
|
@@ -240,19 +240,10 @@ different IP addresses based on sender, domain or some other identifier.
|
|
|
240
240
|
To do this, the IP address that you want to use *must* be bound to an
|
|
241
241
|
interface (or alias) on the local system.
|
|
242
242
|
|
|
243
|
-
As described above the outbound IP can be set using the `bind` parameter
|
|
243
|
+
As described above, the outbound IP can be set using the `bind` parameter
|
|
244
244
|
and also the outbound helo for the IP can be set using the `bind_ehlo`
|
|
245
|
-
parameter returned by the `get_mx` hook
|
|
246
|
-
you can set a transaction note in a plugin to tell Haraka which outbound IP
|
|
247
|
-
address you would like it to use when it tries to deliver the message:
|
|
245
|
+
parameter returned by the `get_mx` hook.
|
|
248
246
|
|
|
249
|
-
`````
|
|
250
|
-
connection.transaction.notes.outbound_ip = '1.2.3.4';
|
|
251
|
-
connection.transaction.notes.outbound_helo = 'mail-2.example.com';
|
|
252
|
-
`````
|
|
253
|
-
|
|
254
|
-
Note: if the `get_mx` hook returns a `bind` and `bind_helo` parameter, then
|
|
255
|
-
this will be used in preference to the transaction note.
|
|
256
247
|
|
|
257
248
|
AUTH
|
|
258
249
|
----
|
package/docs/Plugins.md
CHANGED
|
@@ -20,7 +20,6 @@ Display the help text for a plugin by running:
|
|
|
20
20
|
## Overview
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
|
|
24
23
|
## Anatomy of a Plugin
|
|
25
24
|
|
|
26
25
|
Plugins in Haraka are JS files in the `plugins` directory (legacy) and npm
|
|
@@ -42,37 +41,43 @@ There are two ways for plugins to register hooks. Both examples register a funct
|
|
|
42
41
|
|
|
43
42
|
1. The `register_hook` function in register():
|
|
44
43
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
```js
|
|
45
|
+
exports.register = function () {
|
|
46
|
+
this.register_hook('rcpt', 'my_rcpt_validate')
|
|
47
|
+
};
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
exports.my_rcpt_validate = function (next, connection, params) {
|
|
50
|
+
// do processing
|
|
51
|
+
next()
|
|
52
|
+
};
|
|
53
|
+
```
|
|
53
54
|
|
|
54
55
|
2. The hook_[$name] syntax:
|
|
55
56
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
```js
|
|
58
|
+
exports.hook_rcpt = function (next, connection, params) {
|
|
59
|
+
// do processing
|
|
60
|
+
next()
|
|
61
|
+
}
|
|
62
|
+
```
|
|
60
63
|
|
|
61
64
|
The register_hook function within `register()` offers a few advantages:
|
|
62
65
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
1. register a hook multiple times (see below)
|
|
67
|
+
2. a unique function name in stack traces
|
|
68
|
+
3. [a better function name](https://google.com/search?q=programming%20good%20function%20names)
|
|
69
|
+
4. hooks can be registered conditionally (ie, based on a config setting)
|
|
67
70
|
|
|
68
71
|
### Register a Hook Multiple Times
|
|
69
72
|
|
|
70
73
|
To register the same hook more than once, call `register_hook()` multiple times with the same hook name:
|
|
71
74
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
75
|
+
```js
|
|
76
|
+
exports.register = function () {
|
|
77
|
+
this.register_hook('queue', 'try_queue_my_way')
|
|
78
|
+
this.register_hook('queue', 'try_queue_highway')
|
|
79
|
+
};
|
|
80
|
+
```
|
|
76
81
|
|
|
77
82
|
When `try_queue_my_way()` calls `next()`, the next function registered on hook *queue* will be called, in this case, `try_queue_highway()`.
|
|
78
83
|
|
|
@@ -81,17 +86,18 @@ When `try_queue_my_way()` calls `next()`, the next function registered on hook *
|
|
|
81
86
|
When a single function runs on multiple hooks, the function can check the
|
|
82
87
|
*hook* property of the *connection* or *hmail* argument to determine which hook it is running on:
|
|
83
88
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
89
|
+
```js
|
|
90
|
+
exports.register = function () {
|
|
91
|
+
this.register_hook('rcpt', 'my_rcpt')
|
|
92
|
+
this.register_hook('rcpt_ok', 'my_rcpt')
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
exports.my_rcpt = function (next, connection, params) {
|
|
96
|
+
const hook_name = connection.hook; // rcpt or rcpt_ok
|
|
97
|
+
// email address is in params[0]
|
|
98
|
+
// do processing
|
|
99
|
+
}
|
|
100
|
+
```
|
|
95
101
|
|
|
96
102
|
### Next()
|
|
97
103
|
|
|
@@ -252,12 +258,11 @@ This is important as some plugins might rely on `results` or `notes` that have b
|
|
|
252
258
|
|
|
253
259
|
If you are writing a complex plugin, you may have to split it into multiple plugins to run in a specific order e.g. you want hook_deny to run last after all other plugins and hook_lookup_rdns to run first, then you can explicitly register your hooks and provide a `priority` value which is an integer between -100 (highest priority) to 100 (lowest priority) which defaults to 0 (zero) if not supplied. You can apply a priority to your hook in the following way:
|
|
254
260
|
|
|
255
|
-
|
|
256
|
-
exports.register = function() {
|
|
257
|
-
|
|
258
|
-
plugin.register_hook('connect', 'hook_connect', -100);
|
|
261
|
+
```js
|
|
262
|
+
exports.register = function () {
|
|
263
|
+
this.register_hook('connect', 'hook_connect', -100);
|
|
259
264
|
}
|
|
260
|
-
|
|
265
|
+
```
|
|
261
266
|
|
|
262
267
|
This would ensure that your hook_connect function will run before any other
|
|
263
268
|
plugins registered on the `connect` hook, regardless of the order it was
|
|
@@ -370,9 +375,11 @@ to remote servers. See [Issue 2024](https://github.com/haraka/Haraka/issues/2024
|
|
|
370
375
|
|
|
371
376
|
e.g.
|
|
372
377
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
378
|
+
```js
|
|
379
|
+
exports.shutdown = function () {
|
|
380
|
+
clearInterval(this._interval);
|
|
381
|
+
}
|
|
382
|
+
```
|
|
376
383
|
|
|
377
384
|
If you don't implement this in your plugin and have a connection open or a
|
|
378
385
|
timer running then Haraka will take 30 seconds to shut down and have to
|
package/docs/Transaction.md
CHANGED
|
@@ -160,6 +160,6 @@ body in the same encoding.
|
|
|
160
160
|
|
|
161
161
|
* transaction.results
|
|
162
162
|
|
|
163
|
-
Store results of processing in a structured format. See [
|
|
163
|
+
Store results of processing in a structured format. See [haraka-results](https://github.com/haraka/haraka-results)
|
|
164
164
|
|
|
165
165
|
[1]: `Address` objects are address-rfc2821 objects. See https://github.com/haraka/node-address-rfc2821
|
|
@@ -1,26 +1,20 @@
|
|
|
1
|
-
auth/auth\_vpopmaild
|
|
2
|
-
===============
|
|
1
|
+
# auth/auth\_vpopmaild
|
|
3
2
|
|
|
4
|
-
The `auth/vpopmaild` plugin allows
|
|
5
|
-
daemon.
|
|
3
|
+
The `auth/vpopmaild` plugin allows SMTP users to authenticate against a vpopmaild daemon.
|
|
6
4
|
|
|
7
5
|
## Configuration
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
style formatting.
|
|
7
|
+
The configuration file is stored in `config/auth_vpopmaild.ini`.
|
|
11
8
|
|
|
12
|
-
|
|
9
|
+
### settings
|
|
13
10
|
|
|
14
11
|
* host: The host/IP that vpopmaild is listening on (default: localhost).
|
|
15
12
|
|
|
16
13
|
* port: The TCP port that vpopmaild is listening on (default: 89).
|
|
17
14
|
|
|
18
|
-
* sysadmin: A colon separated username:password of a vpopmail user with
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
password. On new installs, it's best not to use CRAM-MD5, as it requires
|
|
22
|
-
storing clear text passwords. Legacy clients with MUAs configured
|
|
23
|
-
to authenticate with CRAM-MD5 will need this enabled.
|
|
15
|
+
* sysadmin: A colon separated username:password of a vpopmail user with SYSADMIN privileges (see vpopmail/bin/vmoduser -S). This is **only** necessary to support CRAM-MD5 which requires access to the clear text password. On new installs, it's best not to use CRAM-MD5, as it requires storing clear text passwords. Legacy clients with MUAs configured to authenticate with CRAM-MD5 will need this enabled.
|
|
16
|
+
|
|
17
|
+
* constrain_sender: (default: true). For outbound messages (due to successful AUTH), constrain the envelope sender (MAIL FROM) to the same domain as the authenticated user. This setting, combined with `rate_rcpt_sender` in the [limit](https://github.com/haraka/haraka-plugin-limit) plugin can dramatically reduce the amount of backscatter and spam sent when an email account is compromised.
|
|
24
18
|
|
|
25
19
|
|
|
26
20
|
### Per-domain Configuration
|
|
@@ -29,10 +23,12 @@ Additionally, domains can each have their own configuration for connecting
|
|
|
29
23
|
to vpopmaild. The defaults are the same, so only the differences needs to
|
|
30
24
|
be declared. Example:
|
|
31
25
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
```ini
|
|
27
|
+
[example.com]
|
|
28
|
+
host=192.168.0.1
|
|
29
|
+
port=999
|
|
35
30
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
[example2.com]
|
|
32
|
+
host=192.168.0.2
|
|
33
|
+
sysadmin=postmaster@example2.com:sekret
|
|
34
|
+
```
|