Haraka 3.0.5 → 3.1.1
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/CONTRIBUTORS.md +6 -5
- package/Changes.md +179 -27
- package/LICENSE +1 -1
- package/Plugins.md +3 -3
- package/bin/haraka +3 -1
- package/config/connection.ini +63 -0
- package/config/smtp.ini +0 -18
- package/connection.js +53 -63
- package/docs/CoreConfig.md +17 -78
- package/docs/HAProxy.md +10 -28
- package/docs/Outbound.md +8 -9
- package/docs/plugins/aliases.md +4 -6
- package/docs/plugins/block_me.md +2 -4
- package/docs/plugins/data.signatures.md +2 -4
- package/docs/plugins/max_unrecognized_commands.md +2 -4
- package/docs/plugins/prevent_credential_leaks.md +2 -5
- package/docs/plugins/process_title.md +1 -2
- package/docs/plugins/queue/test.md +9 -0
- package/docs/plugins/rcpt_to.in_host_list.md +1 -2
- package/docs/plugins/rcpt_to.max_count.md +2 -10
- package/docs/plugins/record_envelope_addresses.md +3 -6
- package/docs/plugins/relay.md +1 -155
- package/docs/plugins/reseed_rng.md +1 -2
- package/docs/plugins/tarpit.md +7 -10
- package/docs/plugins/toobusy.md +2 -4
- package/docs/plugins/xclient.md +1 -2
- package/eslint.config.mjs +27 -0
- package/logger.js +1 -8
- package/outbound/client_pool.js +8 -1
- package/outbound/hmail.js +8 -1
- package/package.json +61 -53
- package/plugins/auth/auth_base.js +0 -1
- package/plugins/queue/test.js +5 -3
- package/server.js +0 -14
- package/test/connection.js +18 -7
- package/.eslintrc.yaml +0 -11
- package/config/connection_close_message +0 -1
- package/config/databytes +0 -1
- package/config/dhparams.pem +0 -8
- package/config/early_talker.ini +0 -11
- package/config/mail_from.is_resolvable.ini +0 -6
- package/config/max_unrecognized_commands +0 -1
- package/config/smtp.json +0 -17
- package/docs/plugins/early_talker.md +0 -22
- package/docs/plugins/mail_from.is_resolvable.md +0 -29
- package/plugins/early_talker.js +0 -155
- package/plugins/mail_from.is_resolvable.js +0 -132
- package/plugins/relay.js +0 -207
- package/test/plugins/early_talker.js +0 -104
- package/test/plugins/mail_from.is_resolvable.js +0 -35
- package/test/plugins/relay.js +0 -303
- /package/docs/{plugins → deprecated}/access.md +0 -0
- /package/docs/{plugins → deprecated}/backscatterer.md +0 -0
- /package/docs/{plugins → deprecated}/data.headers.md +0 -0
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
const assert = require('node:assert')
|
|
3
|
-
const dns = require('node:dns');
|
|
4
|
-
|
|
5
|
-
const fixtures = require('haraka-test-fixtures');
|
|
6
|
-
const Address = require('address-rfc2821').Address
|
|
7
|
-
|
|
8
|
-
const _set_up = (done) => {
|
|
9
|
-
|
|
10
|
-
this.plugin = new fixtures.plugin('mail_from.is_resolvable');
|
|
11
|
-
this.plugin.register();
|
|
12
|
-
|
|
13
|
-
this.connection = fixtures.connection.createConnection();
|
|
14
|
-
this.connection.init_transaction()
|
|
15
|
-
|
|
16
|
-
done();
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
describe('mail_from.is_resolvable', () => {
|
|
20
|
-
beforeEach(_set_up)
|
|
21
|
-
|
|
22
|
-
describe('hook_mail', () => {
|
|
23
|
-
it('any.com, no err code', (done) => {
|
|
24
|
-
const txn = this.connection.transaction;
|
|
25
|
-
this.plugin.hook_mail((code, msg) => {
|
|
26
|
-
// console.log()
|
|
27
|
-
assert.deepEqual(txn.results.get('mail_from.is_resolvable').pass, ['has_fwd_dns']);
|
|
28
|
-
done();
|
|
29
|
-
},
|
|
30
|
-
this.connection,
|
|
31
|
-
[new Address('<test@any.com>')]
|
|
32
|
-
)
|
|
33
|
-
})
|
|
34
|
-
})
|
|
35
|
-
})
|
package/test/plugins/relay.js
DELETED
|
@@ -1,303 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
const assert = require('node:assert')
|
|
3
|
-
|
|
4
|
-
const fixtures = require('haraka-test-fixtures');
|
|
5
|
-
|
|
6
|
-
const _set_up = (done) => {
|
|
7
|
-
this.plugin = new fixtures.plugin('relay');
|
|
8
|
-
this.plugin.cfg = {};
|
|
9
|
-
this.connection = fixtures.connection.createConnection();
|
|
10
|
-
done();
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
describe('relay', () => {
|
|
14
|
-
describe('plugin', () => {
|
|
15
|
-
beforeEach(_set_up)
|
|
16
|
-
|
|
17
|
-
it('should have register function', () => {
|
|
18
|
-
assert.ok(this.plugin);
|
|
19
|
-
assert.equal('function', typeof this.plugin.register);
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
it('register function should call register_hook()', () => {
|
|
23
|
-
this.plugin.register();
|
|
24
|
-
assert.ok(this.plugin.register_hook.called);
|
|
25
|
-
})
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
describe('load_config_files', () => {
|
|
29
|
-
beforeEach(_set_up)
|
|
30
|
-
|
|
31
|
-
it('relay.ini', () => {
|
|
32
|
-
this.plugin.load_relay_ini();
|
|
33
|
-
assert.ok(typeof this.plugin.cfg === 'object');
|
|
34
|
-
assert.ok(this.plugin.cfg);
|
|
35
|
-
assert.ok(this.plugin.cfg.relay);
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
it('relay_dest_domains.ini', () => {
|
|
39
|
-
this.plugin.load_dest_domains();
|
|
40
|
-
assert.ok(typeof this.plugin.dest === 'object');
|
|
41
|
-
})
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
describe('is_acl_allowed', () => {
|
|
45
|
-
beforeEach(_set_up)
|
|
46
|
-
|
|
47
|
-
it('bare IP', () => {
|
|
48
|
-
this.plugin.acl_allow=['127.0.0.6'];
|
|
49
|
-
this.connection.remote.ip='127.0.0.6';
|
|
50
|
-
assert.equal(true, this.plugin.is_acl_allowed(this.connection));
|
|
51
|
-
this.connection.remote.ip='127.0.0.5';
|
|
52
|
-
assert.equal(false, this.plugin.is_acl_allowed(this.connection));
|
|
53
|
-
this.connection.remote.ip='127.0.1.5';
|
|
54
|
-
assert.equal(false, this.plugin.is_acl_allowed(this.connection));
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
it('netmask', () => {
|
|
58
|
-
this.plugin.acl_allow=['127.0.0.6/24'];
|
|
59
|
-
this.connection.remote.ip='127.0.0.6';
|
|
60
|
-
assert.equal(true, this.plugin.is_acl_allowed(this.connection));
|
|
61
|
-
this.connection.remote.ip='127.0.0.5';
|
|
62
|
-
assert.equal(true, this.plugin.is_acl_allowed(this.connection));
|
|
63
|
-
this.connection.remote.ip='127.0.1.5';
|
|
64
|
-
assert.equal(false, this.plugin.is_acl_allowed(this.connection));
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
it('mixed (ipv4 & ipv6 (Issue #428))', () => {
|
|
68
|
-
this.connection.remote.ip='2607:f060:b008:feed::2';
|
|
69
|
-
assert.equal(false, this.plugin.is_acl_allowed(this.connection));
|
|
70
|
-
|
|
71
|
-
this.plugin.acl_allow=['2607:f060:b008:feed::2/64'];
|
|
72
|
-
this.connection.remote.ip='2607:f060:b008:feed::2';
|
|
73
|
-
assert.equal(true, this.plugin.is_acl_allowed(this.connection));
|
|
74
|
-
|
|
75
|
-
this.plugin.acl_allow=['127.0.0.6/24'];
|
|
76
|
-
this.connection.remote.ip='2607:f060:b008:feed::2';
|
|
77
|
-
assert.equal(false, this.plugin.is_acl_allowed(this.connection));
|
|
78
|
-
})
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
describe('acl', () => {
|
|
82
|
-
beforeEach((done) => {
|
|
83
|
-
this.plugin = new fixtures.plugin('relay');
|
|
84
|
-
this.plugin.cfg = { relay: { dest_domains: true } };
|
|
85
|
-
this.connection = fixtures.connection.createConnection();
|
|
86
|
-
done();
|
|
87
|
-
})
|
|
88
|
-
|
|
89
|
-
it('relay.acl=false', (done) => {
|
|
90
|
-
this.plugin.cfg.relay.acl=false;
|
|
91
|
-
this.plugin.acl(() => {}, this.connection);
|
|
92
|
-
this.plugin.pass_relaying((rc) => {
|
|
93
|
-
assert.equal(undefined, rc);
|
|
94
|
-
done();
|
|
95
|
-
}, this.connection);
|
|
96
|
-
})
|
|
97
|
-
|
|
98
|
-
it('relay.acl=true, miss', (done) => {
|
|
99
|
-
this.plugin.cfg.relay.acl=true;
|
|
100
|
-
this.plugin.acl(() => {}, this.connection);
|
|
101
|
-
this.plugin.pass_relaying((rc) => {
|
|
102
|
-
assert.equal(undefined, rc);
|
|
103
|
-
assert.equal(false, this.connection.relaying);
|
|
104
|
-
done();
|
|
105
|
-
}, this.connection);
|
|
106
|
-
})
|
|
107
|
-
|
|
108
|
-
it('relay.acl=true, hit', (done) => {
|
|
109
|
-
this.plugin.cfg.relay.acl=true;
|
|
110
|
-
this.connection.remote.ip='1.1.1.1';
|
|
111
|
-
this.plugin.acl_allow=['1.1.1.1/32'];
|
|
112
|
-
this.plugin.acl(() => {}, this.connection);
|
|
113
|
-
this.plugin.pass_relaying((rc) => {
|
|
114
|
-
assert.equal(OK, rc);
|
|
115
|
-
assert.equal(true, this.connection.relaying);
|
|
116
|
-
done();
|
|
117
|
-
}, this.connection);
|
|
118
|
-
})
|
|
119
|
-
|
|
120
|
-
it('relay.acl=true, hit, missing mask', (done) => {
|
|
121
|
-
this.plugin.cfg.relay.acl=true;
|
|
122
|
-
this.connection.remote.ip='1.1.1.1';
|
|
123
|
-
this.plugin.acl_allow=['1.1.1.1'];
|
|
124
|
-
this.plugin.acl(() => {}, this.connection);
|
|
125
|
-
this.plugin.pass_relaying((rc) => {
|
|
126
|
-
assert.equal(OK, rc);
|
|
127
|
-
assert.equal(true, this.connection.relaying);
|
|
128
|
-
done();
|
|
129
|
-
}, this.connection);
|
|
130
|
-
})
|
|
131
|
-
|
|
132
|
-
it('relay.acl=true, hit, net', (done) => {
|
|
133
|
-
this.plugin.cfg.relay.acl=true;
|
|
134
|
-
this.connection.remote.ip='1.1.1.1';
|
|
135
|
-
this.plugin.acl_allow=['1.1.1.1/24'];
|
|
136
|
-
this.plugin.acl(() => {}, this.connection);
|
|
137
|
-
this.plugin.pass_relaying((rc) => {
|
|
138
|
-
assert.equal(OK, rc);
|
|
139
|
-
assert.equal(true, this.connection.relaying);
|
|
140
|
-
done();
|
|
141
|
-
}, this.connection);
|
|
142
|
-
})
|
|
143
|
-
})
|
|
144
|
-
|
|
145
|
-
describe('dest_domains', () => {
|
|
146
|
-
beforeEach((done) => {
|
|
147
|
-
this.plugin = new fixtures.plugin('relay');
|
|
148
|
-
this.plugin.cfg = { relay: { dest_domains: true } };
|
|
149
|
-
|
|
150
|
-
this.connection = fixtures.connection.createConnection();
|
|
151
|
-
this.connection.init_transaction();
|
|
152
|
-
|
|
153
|
-
done();
|
|
154
|
-
})
|
|
155
|
-
|
|
156
|
-
it('relay.dest_domains=false', (done) => {
|
|
157
|
-
this.plugin.cfg.relay.dest_domains=false;
|
|
158
|
-
this.plugin.dest_domains((rc) => {
|
|
159
|
-
assert.equal(undefined, rc);
|
|
160
|
-
done();
|
|
161
|
-
}, this.connection, [{host:'foo'}]);
|
|
162
|
-
})
|
|
163
|
-
|
|
164
|
-
it('relaying', (done) => {
|
|
165
|
-
this.connection.relaying=true;
|
|
166
|
-
this.plugin.dest_domains((rc) => {
|
|
167
|
-
assert.equal(undefined, rc);
|
|
168
|
-
assert.equal(1, this.connection.transaction.results.get('relay').skip.length);
|
|
169
|
-
done();
|
|
170
|
-
}, this.connection, [{host:'foo'}]);
|
|
171
|
-
})
|
|
172
|
-
|
|
173
|
-
it('no config', (done) => {
|
|
174
|
-
this.plugin.dest_domains((rc) => {
|
|
175
|
-
assert.equal(undefined, rc);
|
|
176
|
-
assert.equal(1, this.connection.transaction.results.get('relay').err.length);
|
|
177
|
-
done();
|
|
178
|
-
}, this.connection, [{host:'foo'}]);
|
|
179
|
-
})
|
|
180
|
-
|
|
181
|
-
it('action=undef', (done) => {
|
|
182
|
-
this.plugin.dest = { domains: { foo: '{"action":"dunno"}' } };
|
|
183
|
-
this.plugin.dest_domains((rc) => {
|
|
184
|
-
assert.equal(DENY, rc);
|
|
185
|
-
assert.equal(1, this.connection.transaction.results.get('relay').fail.length);
|
|
186
|
-
done();
|
|
187
|
-
}, this.connection, [{host:'foo'}]);
|
|
188
|
-
})
|
|
189
|
-
|
|
190
|
-
it('action=deny', (done) => {
|
|
191
|
-
this.plugin.dest = { domains: { foo: '{"action":"deny"}' } };
|
|
192
|
-
this.plugin.dest_domains((rc) => {
|
|
193
|
-
assert.equal(DENY, rc);
|
|
194
|
-
assert.equal(1, this.connection.transaction.results.get('relay').fail.length);
|
|
195
|
-
done();
|
|
196
|
-
}, this.connection, [{host:'foo'}]);
|
|
197
|
-
})
|
|
198
|
-
|
|
199
|
-
it('action=continue', (done) => {
|
|
200
|
-
this.plugin.dest = { domains: { foo: '{"action":"continue"}' } };
|
|
201
|
-
this.plugin.dest_domains((rc) => {
|
|
202
|
-
assert.equal(CONT, rc);
|
|
203
|
-
assert.equal(1, this.connection.transaction.results.get('relay').pass.length);
|
|
204
|
-
done();
|
|
205
|
-
}, this.connection, [{host:'foo'}]);
|
|
206
|
-
})
|
|
207
|
-
|
|
208
|
-
it('action=accept', (done) => {
|
|
209
|
-
this.plugin.dest = { domains: { foo: '{"action":"continue"}' } };
|
|
210
|
-
this.plugin.dest_domains((rc) => {
|
|
211
|
-
assert.equal(CONT, rc);
|
|
212
|
-
assert.equal(1, this.connection.transaction.results.get('relay').pass.length);
|
|
213
|
-
done();
|
|
214
|
-
}, this.connection, [{host:'foo'}]);
|
|
215
|
-
})
|
|
216
|
-
})
|
|
217
|
-
|
|
218
|
-
describe('force_routing', () => {
|
|
219
|
-
beforeEach((done) => {
|
|
220
|
-
this.plugin = new fixtures.plugin('relay');
|
|
221
|
-
this.plugin.cfg = { relay: { force_routing: true } };
|
|
222
|
-
this.plugin.dest = {};
|
|
223
|
-
|
|
224
|
-
this.connection = fixtures.connection.createConnection();
|
|
225
|
-
this.connection.init_transaction()
|
|
226
|
-
|
|
227
|
-
done();
|
|
228
|
-
})
|
|
229
|
-
|
|
230
|
-
it('relay.force_routing=false', (done) => {
|
|
231
|
-
this.plugin.cfg.relay.force_routing=false;
|
|
232
|
-
this.plugin.force_routing((rc) => {
|
|
233
|
-
assert.equal(undefined, rc);
|
|
234
|
-
done();
|
|
235
|
-
}, this.connection, 'foo');
|
|
236
|
-
})
|
|
237
|
-
|
|
238
|
-
it('dest_domains empty', (done) => {
|
|
239
|
-
this.plugin.force_routing((rc) => {
|
|
240
|
-
assert.equal(undefined, rc);
|
|
241
|
-
done();
|
|
242
|
-
}, this.connection, 'foo');
|
|
243
|
-
})
|
|
244
|
-
|
|
245
|
-
it('dest_domains, no route', (done) => {
|
|
246
|
-
this.plugin.dest = { domains: { foo: '{"action":"blah blah"}' } };
|
|
247
|
-
this.plugin.force_routing((rc, nexthop) => {
|
|
248
|
-
assert.equal(undefined, rc);
|
|
249
|
-
assert.equal(undefined, nexthop);
|
|
250
|
-
done();
|
|
251
|
-
}, this.connection, 'foo');
|
|
252
|
-
})
|
|
253
|
-
|
|
254
|
-
it('dest_domains, route', (done) => {
|
|
255
|
-
this.plugin.dest = { domains: { foo: '{"action":"blah blah","nexthop":"other-server"}' } };
|
|
256
|
-
this.plugin.force_routing((rc, nexthop) => {
|
|
257
|
-
assert.equal(OK, rc);
|
|
258
|
-
assert.equal('other-server', nexthop);
|
|
259
|
-
done();
|
|
260
|
-
}, this.connection, 'foo');
|
|
261
|
-
})
|
|
262
|
-
|
|
263
|
-
it('dest-domains, any', (done) => {
|
|
264
|
-
this.plugin.dest = { domains: { foo: '{"action":"blah blah","nexthop":"other-server"}',
|
|
265
|
-
any: '{"action":"blah blah","nexthop":"any-server"}'} };
|
|
266
|
-
this.plugin.force_routing((rc, nexthop) => {
|
|
267
|
-
assert.equal(OK, rc);
|
|
268
|
-
assert.equal('any-server', nexthop);
|
|
269
|
-
done();
|
|
270
|
-
}, this.connection, 'not');
|
|
271
|
-
})
|
|
272
|
-
})
|
|
273
|
-
|
|
274
|
-
describe('all', () => {
|
|
275
|
-
beforeEach(_set_up)
|
|
276
|
-
|
|
277
|
-
it('register_hook() should register available function', () => {
|
|
278
|
-
assert.ok(this.plugin.all);
|
|
279
|
-
assert.equal('function', typeof this.plugin.all);
|
|
280
|
-
this.plugin.register();
|
|
281
|
-
this.plugin.cfg.relay.all = true;
|
|
282
|
-
this.plugin.register_hook('rcpt', 'all'); // register() doesn't b/c config is disabled
|
|
283
|
-
// console.log(this.plugin.register_hook.args);
|
|
284
|
-
assert.equal(this.plugin.register_hook.args[3][1], 'all');
|
|
285
|
-
})
|
|
286
|
-
|
|
287
|
-
it('all hook always returns OK', (done) => {
|
|
288
|
-
this.plugin.cfg.relay = { all: true };
|
|
289
|
-
this.plugin.all((action) => {
|
|
290
|
-
assert.equal(action, OK);
|
|
291
|
-
done();
|
|
292
|
-
}, this.connection, ['foo@bar.com']);
|
|
293
|
-
})
|
|
294
|
-
|
|
295
|
-
it('all hook always sets connection.relaying to 1', (done) => {
|
|
296
|
-
this.plugin.cfg.relay = { all: true };
|
|
297
|
-
this.plugin.all((action) => {
|
|
298
|
-
assert.equal(this.connection.relaying, 1);
|
|
299
|
-
done();
|
|
300
|
-
}, this.connection, ['foo@bar.com']);
|
|
301
|
-
})
|
|
302
|
-
})
|
|
303
|
-
})
|
|
File without changes
|
|
File without changes
|
|
File without changes
|