Haraka 3.1.1 → 3.1.2
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/.prettierignore +4 -0
- package/CONTRIBUTORS.md +5 -5
- package/Changes.md +62 -50
- package/Plugins.md +3 -1
- package/README.md +1 -1
- package/bin/haraka +475 -479
- package/config/outbound.ini +3 -0
- package/connection.js +1072 -1108
- package/docs/Connection.md +29 -30
- package/docs/CoreConfig.md +38 -39
- package/docs/CustomReturnCodes.md +0 -1
- package/docs/HAProxy.md +2 -2
- package/docs/Header.md +1 -1
- package/docs/Logging.md +29 -5
- package/docs/Outbound.md +93 -78
- package/docs/Plugins.md +103 -108
- package/docs/Transaction.md +49 -51
- package/docs/Tutorial.md +127 -143
- package/docs/deprecated/access.md +0 -1
- package/docs/deprecated/backscatterer.md +2 -3
- package/docs/deprecated/connect.rdns_access.md +18 -27
- package/docs/deprecated/data.headers.md +0 -1
- package/docs/deprecated/data.nomsgid.md +1 -2
- package/docs/deprecated/data.noreceived.md +1 -2
- package/docs/deprecated/data.rfc5322_header_checks.md +1 -2
- package/docs/deprecated/dkim_sign.md +13 -17
- package/docs/deprecated/dkim_verify.md +9 -17
- package/docs/deprecated/dnsbl.md +36 -38
- package/docs/deprecated/dnswl.md +41 -43
- package/docs/deprecated/lookup_rdns.strict.md +21 -34
- package/docs/deprecated/mail_from.access.md +17 -25
- package/docs/deprecated/mail_from.blocklist.md +9 -12
- package/docs/deprecated/mail_from.nobounces.md +1 -2
- package/docs/deprecated/rcpt_to.access.md +20 -27
- package/docs/deprecated/rcpt_to.blocklist.md +10 -13
- package/docs/deprecated/rcpt_to.routes.md +0 -1
- package/docs/deprecated/rdns.regexp.md +13 -15
- package/docs/plugins/aliases.md +89 -89
- package/docs/plugins/auth/auth_bridge.md +5 -7
- package/docs/plugins/auth/auth_ldap.md +11 -14
- package/docs/plugins/auth/auth_proxy.md +10 -12
- package/docs/plugins/auth/auth_vpopmaild.md +5 -6
- package/docs/plugins/auth/flat_file.md +4 -4
- package/docs/plugins/block_me.md +3 -3
- package/docs/plugins/data.signatures.md +1 -2
- package/docs/plugins/delay_deny.md +3 -4
- package/docs/plugins/max_unrecognized_commands.md +4 -4
- package/docs/plugins/prevent_credential_leaks.md +6 -6
- package/docs/plugins/process_title.md +18 -18
- package/docs/plugins/queue/deliver.md +2 -3
- package/docs/plugins/queue/discard.md +4 -4
- package/docs/plugins/queue/lmtp.md +1 -3
- package/docs/plugins/queue/qmail-queue.md +7 -9
- package/docs/plugins/queue/quarantine.md +16 -21
- package/docs/plugins/queue/rabbitmq.md +8 -11
- package/docs/plugins/queue/rabbitmq_amqplib.md +43 -39
- package/docs/plugins/queue/smtp_bridge.md +7 -10
- package/docs/plugins/queue/smtp_forward.md +42 -34
- package/docs/plugins/queue/smtp_proxy.md +30 -29
- package/docs/plugins/queue/test.md +1 -3
- package/docs/plugins/rcpt_to.in_host_list.md +6 -6
- package/docs/plugins/rcpt_to.max_count.md +1 -1
- package/docs/plugins/record_envelope_addresses.md +3 -3
- package/docs/plugins/reseed_rng.md +6 -6
- package/docs/plugins/status.md +9 -8
- package/docs/plugins/tarpit.md +7 -11
- package/docs/plugins/tls.md +12 -17
- package/docs/plugins/toobusy.md +4 -4
- package/docs/plugins/xclient.md +3 -3
- package/docs/tutorials/Migrating_from_v1_to_v2.md +19 -41
- package/docs/tutorials/SettingUpOutbound.md +6 -9
- package/endpoint.js +35 -38
- package/eslint.config.mjs +22 -19
- package/haraka.js +42 -47
- package/host_pool.js +75 -79
- package/http/html/404.html +45 -49
- package/http/html/index.html +39 -28
- package/http/package.json +2 -4
- package/line_socket.js +27 -28
- package/logger.js +182 -201
- package/outbound/client_pool.js +33 -33
- package/outbound/config.js +64 -59
- package/outbound/fsync_writestream.js +24 -25
- package/outbound/hmail.js +888 -835
- package/outbound/index.js +194 -187
- package/outbound/qfile.js +49 -52
- package/outbound/queue.js +197 -190
- package/outbound/timer_queue.js +41 -43
- package/outbound/tls.js +68 -61
- package/outbound/todo.js +11 -11
- package/package.json +32 -32
- package/plugins/.eslintrc.yaml +0 -1
- package/plugins/auth/auth_base.js +123 -127
- package/plugins/auth/auth_bridge.js +7 -7
- package/plugins/auth/auth_proxy.js +121 -126
- package/plugins/auth/auth_vpopmaild.js +84 -85
- package/plugins/auth/flat_file.js +18 -17
- package/plugins/block_me.js +31 -31
- package/plugins/data.signatures.js +13 -13
- package/plugins/delay_deny.js +65 -61
- package/plugins/prevent_credential_leaks.js +23 -23
- package/plugins/process_title.js +125 -128
- package/plugins/profile.js +5 -5
- package/plugins/queue/deliver.js +3 -3
- package/plugins/queue/discard.js +13 -14
- package/plugins/queue/lmtp.js +16 -17
- package/plugins/queue/qmail-queue.js +54 -55
- package/plugins/queue/quarantine.js +68 -70
- package/plugins/queue/rabbitmq.js +80 -87
- package/plugins/queue/rabbitmq_amqplib.js +75 -54
- package/plugins/queue/smtp_bridge.js +16 -16
- package/plugins/queue/smtp_forward.js +175 -179
- package/plugins/queue/smtp_proxy.js +69 -71
- package/plugins/queue/test.js +9 -9
- package/plugins/rcpt_to.host_list_base.js +30 -34
- package/plugins/rcpt_to.in_host_list.js +19 -19
- package/plugins/record_envelope_addresses.js +4 -4
- package/plugins/reseed_rng.js +4 -4
- package/plugins/status.js +90 -97
- package/plugins/tarpit.js +25 -14
- package/plugins/tls.js +68 -68
- package/plugins/toobusy.js +21 -23
- package/plugins/xclient.js +51 -53
- package/plugins.js +276 -293
- package/rfc1869.js +30 -35
- package/server.js +308 -299
- package/smtp_client.js +244 -228
- package/test/.eslintrc.yaml +0 -1
- package/test/connection.js +127 -134
- package/test/endpoint.js +53 -47
- package/test/fixtures/line_socket.js +12 -12
- package/test/fixtures/util_hmailitem.js +89 -85
- package/test/host_pool.js +90 -92
- package/test/installation/plugins/base_plugin.js +2 -2
- package/test/installation/plugins/folder_plugin/index.js +2 -3
- package/test/installation/plugins/inherits.js +3 -3
- package/test/installation/plugins/load_first.js +2 -3
- package/test/installation/plugins/plugin.js +1 -3
- package/test/installation/plugins/tls.js +2 -4
- package/test/logger.js +135 -116
- package/test/outbound/hmail.js +49 -35
- package/test/outbound/index.js +118 -101
- package/test/outbound/qfile.js +51 -53
- package/test/outbound_bounce_net_errors.js +84 -69
- package/test/outbound_bounce_rfc3464.js +235 -165
- package/test/plugins/auth/auth_base.js +420 -279
- package/test/plugins/auth/auth_vpopmaild.js +38 -39
- package/test/plugins/queue/smtp_forward.js +126 -104
- package/test/plugins/rcpt_to.host_list_base.js +85 -67
- package/test/plugins/rcpt_to.in_host_list.js +159 -112
- package/test/plugins/status.js +71 -64
- package/test/plugins/tls.js +37 -34
- package/test/plugins.js +97 -92
- package/test/rfc1869.js +19 -26
- package/test/server.js +293 -272
- package/test/smtp_client.js +180 -176
- package/test/tls_socket.js +62 -66
- package/test/transaction.js +159 -160
- package/tls_socket.js +331 -333
- package/transaction.js +129 -137
package/outbound/qfile.js
CHANGED
|
@@ -1,67 +1,64 @@
|
|
|
1
|
-
'use strict'
|
|
1
|
+
'use strict'
|
|
2
2
|
|
|
3
|
-
const os = require('node:os')
|
|
4
|
-
const platform_dot = `${
|
|
3
|
+
const os = require('node:os')
|
|
4
|
+
const platform_dot = `${['win32', 'win64'].includes(process.platform) ? '' : '__tmp__'}.`
|
|
5
5
|
|
|
6
|
-
let QFILECOUNTER = 0
|
|
6
|
+
let QFILECOUNTER = 0
|
|
7
7
|
|
|
8
|
-
const _qfile = module.exports = {
|
|
8
|
+
const _qfile = (module.exports = {
|
|
9
9
|
// File Name Format: $arrival_$nextattempt_$attempts_$pid_$uniquetag_$counter_$host
|
|
10
|
-
hostname
|
|
11
|
-
if (!hostname) hostname = os.hostname()
|
|
12
|
-
return hostname
|
|
13
|
-
.replace(/\\/g, '\\057')
|
|
14
|
-
.replace(/:/g, '\\072')
|
|
15
|
-
.replace(/_/g, '\\137');
|
|
10
|
+
hostname: (hostname) => {
|
|
11
|
+
if (!hostname) hostname = os.hostname()
|
|
12
|
+
return hostname.replace(/\\/g, '\\057').replace(/:/g, '\\072').replace(/_/g, '\\137')
|
|
16
13
|
},
|
|
17
14
|
|
|
18
|
-
name
|
|
19
|
-
const o = overrides || {}
|
|
20
|
-
const time = _qfile.time()
|
|
15
|
+
name(overrides) {
|
|
16
|
+
const o = overrides || {}
|
|
17
|
+
const time = _qfile.time()
|
|
21
18
|
return [
|
|
22
|
-
o.arrival
|
|
23
|
-
o.next_attempt
|
|
24
|
-
o.attempts
|
|
25
|
-
o.pid
|
|
26
|
-
o.uid
|
|
19
|
+
o.arrival || time,
|
|
20
|
+
o.next_attempt || time,
|
|
21
|
+
o.attempts || 0,
|
|
22
|
+
o.pid || process.pid,
|
|
23
|
+
o.uid || _qfile.rnd_unique(),
|
|
27
24
|
_qfile.next_counter(),
|
|
28
25
|
this.hostname(o.host),
|
|
29
|
-
].join('_')
|
|
26
|
+
].join('_')
|
|
30
27
|
},
|
|
31
28
|
|
|
32
|
-
time
|
|
29
|
+
time: () => new Date().getTime(),
|
|
33
30
|
|
|
34
31
|
next_counter: () => {
|
|
35
|
-
QFILECOUNTER =
|
|
36
|
-
return QFILECOUNTER
|
|
32
|
+
QFILECOUNTER = QFILECOUNTER < 10000 ? QFILECOUNTER + 1 : 0
|
|
33
|
+
return QFILECOUNTER
|
|
37
34
|
},
|
|
38
35
|
|
|
39
36
|
rnd_unique: (len = 6) => {
|
|
40
|
-
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
|
|
41
|
-
const result = []
|
|
37
|
+
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
|
|
38
|
+
const result = []
|
|
42
39
|
for (let i = len; i > 0; --i) {
|
|
43
|
-
result.push(chars[Math.floor(Math.random() * chars.length)])
|
|
40
|
+
result.push(chars[Math.floor(Math.random() * chars.length)])
|
|
44
41
|
}
|
|
45
|
-
return result.join('')
|
|
42
|
+
return result.join('')
|
|
46
43
|
},
|
|
47
44
|
|
|
48
|
-
parts
|
|
49
|
-
if (!filename) throw new Error(
|
|
45
|
+
parts: (filename) => {
|
|
46
|
+
if (!filename) throw new Error('No filename provided')
|
|
50
47
|
|
|
51
|
-
const PARTS_EXPECTED_OLD = 4
|
|
52
|
-
const PARTS_EXPECTED_CURRENT = 7
|
|
53
|
-
let p = filename.split('_')
|
|
48
|
+
const PARTS_EXPECTED_OLD = 4
|
|
49
|
+
const PARTS_EXPECTED_CURRENT = 7
|
|
50
|
+
let p = filename.split('_')
|
|
54
51
|
|
|
55
52
|
// bail on unknown split lengths
|
|
56
53
|
switch (p.length) {
|
|
57
54
|
case PARTS_EXPECTED_OLD:
|
|
58
55
|
case PARTS_EXPECTED_CURRENT:
|
|
59
|
-
break
|
|
56
|
+
break
|
|
60
57
|
default:
|
|
61
|
-
return null
|
|
58
|
+
return null
|
|
62
59
|
}
|
|
63
60
|
|
|
64
|
-
const time = _qfile.time()
|
|
61
|
+
const time = _qfile.time()
|
|
65
62
|
if (p.length === PARTS_EXPECTED_OLD) {
|
|
66
63
|
// parse the previous string structure
|
|
67
64
|
// $nextattempt_$attempts_$pid_$uniq.$host
|
|
@@ -71,26 +68,26 @@ const _qfile = module.exports = {
|
|
|
71
68
|
// match[2] = $attempts
|
|
72
69
|
// match[3] = $pid
|
|
73
70
|
// match[4] = $uniq.$my_hostname
|
|
74
|
-
const fn_re = /^(\d+)_(\d+)_(\d+)_(\d+)\.(.*)
|
|
75
|
-
const match = filename.match(fn_re)
|
|
76
|
-
if (!match) return null
|
|
71
|
+
const fn_re = /^(\d+)_(\d+)_(\d+)_(\d+)\.(.*)$/
|
|
72
|
+
const match = filename.match(fn_re)
|
|
73
|
+
if (!match) return null
|
|
77
74
|
|
|
78
|
-
p = match.slice(1)
|
|
79
|
-
p.splice(3,1,_qfile.rnd_unique(),_qfile.next_counter())
|
|
80
|
-
p.unshift(time)
|
|
75
|
+
p = match.slice(1) // grab the capture groups minus the pattern
|
|
76
|
+
p.splice(3, 1, _qfile.rnd_unique(), _qfile.next_counter()) // add a fresh UID and counter
|
|
77
|
+
p.unshift(time) // prepend current timestamp -- potentially inaccurate, but non-critical and shortlived
|
|
81
78
|
}
|
|
82
79
|
|
|
83
80
|
return {
|
|
84
|
-
arrival
|
|
85
|
-
next_attempt
|
|
86
|
-
attempts
|
|
87
|
-
pid
|
|
88
|
-
uid
|
|
89
|
-
counter
|
|
90
|
-
host
|
|
91
|
-
age
|
|
92
|
-
}
|
|
81
|
+
arrival: parseInt(p[0]),
|
|
82
|
+
next_attempt: parseInt(p[1]),
|
|
83
|
+
attempts: parseInt(p[2]),
|
|
84
|
+
pid: parseInt(p[3]),
|
|
85
|
+
uid: p[4],
|
|
86
|
+
counter: parseInt(p[5]),
|
|
87
|
+
host: p[6],
|
|
88
|
+
age: time - parseInt(p[0]),
|
|
89
|
+
}
|
|
93
90
|
},
|
|
94
91
|
|
|
95
|
-
platformDOT
|
|
96
|
-
}
|
|
92
|
+
platformDOT: platform_dot,
|
|
93
|
+
})
|