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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict'
|
|
1
|
+
'use strict'
|
|
2
2
|
|
|
3
3
|
// Testing bounce email contents related to errors occuring during SMTP dialog
|
|
4
4
|
|
|
@@ -9,44 +9,43 @@
|
|
|
9
9
|
// - Test the outcome by replacing trigger functions with our testing code (outbound.send_email, HMailItem.temp_fail, ...)
|
|
10
10
|
|
|
11
11
|
const assert = require('node:assert')
|
|
12
|
-
const dns
|
|
13
|
-
const fs
|
|
14
|
-
const path
|
|
12
|
+
const dns = require('node:dns')
|
|
13
|
+
const fs = require('node:fs')
|
|
14
|
+
const path = require('node:path')
|
|
15
15
|
|
|
16
|
-
const constants
|
|
17
|
-
const util_hmailitem = require('./fixtures/util_hmailitem')
|
|
18
|
-
const TODOItem
|
|
19
|
-
const HMailItem
|
|
20
|
-
const outbound
|
|
16
|
+
const constants = require('haraka-constants')
|
|
17
|
+
const util_hmailitem = require('./fixtures/util_hmailitem')
|
|
18
|
+
const TODOItem = require('../outbound/todo')
|
|
19
|
+
const HMailItem = require('../outbound/hmail')
|
|
20
|
+
const outbound = require('../outbound')
|
|
21
21
|
|
|
22
22
|
const outbound_context = {
|
|
23
23
|
TODOItem,
|
|
24
|
-
exports: outbound
|
|
24
|
+
exports: outbound,
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
const queue_dir = path.resolve(__dirname, 'test-queue')
|
|
27
|
+
const queue_dir = path.resolve(__dirname, 'test-queue')
|
|
28
28
|
|
|
29
29
|
describe('outbound_bounce_net_errors', () => {
|
|
30
30
|
beforeEach((done) => {
|
|
31
|
-
fs.exists(queue_dir, exists => {
|
|
31
|
+
fs.exists(queue_dir, (exists) => {
|
|
32
32
|
if (exists) {
|
|
33
|
-
done()
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
33
|
+
done()
|
|
34
|
+
} else {
|
|
36
35
|
fs.mkdir(queue_dir, done)
|
|
37
36
|
}
|
|
38
|
-
})
|
|
37
|
+
})
|
|
39
38
|
})
|
|
40
39
|
|
|
41
40
|
afterEach((done) => {
|
|
42
41
|
fs.exists(queue_dir, (exists) => {
|
|
43
42
|
if (exists) {
|
|
44
43
|
for (const file of fs.readdirSync(queue_dir)) {
|
|
45
|
-
const curPath = path.resolve(queue_dir, file)
|
|
44
|
+
const curPath = path.resolve(queue_dir, file)
|
|
46
45
|
if (fs.lstatSync(curPath).isDirectory()) {
|
|
47
46
|
console.error(`did not expect an sub folder here ("${curPath}")! cancel`)
|
|
48
47
|
}
|
|
49
|
-
fs.unlinkSync(curPath)
|
|
48
|
+
fs.unlinkSync(curPath)
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
51
|
done()
|
|
@@ -54,89 +53,105 @@ describe('outbound_bounce_net_errors', () => {
|
|
|
54
53
|
})
|
|
55
54
|
|
|
56
55
|
it('test get-mx-deny triggers bounce(...)', (done) => {
|
|
57
|
-
util_hmailitem.newMockHMailItem(outbound_context, done, {}, mock_hmail => {
|
|
58
|
-
const orig_bounce = HMailItem.prototype.bounce
|
|
56
|
+
util_hmailitem.newMockHMailItem(outbound_context, done, {}, (mock_hmail) => {
|
|
57
|
+
const orig_bounce = HMailItem.prototype.bounce
|
|
59
58
|
HMailItem.prototype.bounce = function (err, opts) {
|
|
60
|
-
assert.ok(true, 'get_mx=DENY: bounce function called')
|
|
59
|
+
assert.ok(true, 'get_mx=DENY: bounce function called')
|
|
61
60
|
/* dsn_code: 550,
|
|
62
61
|
dsn_status: '5.1.2',
|
|
63
62
|
dsn_action: 'failed' */
|
|
64
|
-
assert.equal('5.1.2', this.todo.rcpt_to[0].dsn_status, 'get_mx=DENY dsn status = 5.1.2')
|
|
63
|
+
assert.equal('5.1.2', this.todo.rcpt_to[0].dsn_status, 'get_mx=DENY dsn status = 5.1.2')
|
|
65
64
|
done()
|
|
66
|
-
}
|
|
67
|
-
mock_hmail.domain = mock_hmail.todo.domain
|
|
68
|
-
HMailItem.prototype.get_mx_respond.apply(mock_hmail, [constants.deny, {}])
|
|
69
|
-
HMailItem.prototype.bounce = orig_bounce
|
|
65
|
+
}
|
|
66
|
+
mock_hmail.domain = mock_hmail.todo.domain
|
|
67
|
+
HMailItem.prototype.get_mx_respond.apply(mock_hmail, [constants.deny, {}])
|
|
68
|
+
HMailItem.prototype.bounce = orig_bounce
|
|
70
69
|
})
|
|
71
70
|
})
|
|
72
71
|
|
|
73
72
|
it('test get-mx-denysoft triggers temp_fail(...)', (done) => {
|
|
74
|
-
util_hmailitem.newMockHMailItem(outbound_context, done, {}, mock_hmail => {
|
|
75
|
-
const orig_temp_fail = HMailItem.prototype.temp_fail
|
|
73
|
+
util_hmailitem.newMockHMailItem(outbound_context, done, {}, (mock_hmail) => {
|
|
74
|
+
const orig_temp_fail = HMailItem.prototype.temp_fail
|
|
76
75
|
HMailItem.prototype.temp_fail = function (err, opts) {
|
|
77
|
-
assert.ok(true, 'get_mx-DENYSOFT: temp_fail function called')
|
|
76
|
+
assert.ok(true, 'get_mx-DENYSOFT: temp_fail function called')
|
|
78
77
|
/*dsn_code: 450,
|
|
79
78
|
dsn_status: '4.1.2',
|
|
80
79
|
dsn_action: 'delayed' */
|
|
81
|
-
assert.equal('4.1.2', this.todo.rcpt_to[0].dsn_status, 'get_mx=DENYSOFT dsn status = 4.1.2')
|
|
80
|
+
assert.equal('4.1.2', this.todo.rcpt_to[0].dsn_status, 'get_mx=DENYSOFT dsn status = 4.1.2')
|
|
82
81
|
done()
|
|
83
|
-
}
|
|
84
|
-
mock_hmail.domain = mock_hmail.todo.domain
|
|
85
|
-
HMailItem.prototype.get_mx_respond.apply(mock_hmail, [constants.denysoft, {}])
|
|
86
|
-
HMailItem.prototype.temp_fail = orig_temp_fail
|
|
82
|
+
}
|
|
83
|
+
mock_hmail.domain = mock_hmail.todo.domain
|
|
84
|
+
HMailItem.prototype.get_mx_respond.apply(mock_hmail, [constants.denysoft, {}])
|
|
85
|
+
HMailItem.prototype.temp_fail = orig_temp_fail
|
|
87
86
|
})
|
|
88
87
|
})
|
|
89
88
|
|
|
90
89
|
it('test found_mx({code:dns.NXDOMAIN}) triggers bounce(...)', (done) => {
|
|
91
|
-
util_hmailitem.newMockHMailItem(outbound_context, done, {}, mock_hmail => {
|
|
92
|
-
const orig_bounce = HMailItem.prototype.bounce
|
|
90
|
+
util_hmailitem.newMockHMailItem(outbound_context, done, {}, (mock_hmail) => {
|
|
91
|
+
const orig_bounce = HMailItem.prototype.bounce
|
|
93
92
|
HMailItem.prototype.bounce = function (err, opts) {
|
|
94
|
-
assert.ok(true, 'get_mx_error({code: dns.NXDOMAIN}): bounce function called')
|
|
95
|
-
assert.equal(
|
|
93
|
+
assert.ok(true, 'get_mx_error({code: dns.NXDOMAIN}): bounce function called')
|
|
94
|
+
assert.equal(
|
|
95
|
+
'5.1.2',
|
|
96
|
+
this.todo.rcpt_to[0].dsn_status,
|
|
97
|
+
'get_mx_error({code: dns.NXDOMAIN}: dsn status = 5.1.2',
|
|
98
|
+
)
|
|
96
99
|
done()
|
|
97
|
-
}
|
|
98
|
-
HMailItem.prototype.get_mx_error.apply(mock_hmail, [{code: dns.NXDOMAIN}])
|
|
99
|
-
HMailItem.prototype.bounce = orig_bounce
|
|
100
|
-
})
|
|
100
|
+
}
|
|
101
|
+
HMailItem.prototype.get_mx_error.apply(mock_hmail, [{ code: dns.NXDOMAIN }])
|
|
102
|
+
HMailItem.prototype.bounce = orig_bounce
|
|
103
|
+
})
|
|
101
104
|
})
|
|
102
105
|
|
|
103
|
-
it(
|
|
104
|
-
util_hmailitem.newMockHMailItem(outbound_context, done, {}, mock_hmail => {
|
|
105
|
-
const orig_temp_fail = HMailItem.prototype.temp_fail
|
|
106
|
+
it("test get_mx_error({code:'SOME-OTHER-ERR'}) triggers temp_fail(...)", (done) => {
|
|
107
|
+
util_hmailitem.newMockHMailItem(outbound_context, done, {}, (mock_hmail) => {
|
|
108
|
+
const orig_temp_fail = HMailItem.prototype.temp_fail
|
|
106
109
|
HMailItem.prototype.temp_fail = function (err, opts) {
|
|
107
|
-
assert.ok(true, 'get_mx_error({code: "SOME-OTHER-ERR"}): temp_fail function called')
|
|
108
|
-
assert.equal(
|
|
110
|
+
assert.ok(true, 'get_mx_error({code: "SOME-OTHER-ERR"}): temp_fail function called')
|
|
111
|
+
assert.equal(
|
|
112
|
+
'4.1.0',
|
|
113
|
+
this.todo.rcpt_to[0].dsn_status,
|
|
114
|
+
'get_mx_error({code: "SOME-OTHER-ERR"}: dsn status = 4.1.0',
|
|
115
|
+
)
|
|
109
116
|
done()
|
|
110
|
-
}
|
|
111
|
-
HMailItem.prototype.get_mx_error.apply(mock_hmail, [{code: 'SOME-OTHER-ERR'}, {}])
|
|
112
|
-
HMailItem.prototype.temp_fail = orig_temp_fail
|
|
113
|
-
})
|
|
117
|
+
}
|
|
118
|
+
HMailItem.prototype.get_mx_error.apply(mock_hmail, [{ code: 'SOME-OTHER-ERR' }, {}])
|
|
119
|
+
HMailItem.prototype.temp_fail = orig_temp_fail
|
|
120
|
+
})
|
|
114
121
|
})
|
|
115
122
|
|
|
116
|
-
it(
|
|
117
|
-
util_hmailitem.newMockHMailItem(outbound_context, done, {}, mock_hmail => {
|
|
118
|
-
const orig_bounce = HMailItem.prototype.bounce
|
|
123
|
+
it("test found_mx(null, [{priority:0,exchange:''}]) triggers bounce(...)", (done) => {
|
|
124
|
+
util_hmailitem.newMockHMailItem(outbound_context, done, {}, (mock_hmail) => {
|
|
125
|
+
const orig_bounce = HMailItem.prototype.bounce
|
|
119
126
|
HMailItem.prototype.bounce = function (err, opts) {
|
|
120
|
-
assert.ok(true, 'found_mx(null, [{priority:0,exchange:""}]): bounce function called')
|
|
121
|
-
assert.equal(
|
|
127
|
+
assert.ok(true, 'found_mx(null, [{priority:0,exchange:""}]): bounce function called')
|
|
128
|
+
assert.equal(
|
|
129
|
+
'5.1.2',
|
|
130
|
+
this.todo.rcpt_to[0].dsn_status,
|
|
131
|
+
'found_mx(null, [{priority:0,exchange:""}]): dsn status = 5.1.2',
|
|
132
|
+
)
|
|
122
133
|
done()
|
|
123
|
-
}
|
|
124
|
-
HMailItem.prototype.found_mx.apply(mock_hmail, [[{priority:0,exchange:''}]])
|
|
125
|
-
HMailItem.prototype.bounce = orig_bounce
|
|
126
|
-
})
|
|
134
|
+
}
|
|
135
|
+
HMailItem.prototype.found_mx.apply(mock_hmail, [[{ priority: 0, exchange: '' }]])
|
|
136
|
+
HMailItem.prototype.bounce = orig_bounce
|
|
137
|
+
})
|
|
127
138
|
})
|
|
128
139
|
|
|
129
140
|
it('test try_deliver while hmail.mxlist=[] triggers bounce(...)', (done) => {
|
|
130
|
-
util_hmailitem.newMockHMailItem(outbound_context, done, {}, mock_hmail => {
|
|
131
|
-
mock_hmail.mxlist = []
|
|
132
|
-
const orig_temp_fail = HMailItem.prototype.temp_fail
|
|
141
|
+
util_hmailitem.newMockHMailItem(outbound_context, done, {}, (mock_hmail) => {
|
|
142
|
+
mock_hmail.mxlist = []
|
|
143
|
+
const orig_temp_fail = HMailItem.prototype.temp_fail
|
|
133
144
|
HMailItem.prototype.temp_fail = function (err, opts) {
|
|
134
|
-
assert.ok(true, 'try_deliver while hmail.mxlist=[]: temp_fail function called')
|
|
135
|
-
assert.equal(
|
|
145
|
+
assert.ok(true, 'try_deliver while hmail.mxlist=[]: temp_fail function called')
|
|
146
|
+
assert.equal(
|
|
147
|
+
'5.1.2',
|
|
148
|
+
this.todo.rcpt_to[0].dsn_status,
|
|
149
|
+
'try_deliver while hmail.mxlist=[]: dsn status = 5.1.2',
|
|
150
|
+
)
|
|
136
151
|
done()
|
|
137
|
-
}
|
|
138
|
-
HMailItem.prototype.try_deliver.apply(mock_hmail, [])
|
|
139
|
-
HMailItem.prototype.temp_fail = orig_temp_fail
|
|
140
|
-
})
|
|
152
|
+
}
|
|
153
|
+
HMailItem.prototype.try_deliver.apply(mock_hmail, [])
|
|
154
|
+
HMailItem.prototype.temp_fail = orig_temp_fail
|
|
155
|
+
})
|
|
141
156
|
})
|
|
142
157
|
})
|