Haraka 3.0.1 → 3.0.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/Changes.md +25 -0
- package/config/outbound.ini +1 -1
- package/connection.js +32 -10
- package/docs/plugins/clamd.md +1 -1
- package/docs/plugins/queue/smtp_forward.md +15 -37
- package/docs/plugins/queue/smtp_proxy.md +9 -11
- package/outbound/tls.js +1 -1
- package/package.json +13 -13
- package/plugins/dns_list_base.js +3 -3
- package/plugins/helo.checks.js +14 -6
- package/plugins/queue/smtp_forward.js +22 -16
- package/plugins/tls.js +1 -1
- 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/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
|
@@ -4,6 +4,7 @@ const path = require('path');
|
|
|
4
4
|
|
|
5
5
|
const { Address } = require('address-rfc2821');
|
|
6
6
|
const fixtures = require('haraka-test-fixtures');
|
|
7
|
+
const Notes = require('haraka-notes')
|
|
7
8
|
|
|
8
9
|
const OK = 906;
|
|
9
10
|
|
|
@@ -14,6 +15,7 @@ function _setup (done) {
|
|
|
14
15
|
this.plugin.config = this.plugin.config.module_config(path.resolve('tests'));
|
|
15
16
|
|
|
16
17
|
this.plugin.register();
|
|
18
|
+
this.hmail = { todo: { notes: new Notes() } };
|
|
17
19
|
|
|
18
20
|
this.connection = new fixtures.connection.createConnection();
|
|
19
21
|
this.connection.transaction = new fixtures.transaction.createTransaction();
|
|
@@ -131,21 +133,29 @@ exports.get_config = {
|
|
|
131
133
|
}
|
|
132
134
|
}
|
|
133
135
|
|
|
134
|
-
const hmail = { todo: { notes: {} } };
|
|
135
136
|
exports.get_mx = {
|
|
136
137
|
setUp : _setup,
|
|
137
138
|
'returns no outbound route for undefined domains' (test) {
|
|
138
139
|
test.expect(2);
|
|
139
|
-
|
|
140
|
+
this.plugin.get_mx((code, mx) => {
|
|
140
141
|
test.equal(code, undefined);
|
|
141
142
|
test.deepEqual(mx, undefined);
|
|
142
143
|
test.done();
|
|
143
|
-
}
|
|
144
|
-
|
|
144
|
+
}, this.hmail, 'undefined.com');
|
|
145
|
+
},
|
|
146
|
+
'returns no outbound route when queue.wants !== smtp_forward' (test) {
|
|
147
|
+
test.expect(2);
|
|
148
|
+
this.hmail.todo.notes.set('queue.wants', 'outbound')
|
|
149
|
+
this.hmail.todo.notes.set('queue.next_hop', 'smtp://5.4.3.2:26')
|
|
150
|
+
this.plugin.get_mx((code, mx) => {
|
|
151
|
+
test.equal(code, undefined);
|
|
152
|
+
test.deepEqual(mx, undefined);
|
|
153
|
+
test.done();
|
|
154
|
+
}, this.hmail, 'undefined.com');
|
|
145
155
|
},
|
|
146
156
|
'returns an outbound route for defined domains' (test) {
|
|
147
157
|
test.expect(2);
|
|
148
|
-
|
|
158
|
+
this.plugin.get_mx((code, mx) => {
|
|
149
159
|
test.equal(code, OK);
|
|
150
160
|
test.deepEqual(mx, {
|
|
151
161
|
priority: 0, exchange: '1.2.3.4', port: 2555,
|
|
@@ -153,8 +163,27 @@ exports.get_mx = {
|
|
|
153
163
|
auth_pass: 'superDuperSecret'
|
|
154
164
|
});
|
|
155
165
|
test.done();
|
|
156
|
-
}
|
|
157
|
-
|
|
166
|
+
}, this.hmail, 'test.com');
|
|
167
|
+
},
|
|
168
|
+
'is enabled when queue.wants is set' (test) {
|
|
169
|
+
test.expect(2);
|
|
170
|
+
this.hmail.todo.notes.set('queue.wants', 'smtp_forward')
|
|
171
|
+
this.hmail.todo.notes.set('queue.next_hop', 'smtp://4.3.2.1:465')
|
|
172
|
+
this.plugin.get_mx((code, mx) => {
|
|
173
|
+
test.equal(code, OK);
|
|
174
|
+
test.deepEqual(mx, { priority: 0, port: 465, exchange: '4.3.2.1' });
|
|
175
|
+
test.done();
|
|
176
|
+
}, this.hmail, 'undefined.com');
|
|
177
|
+
},
|
|
178
|
+
'sets using_lmtp when next_hop URL is lmtp' (test) {
|
|
179
|
+
test.expect(2);
|
|
180
|
+
this.hmail.todo.notes.set('queue.wants', 'smtp_forward')
|
|
181
|
+
this.hmail.todo.notes.set('queue.next_hop', 'lmtp://4.3.2.1')
|
|
182
|
+
this.plugin.get_mx((code, mx) => {
|
|
183
|
+
test.equal(code, OK);
|
|
184
|
+
test.deepEqual(mx, { priority: 0, port: 24, using_lmtp: true, exchange: '4.3.2.1' });
|
|
185
|
+
test.done();
|
|
186
|
+
}, this.hmail, 'undefined.com');
|
|
158
187
|
},
|
|
159
188
|
}
|
|
160
189
|
|