Haraka 3.1.0 → 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 +69 -50
- package/Plugins.md +3 -1
- package/README.md +1 -1
- package/bin/haraka +475 -478
- 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 +34 -27
- 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 +38 -33
- 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,133 +1,131 @@
|
|
|
1
|
-
'use strict'
|
|
1
|
+
'use strict'
|
|
2
2
|
// Proxy to an SMTP server
|
|
3
3
|
// Opens the connection to the ongoing SMTP server at MAIL FROM time
|
|
4
4
|
// and passes back any errors seen on the ongoing server to the
|
|
5
5
|
// originating server.
|
|
6
6
|
|
|
7
|
-
const smtp_client_mod = require('./smtp_client')
|
|
7
|
+
const smtp_client_mod = require('./smtp_client')
|
|
8
8
|
|
|
9
9
|
exports.register = function () {
|
|
10
|
-
|
|
11
|
-
this.load_smtp_proxy_ini();
|
|
10
|
+
this.load_smtp_proxy_ini()
|
|
12
11
|
|
|
13
12
|
if (this.cfg.main.enable_outbound) {
|
|
14
|
-
this.register_hook('queue_outbound', 'hook_queue')
|
|
13
|
+
this.register_hook('queue_outbound', 'hook_queue')
|
|
15
14
|
}
|
|
16
15
|
}
|
|
17
16
|
|
|
18
17
|
exports.load_smtp_proxy_ini = function () {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
'-main.enable_tls',
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
});
|
|
18
|
+
this.cfg = this.config.get(
|
|
19
|
+
'smtp_proxy.ini',
|
|
20
|
+
{
|
|
21
|
+
booleans: ['-main.enable_tls', '+main.enable_outbound'],
|
|
22
|
+
},
|
|
23
|
+
() => {
|
|
24
|
+
this.load_smtp_proxy_ini()
|
|
25
|
+
},
|
|
26
|
+
)
|
|
29
27
|
|
|
30
28
|
if (this.cfg.main.enable_outbound) {
|
|
31
|
-
this.lognotice('outbound enabled, will default to disabled in Haraka v3 (see #1472)')
|
|
29
|
+
this.lognotice('outbound enabled, will default to disabled in Haraka v3 (see #1472)')
|
|
32
30
|
}
|
|
33
31
|
}
|
|
34
32
|
|
|
35
33
|
exports.hook_mail = function (next, connection, params) {
|
|
36
|
-
const c = this.cfg.main
|
|
37
|
-
connection.loginfo(
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
const c = this.cfg.main
|
|
35
|
+
connection.loginfo(
|
|
36
|
+
this,
|
|
37
|
+
`forwarding to ${c.forwarding_host_pool ? 'configured forwarding_host_pool' : `${c.host}:${c.port}`}`,
|
|
38
|
+
)
|
|
40
39
|
smtp_client_mod.get_client_plugin(this, connection, c, (err, smtp_client) => {
|
|
41
|
-
connection.notes.smtp_client = smtp_client
|
|
42
|
-
smtp_client.next = next
|
|
40
|
+
connection.notes.smtp_client = smtp_client
|
|
41
|
+
smtp_client.next = next
|
|
43
42
|
|
|
44
|
-
smtp_client.on('mail', smtp_client.call_next)
|
|
45
|
-
smtp_client.on('rcpt', smtp_client.call_next)
|
|
46
|
-
smtp_client.on('data', smtp_client.call_next)
|
|
43
|
+
smtp_client.on('mail', smtp_client.call_next)
|
|
44
|
+
smtp_client.on('rcpt', smtp_client.call_next)
|
|
45
|
+
smtp_client.on('data', smtp_client.call_next)
|
|
47
46
|
|
|
48
47
|
smtp_client.on('dot', () => {
|
|
49
48
|
if (smtp_client.is_dead_sender(this, connection)) {
|
|
50
|
-
delete connection.notes.smtp_client
|
|
51
|
-
return
|
|
49
|
+
delete connection.notes.smtp_client
|
|
50
|
+
return
|
|
52
51
|
}
|
|
53
52
|
|
|
54
|
-
smtp_client.call_next(OK, smtp_client.response)
|
|
55
|
-
smtp_client.release()
|
|
56
|
-
delete connection.notes.smtp_client
|
|
57
|
-
})
|
|
53
|
+
smtp_client.call_next(OK, smtp_client.response)
|
|
54
|
+
smtp_client.release()
|
|
55
|
+
delete connection.notes.smtp_client
|
|
56
|
+
})
|
|
58
57
|
|
|
59
58
|
smtp_client.on('error', () => {
|
|
60
|
-
delete connection.notes.smtp_client
|
|
61
|
-
})
|
|
59
|
+
delete connection.notes.smtp_client
|
|
60
|
+
})
|
|
62
61
|
|
|
63
62
|
smtp_client.on('bad_code', (code, msg) => {
|
|
64
|
-
smtp_client.call_next(code.match(/^4/) ? DENYSOFT : DENY,
|
|
65
|
-
smtp_client.response.slice());
|
|
63
|
+
smtp_client.call_next(code.match(/^4/) ? DENYSOFT : DENY, smtp_client.response.slice())
|
|
66
64
|
|
|
67
65
|
if (smtp_client.command !== 'rcpt') {
|
|
68
66
|
// errors are OK for rcpt, but nothing else
|
|
69
67
|
// this can also happen if the destination server
|
|
70
68
|
// times out, but that is okay.
|
|
71
|
-
connection.loginfo(this,
|
|
72
|
-
smtp_client.release()
|
|
73
|
-
delete connection.notes.smtp_client
|
|
69
|
+
connection.loginfo(this, 'message denied, proxying failed')
|
|
70
|
+
smtp_client.release()
|
|
71
|
+
delete connection.notes.smtp_client
|
|
74
72
|
}
|
|
75
|
-
})
|
|
76
|
-
})
|
|
73
|
+
})
|
|
74
|
+
})
|
|
77
75
|
}
|
|
78
76
|
|
|
79
77
|
exports.hook_rcpt_ok = (next, connection, recipient) => {
|
|
80
|
-
const { smtp_client } = connection.notes
|
|
81
|
-
if (!smtp_client) return next()
|
|
78
|
+
const { smtp_client } = connection.notes
|
|
79
|
+
if (!smtp_client) return next()
|
|
82
80
|
if (smtp_client.is_dead_sender(this, connection)) {
|
|
83
|
-
delete connection.notes.smtp_client
|
|
84
|
-
return
|
|
81
|
+
delete connection.notes.smtp_client
|
|
82
|
+
return
|
|
85
83
|
}
|
|
86
|
-
smtp_client.next = next
|
|
87
|
-
smtp_client.send_command('RCPT', `TO:${recipient.format(!smtp_client.smtp_utf8)}`)
|
|
84
|
+
smtp_client.next = next
|
|
85
|
+
smtp_client.send_command('RCPT', `TO:${recipient.format(!smtp_client.smtp_utf8)}`)
|
|
88
86
|
}
|
|
89
87
|
|
|
90
88
|
exports.hook_data = (next, connection) => {
|
|
91
|
-
const { smtp_client } = connection.notes
|
|
92
|
-
if (!smtp_client) return next()
|
|
89
|
+
const { smtp_client } = connection.notes
|
|
90
|
+
if (!smtp_client) return next()
|
|
93
91
|
|
|
94
92
|
if (smtp_client.is_dead_sender(this, connection)) {
|
|
95
|
-
delete connection.notes.smtp_client
|
|
96
|
-
return
|
|
93
|
+
delete connection.notes.smtp_client
|
|
94
|
+
return
|
|
97
95
|
}
|
|
98
|
-
smtp_client.next = next
|
|
99
|
-
smtp_client.send_command(
|
|
96
|
+
smtp_client.next = next
|
|
97
|
+
smtp_client.send_command('DATA')
|
|
100
98
|
}
|
|
101
99
|
|
|
102
100
|
exports.hook_queue = function (next, connection) {
|
|
103
|
-
if (!connection?.transaction || !connection?.notes) return next()
|
|
101
|
+
if (!connection?.transaction || !connection?.notes) return next()
|
|
104
102
|
|
|
105
|
-
const { smtp_client } = connection.notes
|
|
106
|
-
if (!smtp_client) return next()
|
|
103
|
+
const { smtp_client } = connection.notes
|
|
104
|
+
if (!smtp_client) return next()
|
|
107
105
|
|
|
108
106
|
if (smtp_client.is_dead_sender(this, connection)) {
|
|
109
|
-
delete connection.notes.smtp_client
|
|
110
|
-
return
|
|
107
|
+
delete connection.notes.smtp_client
|
|
108
|
+
return
|
|
111
109
|
}
|
|
112
|
-
smtp_client.next = next
|
|
113
|
-
smtp_client.start_data(connection.transaction.message_stream)
|
|
110
|
+
smtp_client.next = next
|
|
111
|
+
smtp_client.start_data(connection.transaction.message_stream)
|
|
114
112
|
}
|
|
115
113
|
|
|
116
114
|
exports.hook_rset = (next, connection) => {
|
|
117
|
-
const { smtp_client } = connection.notes
|
|
118
|
-
if (!smtp_client) return next()
|
|
119
|
-
smtp_client.release()
|
|
120
|
-
delete connection.notes.smtp_client
|
|
121
|
-
next()
|
|
115
|
+
const { smtp_client } = connection.notes
|
|
116
|
+
if (!smtp_client) return next()
|
|
117
|
+
smtp_client.release()
|
|
118
|
+
delete connection.notes.smtp_client
|
|
119
|
+
next()
|
|
122
120
|
}
|
|
123
121
|
|
|
124
|
-
exports.hook_quit = exports.hook_rset
|
|
122
|
+
exports.hook_quit = exports.hook_rset
|
|
125
123
|
|
|
126
124
|
exports.hook_disconnect = (next, connection) => {
|
|
127
|
-
const { smtp_client } = connection.notes
|
|
128
|
-
if (!smtp_client) return next()
|
|
129
|
-
smtp_client.release()
|
|
130
|
-
delete connection.notes.smtp_client
|
|
131
|
-
smtp_client.call_next()
|
|
132
|
-
next()
|
|
125
|
+
const { smtp_client } = connection.notes
|
|
126
|
+
if (!smtp_client) return next()
|
|
127
|
+
smtp_client.release()
|
|
128
|
+
delete connection.notes.smtp_client
|
|
129
|
+
smtp_client.call_next()
|
|
130
|
+
next()
|
|
133
131
|
}
|
package/plugins/queue/test.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
const fs = require('node:fs')
|
|
2
|
-
const os = require('node:os')
|
|
1
|
+
const fs = require('node:fs')
|
|
2
|
+
const os = require('node:os')
|
|
3
3
|
|
|
4
|
-
const tempDir = os.tmpdir()
|
|
4
|
+
const tempDir = os.tmpdir()
|
|
5
5
|
|
|
6
6
|
exports.hook_queue = function (next, connection) {
|
|
7
|
-
const txn = connection?.transaction
|
|
8
|
-
if (!txn) return next()
|
|
7
|
+
const txn = connection?.transaction
|
|
8
|
+
if (!txn) return next()
|
|
9
9
|
|
|
10
10
|
const file_path = `${tempDir}/mail_${txn.uuid}.eml`
|
|
11
|
-
const ws = fs.createWriteStream(file_path)
|
|
12
|
-
connection.logdebug(this, `Saving to ${file_path}`)
|
|
13
|
-
ws.once('close', () => next(OK))
|
|
14
|
-
connection.transaction.message_stream.pipe(ws)
|
|
11
|
+
const ws = fs.createWriteStream(file_path)
|
|
12
|
+
connection.logdebug(this, `Saving to ${file_path}`)
|
|
13
|
+
ws.once('close', () => next(OK))
|
|
14
|
+
connection.transaction.message_stream.pipe(ws)
|
|
15
15
|
}
|
|
@@ -1,69 +1,65 @@
|
|
|
1
|
-
'use strict'
|
|
1
|
+
'use strict'
|
|
2
2
|
// Base class for plugins that use config/host_list
|
|
3
3
|
|
|
4
4
|
exports.load_host_list = function () {
|
|
5
|
-
|
|
6
|
-
const lowered_list = {}; // assemble
|
|
5
|
+
const lowered_list = {} // assemble
|
|
7
6
|
const raw_list = this.config.get('host_list', 'list', () => {
|
|
8
|
-
this.load_host_list()
|
|
9
|
-
})
|
|
7
|
+
this.load_host_list()
|
|
8
|
+
})
|
|
10
9
|
|
|
11
10
|
for (const i in raw_list) {
|
|
12
|
-
lowered_list[raw_list[i].toLowerCase()] = true
|
|
11
|
+
lowered_list[raw_list[i].toLowerCase()] = true
|
|
13
12
|
}
|
|
14
13
|
|
|
15
|
-
this.host_list = lowered_list
|
|
14
|
+
this.host_list = lowered_list
|
|
16
15
|
}
|
|
17
16
|
|
|
18
17
|
exports.load_host_list_regex = function () {
|
|
18
|
+
this.host_list_regex = this.config.get('host_list_regex', 'list', () => {
|
|
19
|
+
this.load_host_list_regex()
|
|
20
|
+
})
|
|
19
21
|
|
|
20
|
-
this.
|
|
21
|
-
'host_list_regex',
|
|
22
|
-
'list',
|
|
23
|
-
() => { this.load_host_list_regex(); }
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
this.hl_re = new RegExp (`^(?:${this.host_list_regex.join('|')})$`, 'i');
|
|
22
|
+
this.hl_re = new RegExp(`^(?:${this.host_list_regex.join('|')})$`, 'i')
|
|
27
23
|
}
|
|
28
24
|
|
|
29
25
|
exports.hook_mail = function (next, connection, params) {
|
|
30
|
-
const txn = connection?.transaction
|
|
31
|
-
if (!txn) return
|
|
26
|
+
const txn = connection?.transaction
|
|
27
|
+
if (!txn) return
|
|
32
28
|
|
|
33
|
-
const email = params[0].address()
|
|
29
|
+
const email = params[0].address()
|
|
34
30
|
if (!email) {
|
|
35
|
-
txn.results.add(this, {skip: 'mail_from.null', emit: true})
|
|
36
|
-
return next()
|
|
31
|
+
txn.results.add(this, { skip: 'mail_from.null', emit: true })
|
|
32
|
+
return next()
|
|
37
33
|
}
|
|
38
34
|
|
|
39
|
-
const domain = params[0].host.toLowerCase()
|
|
35
|
+
const domain = params[0].host.toLowerCase()
|
|
40
36
|
|
|
41
|
-
const anti_spoof = this.config.get('host_list.anti_spoof') || false
|
|
37
|
+
const anti_spoof = this.config.get('host_list.anti_spoof') || false
|
|
42
38
|
|
|
43
39
|
if (this.in_host_list(domain, connection) || this.in_host_regex(domain, connection)) {
|
|
44
40
|
if (anti_spoof && !connection.relaying) {
|
|
45
|
-
txn.results.add(this, {fail: 'mail_from.anti_spoof'})
|
|
46
|
-
return next(DENY, `Mail from domain '${domain}' is not allowed from your host`)
|
|
41
|
+
txn.results.add(this, { fail: 'mail_from.anti_spoof' })
|
|
42
|
+
return next(DENY, `Mail from domain '${domain}' is not allowed from your host`)
|
|
47
43
|
}
|
|
48
|
-
txn.results.add(this, {pass: 'mail_from'})
|
|
49
|
-
txn.notes.local_sender = true
|
|
50
|
-
return next()
|
|
44
|
+
txn.results.add(this, { pass: 'mail_from' })
|
|
45
|
+
txn.notes.local_sender = true
|
|
46
|
+
return next()
|
|
51
47
|
}
|
|
52
48
|
|
|
53
|
-
txn.results.add(this, {msg: 'mail_from!local'})
|
|
54
|
-
return next()
|
|
49
|
+
txn.results.add(this, { msg: 'mail_from!local' })
|
|
50
|
+
return next()
|
|
55
51
|
}
|
|
56
52
|
|
|
57
53
|
exports.in_host_list = function (domain, connection) {
|
|
58
|
-
this.logdebug(connection, `checking ${domain} in config/host_list`)
|
|
59
|
-
return !!
|
|
54
|
+
this.logdebug(connection, `checking ${domain} in config/host_list`)
|
|
55
|
+
return !!this.host_list[domain]
|
|
60
56
|
}
|
|
61
57
|
|
|
62
58
|
exports.in_host_regex = function (domain, connection) {
|
|
63
|
-
if (!this.host_list_regex) return false
|
|
64
|
-
if (!this.host_list_regex.length) return false
|
|
59
|
+
if (!this.host_list_regex) return false
|
|
60
|
+
if (!this.host_list_regex.length) return false
|
|
65
61
|
|
|
66
|
-
this.logdebug(connection, `checking ${domain} against config/host_list_regex `)
|
|
62
|
+
this.logdebug(connection, `checking ${domain} against config/host_list_regex `)
|
|
67
63
|
|
|
68
|
-
return !!
|
|
64
|
+
return !!this.hl_re.test(domain)
|
|
69
65
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict'
|
|
1
|
+
'use strict'
|
|
2
2
|
// Check RCPT TO domain is in config/host_list
|
|
3
3
|
|
|
4
4
|
// Previous versions of this plugin (Haraka <= 2.4.0) did not account for
|
|
@@ -10,47 +10,47 @@
|
|
|
10
10
|
// is enabled and the sending domain is local, the receipt is OK.
|
|
11
11
|
|
|
12
12
|
exports.register = function () {
|
|
13
|
-
this.inherits('rcpt_to.host_list_base')
|
|
13
|
+
this.inherits('rcpt_to.host_list_base')
|
|
14
14
|
|
|
15
|
-
this.load_host_list()
|
|
16
|
-
this.load_host_list_regex()
|
|
15
|
+
this.load_host_list()
|
|
16
|
+
this.load_host_list_regex()
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
exports.hook_rcpt = function (next, connection, params) {
|
|
20
|
-
const txn = connection?.transaction
|
|
21
|
-
if (!txn) return
|
|
20
|
+
const txn = connection?.transaction
|
|
21
|
+
if (!txn) return
|
|
22
22
|
|
|
23
|
-
const rcpt = params[0]
|
|
23
|
+
const rcpt = params[0]
|
|
24
24
|
|
|
25
25
|
// Check for RCPT TO without an @ first - ignore those here
|
|
26
26
|
if (!rcpt.host) {
|
|
27
|
-
txn.results.add(this, {fail: 'rcpt!domain'})
|
|
28
|
-
return next()
|
|
27
|
+
txn.results.add(this, { fail: 'rcpt!domain' })
|
|
28
|
+
return next()
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
connection.logdebug(this, `Checking if ${rcpt} host is in host_list`)
|
|
31
|
+
connection.logdebug(this, `Checking if ${rcpt} host is in host_list`)
|
|
32
32
|
|
|
33
|
-
const domain = rcpt.host.toLowerCase()
|
|
33
|
+
const domain = rcpt.host.toLowerCase()
|
|
34
34
|
|
|
35
35
|
if (this.in_host_list(domain, connection)) {
|
|
36
|
-
txn.results.add(this, {pass: 'rcpt_to'})
|
|
37
|
-
return next(OK)
|
|
36
|
+
txn.results.add(this, { pass: 'rcpt_to' })
|
|
37
|
+
return next(OK)
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
if (this.in_host_regex(domain, connection)) {
|
|
41
|
-
txn.results.add(this, {pass: 'rcpt_to'})
|
|
42
|
-
return next(OK)
|
|
41
|
+
txn.results.add(this, { pass: 'rcpt_to' })
|
|
42
|
+
return next(OK)
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
// in this case, a client with relaying privileges is sending FROM a local
|
|
46
46
|
// domain. For them, any RCPT address is accepted.
|
|
47
47
|
if (connection.relaying && txn.notes.local_sender) {
|
|
48
|
-
txn.results.add(this, {pass: 'relaying local_sender'})
|
|
49
|
-
return next(OK)
|
|
48
|
+
txn.results.add(this, { pass: 'relaying local_sender' })
|
|
49
|
+
return next(OK)
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
// the MAIL FROM domain is not local and neither is the RCPT TO
|
|
53
53
|
// Another RCPT plugin may yet vouch for this recipient.
|
|
54
|
-
txn.results.add(this, {msg: 'rcpt!local'})
|
|
55
|
-
return next()
|
|
54
|
+
txn.results.add(this, { msg: 'rcpt!local' })
|
|
55
|
+
return next()
|
|
56
56
|
}
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
exports.hook_rcpt = (next, connection, params) => {
|
|
6
6
|
if (connection?.transaction) {
|
|
7
|
-
connection.transaction.add_header('X-Envelope-To', params[0].address())
|
|
7
|
+
connection.transaction.add_header('X-Envelope-To', params[0].address())
|
|
8
8
|
}
|
|
9
|
-
next()
|
|
9
|
+
next()
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
exports.hook_mail = (next, connection, params) => {
|
|
13
13
|
if (connection?.transaction) {
|
|
14
|
-
connection.transaction.add_header('X-Envelope-From', params[0].address())
|
|
14
|
+
connection.transaction.add_header('X-Envelope-From', params[0].address())
|
|
15
15
|
}
|
|
16
|
-
next()
|
|
16
|
+
next()
|
|
17
17
|
}
|
package/plugins/reseed_rng.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const crypto = require('node:crypto')
|
|
1
|
+
const crypto = require('node:crypto')
|
|
2
2
|
|
|
3
3
|
exports.hook_init_child = function (next) {
|
|
4
|
-
Math.seedrandom(crypto.randomBytes(256).toString('hex'))
|
|
5
|
-
this.logdebug(
|
|
6
|
-
next()
|
|
4
|
+
Math.seedrandom(crypto.randomBytes(256).toString('hex'))
|
|
5
|
+
this.logdebug('reseeded rng')
|
|
6
|
+
next()
|
|
7
7
|
}
|