Haraka 3.0.2 → 3.0.4
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/.eslintrc.yaml +5 -9
- package/.prettierrc.yml +1 -0
- package/CONTRIBUTORS.md +11 -0
- package/Changes.md +1393 -1211
- package/Dockerfile +3 -3
- package/Plugins.md +119 -106
- package/README.md +7 -16
- package/TODO +1 -24
- package/bin/haraka +197 -298
- package/config/auth_flat_file.ini +2 -0
- package/config/auth_vpopmaild.ini +4 -2
- package/config/dhparams.pem +8 -0
- package/config/mail_from.is_resolvable.ini +4 -2
- package/config/me +1 -0
- package/config/outbound.ini +0 -2
- package/config/plugins +36 -35
- package/config/rabbitmq_amqplib.ini +8 -1
- package/config/smtp.ini +0 -1
- package/config/smtp.json +17 -0
- package/config/tls_cert.pem +23 -0
- package/config/tls_key.pem +28 -0
- package/connection.js +46 -73
- package/contrib/bsd-rc.d/haraka +3 -1
- package/contrib/plugin2npm.sh +6 -36
- package/docs/Connection.md +1 -1
- package/docs/CoreConfig.md +2 -2
- package/docs/Logging.md +7 -21
- package/docs/Outbound.md +104 -210
- package/docs/Plugins.md +47 -40
- package/docs/Transaction.md +59 -82
- package/docs/{plugins → deprecated}/connect.rdns_access.md +1 -1
- package/docs/{plugins → deprecated}/mail_from.access.md +1 -1
- package/docs/{plugins → deprecated}/rcpt_to.access.md +1 -1
- package/docs/plugins/auth/auth_vpopmaild.md +15 -19
- package/docs/plugins/auth/flat_file.md +23 -30
- package/docs/plugins/queue/rabbitmq_amqplib.md +7 -0
- package/docs/plugins/queue/smtp_forward.md +1 -1
- package/docs/plugins/queue/smtp_proxy.md +5 -10
- package/docs/plugins/relay.md +2 -2
- package/docs/plugins/tls.md +29 -9
- package/endpoint.js +16 -13
- package/haraka.js +10 -14
- package/host_pool.js +5 -5
- package/line_socket.js +3 -4
- package/logger.js +44 -28
- package/outbound/client_pool.js +27 -23
- package/outbound/config.js +4 -6
- package/outbound/fsync_writestream.js +1 -1
- package/outbound/hmail.js +180 -220
- package/outbound/index.js +86 -99
- package/outbound/qfile.js +1 -1
- package/outbound/queue.js +55 -43
- package/outbound/timer_queue.js +3 -2
- package/outbound/tls.js +19 -7
- package/package.json +66 -55
- package/plugins/.eslintrc.yaml +0 -6
- package/plugins/auth/auth_base.js +30 -12
- package/plugins/auth/auth_proxy.js +14 -12
- package/plugins/auth/auth_vpopmaild.js +30 -20
- package/plugins/auth/flat_file.js +17 -12
- package/plugins/block_me.js +1 -1
- package/plugins/data.signatures.js +2 -4
- package/plugins/early_talker.js +2 -1
- package/plugins/mail_from.is_resolvable.js +65 -135
- package/plugins/queue/deliver.js +4 -5
- package/plugins/queue/lmtp.js +11 -14
- package/plugins/queue/qmail-queue.js +2 -2
- package/plugins/queue/quarantine.js +2 -2
- package/plugins/queue/rabbitmq.js +16 -17
- package/plugins/queue/rabbitmq_amqplib.js +1 -1
- package/plugins/queue/smtp_forward.js +6 -6
- package/plugins/queue/smtp_proxy.js +10 -1
- package/plugins/queue/test.js +2 -2
- package/plugins/rcpt_to.host_list_base.js +5 -5
- package/plugins/rcpt_to.in_host_list.js +2 -2
- package/plugins/relay.js +6 -7
- package/plugins/reseed_rng.js +1 -1
- package/plugins/status.js +37 -33
- package/plugins/tls.js +2 -2
- package/plugins/xclient.js +3 -2
- package/plugins.js +51 -54
- package/run_tests +3 -30
- package/server.js +190 -190
- package/smtp_client.js +30 -23
- package/{tests → test}/config/plugins +0 -2
- package/{tests → test}/config/smtp.ini +1 -1
- package/test/config/tls/example.com/_.example.com.key +28 -0
- package/test/config/tls/example.com/example.com.crt +25 -0
- package/test/connection.js +302 -0
- package/test/endpoint.js +94 -0
- package/{tests → test}/fixtures/line_socket.js +1 -1
- package/{tests → test}/fixtures/util_hmailitem.js +19 -25
- package/{tests → test}/host_pool.js +42 -57
- package/test/logger.js +258 -0
- package/test/outbound/hmail.js +141 -0
- package/test/outbound/index.js +220 -0
- package/test/outbound/qfile.js +126 -0
- package/test/outbound_bounce_net_errors.js +142 -0
- package/{tests → test}/outbound_bounce_rfc3464.js +110 -122
- package/test/plugins/auth/auth_base.js +484 -0
- package/test/plugins/auth/auth_vpopmaild.js +83 -0
- package/test/plugins/early_talker.js +104 -0
- package/test/plugins/mail_from.is_resolvable.js +35 -0
- package/test/plugins/queue/smtp_forward.js +206 -0
- package/test/plugins/rcpt_to.host_list_base.js +122 -0
- package/test/plugins/rcpt_to.in_host_list.js +193 -0
- package/test/plugins/relay.js +303 -0
- package/test/plugins/status.js +130 -0
- package/test/plugins/tls.js +70 -0
- package/test/plugins.js +228 -0
- package/{tests → test}/queue/multibyte +0 -0
- package/{tests → test}/queue/plain +0 -0
- package/test/rfc1869.js +73 -0
- package/test/server.js +491 -0
- package/test/smtp_client.js +299 -0
- package/test/tls_socket.js +273 -0
- package/test/transaction.js +270 -0
- package/tls_socket.js +202 -252
- package/transaction.js +9 -24
- package/CONTRIBUTING.md +0 -1
- package/bin/dkimverify +0 -40
- package/config/access.domains +0 -13
- package/config/attachment.ctype.regex +0 -2
- package/config/attachment.filename.regex +0 -1
- package/config/avg.ini +0 -5
- package/config/bounce.ini +0 -15
- package/config/data.headers.ini +0 -61
- package/config/dkim/dkim_key_gen.sh +0 -78
- package/config/dkim_sign.ini +0 -4
- package/config/dkim_verify.ini +0 -7
- package/config/dnsbl.ini +0 -23
- package/config/greylist.ini +0 -43
- package/config/helo.checks.ini +0 -52
- package/config/lookup_rdns.strict.ini +0 -12
- package/config/lookup_rdns.strict.timeout +0 -1
- package/config/lookup_rdns.strict.whitelist +0 -1
- package/config/lookup_rdns.strict.whitelist_regex +0 -5
- package/config/messagesniffer.ini +0 -18
- package/config/rcpt_to.blocklist +0 -1
- package/config/rdns.allow_regexps +0 -0
- package/config/rdns.deny_regexps +0 -0
- package/config/spamassassin.ini +0 -56
- package/config.js +0 -6
- package/dkim.js +0 -614
- package/docs/plugins/avg.md +0 -35
- package/docs/plugins/bounce.md +0 -69
- package/docs/plugins/clamd.md +0 -147
- package/docs/plugins/esets.md +0 -8
- package/docs/plugins/greylist.md +0 -90
- package/docs/plugins/helo.checks.md +0 -135
- package/docs/plugins/messagesniffer.md +0 -163
- package/docs/plugins/relay_acl.md +0 -29
- package/docs/plugins/relay_all.md +0 -15
- package/docs/plugins/relay_force_routing.md +0 -33
- package/docs/plugins/spamassassin.md +0 -180
- package/outbound/mx_lookup.js +0 -70
- package/plugins/auth/auth_ldap.js +0 -3
- package/plugins/avg.js +0 -162
- package/plugins/backscatterer.js +0 -25
- package/plugins/bounce.js +0 -381
- package/plugins/clamd.js +0 -381
- package/plugins/data.headers.js +0 -4
- package/plugins/data.uribl.js +0 -4
- package/plugins/dkim_sign.js +0 -395
- package/plugins/dkim_verify.js +0 -62
- package/plugins/dns_list_base.js +0 -221
- package/plugins/dnsbl.js +0 -146
- package/plugins/dnswl.js +0 -58
- package/plugins/esets.js +0 -71
- package/plugins/graph.js +0 -5
- package/plugins/greylist.js +0 -645
- package/plugins/helo.checks.js +0 -533
- package/plugins/messagesniffer.js +0 -381
- package/plugins/rcpt_to.ldap.js +0 -3
- package/plugins/rcpt_to.max_count.js +0 -24
- package/plugins/relay_all.js +0 -13
- package/plugins/spamassassin.js +0 -384
- package/tests/config/dkim/example.com/dns +0 -29
- package/tests/config/dkim/example.com/private +0 -6
- package/tests/config/dkim/example.com/public +0 -4
- package/tests/config/dkim/example.com/selector +0 -1
- package/tests/config/dkim.private.key +0 -6
- package/tests/config/dkim_sign.ini +0 -4
- package/tests/config/helo.checks.ini +0 -52
- package/tests/connection.js +0 -327
- package/tests/endpoint.js +0 -128
- package/tests/fixtures/vm_harness.js +0 -59
- package/tests/logger.js +0 -327
- package/tests/outbound/hmail.js +0 -112
- package/tests/outbound/index.js +0 -324
- package/tests/outbound/qfile.js +0 -67
- package/tests/outbound_bounce_net_errors.js +0 -173
- package/tests/plugins/auth/auth_base.js +0 -463
- package/tests/plugins/auth/auth_vpopmaild.js +0 -91
- package/tests/plugins/bounce.js +0 -307
- package/tests/plugins/clamd.js +0 -224
- package/tests/plugins/deprecated/relay_acl.js +0 -140
- package/tests/plugins/deprecated/relay_all.js +0 -59
- package/tests/plugins/dkim_sign.js +0 -315
- package/tests/plugins/dkim_signer.js +0 -108
- package/tests/plugins/dns_list_base.js +0 -259
- package/tests/plugins/dnsbl.js +0 -101
- package/tests/plugins/early_talker.js +0 -115
- package/tests/plugins/greylist.js +0 -58
- package/tests/plugins/helo.checks.js +0 -525
- package/tests/plugins/mail_from.is_resolvable.js +0 -116
- package/tests/plugins/queue/smtp_forward.js +0 -221
- package/tests/plugins/rcpt_to.host_list_base.js +0 -132
- package/tests/plugins/rcpt_to.in_host_list.js +0 -218
- package/tests/plugins/relay.js +0 -339
- package/tests/plugins/spamassassin.js +0 -171
- package/tests/plugins/status.js +0 -138
- package/tests/plugins/tls.js +0 -84
- package/tests/plugins.js +0 -247
- package/tests/rfc1869.js +0 -61
- package/tests/server.js +0 -510
- package/tests/smtp_client/auth.js +0 -105
- package/tests/smtp_client/basic.js +0 -101
- package/tests/smtp_client.js +0 -80
- package/tests/tls_socket.js +0 -333
- package/tests/transaction.js +0 -284
- /package/docs/{plugins → deprecated}/dkim_sign.md +0 -0
- /package/docs/{plugins → deprecated}/dkim_verify.md +0 -0
- /package/docs/{plugins → deprecated}/dnsbl.md +0 -0
- /package/docs/{plugins → deprecated}/dnswl.md +0 -0
- /package/docs/{plugins → deprecated}/rcpt_to.routes.md +0 -0
- /package/{tests → test}/.eslintrc.yaml +0 -0
- /package/{tests → test}/config/auth_flat_file.ini +0 -0
- /package/{tests → test}/config/dhparams.pem +0 -0
- /package/{tests → test}/config/host_list +0 -0
- /package/{tests → test}/config/outbound_tls_cert.pem +0 -0
- /package/{tests → test}/config/outbound_tls_key.pem +0 -0
- /package/{tests → test}/config/smtp_forward.ini +0 -0
- /package/{tests → test}/config/tls/ec.pem +0 -0
- /package/{tests → test}/config/tls/haraka.local.pem +0 -0
- /package/{tests → test}/config/tls/mismatched.pem +0 -0
- /package/{tests → test}/config/tls.ini +0 -0
- /package/{tests → test}/config/tls_cert.pem +0 -0
- /package/{tests → test}/config/tls_key.pem +0 -0
- /package/{tests → test}/fixtures/todo_qfile.txt +0 -0
- /package/{tests → test}/installation/config/test-plugin-flat +0 -0
- /package/{tests → test}/installation/config/test-plugin.ini +0 -0
- /package/{tests → test}/installation/config/tls.ini +0 -0
- /package/{tests → test}/installation/node_modules/load_first/index.js +0 -0
- /package/{tests → test}/installation/node_modules/load_first/package.json +0 -0
- /package/{tests → test}/installation/node_modules/test-plugin/config/test-plugin-flat +0 -0
- /package/{tests → test}/installation/node_modules/test-plugin/config/test-plugin.ini +0 -0
- /package/{tests → test}/installation/node_modules/test-plugin/package.json +0 -0
- /package/{tests → test}/installation/node_modules/test-plugin/test-plugin.js +0 -0
- /package/{tests → test}/installation/plugins/base_plugin.js +0 -0
- /package/{tests → test}/installation/plugins/folder_plugin/index.js +0 -0
- /package/{tests → test}/installation/plugins/folder_plugin/package.json +0 -0
- /package/{tests → test}/installation/plugins/inherits.js +0 -0
- /package/{tests → test}/installation/plugins/load_first.js +0 -0
- /package/{tests → test}/installation/plugins/plugin.js +0 -0
- /package/{tests → test}/installation/plugins/tls.js +0 -0
- /package/{tests → test}/loud/config/dhparams.pem +0 -0
- /package/{tests → test}/loud/config/tls/goobered.pem +0 -0
- /package/{tests → test}/loud/config/tls.ini +0 -0
- /package/{tests → test}/mail_specimen/base64-root-part.txt +0 -0
- /package/{tests → test}/mail_specimen/varied-fold-lengths-preserve-data.txt +0 -0
- /package/{tests → test}/queue/1507509981169_1507509981169_0_61403_e0Y0Ym_1_fixed +0 -0
- /package/{tests → test}/queue/1507509981169_1507509981169_0_61403_e0Y0Ym_1_haraka +0 -0
- /package/{tests → test}/queue/1508269674999_1508269674999_0_34002_socVUF_1_haraka +0 -0
- /package/{tests → test}/queue/1508455115683_1508455115683_0_90253_9Q4o4V_1_haraka +0 -0
- /package/{tests → test}/queue/zero-length +0 -0
- /package/{tests → test}/test-queue/delete-me +0 -0
package/tests/plugins/bounce.js
DELETED
|
@@ -1,307 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const Address = require('address-rfc2821');
|
|
4
|
-
const fixtures = require('haraka-test-fixtures');
|
|
5
|
-
const message = require('haraka-email-message')
|
|
6
|
-
|
|
7
|
-
const Connection = fixtures.connection;
|
|
8
|
-
|
|
9
|
-
function _set_up (done) {
|
|
10
|
-
|
|
11
|
-
this.plugin = new fixtures.plugin('bounce');
|
|
12
|
-
this.plugin.cfg = {
|
|
13
|
-
main: { },
|
|
14
|
-
check: {
|
|
15
|
-
reject_all: false,
|
|
16
|
-
single_recipient: true,
|
|
17
|
-
empty_return_path: true,
|
|
18
|
-
bad_rcpt: true,
|
|
19
|
-
non_local_msgid: true,
|
|
20
|
-
},
|
|
21
|
-
reject: {
|
|
22
|
-
single_recipient:true,
|
|
23
|
-
empty_return_path:true,
|
|
24
|
-
non_local_msgid:true,
|
|
25
|
-
},
|
|
26
|
-
invalid_addrs: { 'test@bad1.com': true, 'test@bad2.com': true },
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
this.connection = Connection.createConnection();
|
|
30
|
-
this.connection.remote.ip = '8.8.8.8';
|
|
31
|
-
this.connection.transaction = {
|
|
32
|
-
header: new message.Header(),
|
|
33
|
-
results: new fixtures.results(this.plugin),
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
done();
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
exports.load_configs = {
|
|
40
|
-
setUp : _set_up,
|
|
41
|
-
'load_bounce_ini' (test) {
|
|
42
|
-
test.expect(3);
|
|
43
|
-
this.plugin.load_bounce_ini();
|
|
44
|
-
test.ok(this.plugin.cfg.main);
|
|
45
|
-
test.ok(this.plugin.cfg.check);
|
|
46
|
-
test.ok(this.plugin.cfg.reject);
|
|
47
|
-
test.done();
|
|
48
|
-
},
|
|
49
|
-
'load_bounce_bad_rcpt' (test) {
|
|
50
|
-
test.expect(3);
|
|
51
|
-
this.plugin.load_bounce_bad_rcpt();
|
|
52
|
-
test.ok(this.plugin.cfg.main);
|
|
53
|
-
test.ok(this.plugin.cfg.check);
|
|
54
|
-
test.ok(this.plugin.cfg.reject);
|
|
55
|
-
test.done();
|
|
56
|
-
},
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
exports.reject_all = {
|
|
60
|
-
setUp : _set_up,
|
|
61
|
-
'disabled' (test) {
|
|
62
|
-
test.expect(1);
|
|
63
|
-
this.connection.transaction.mail_from= new Address.Address('<matt@example.com>');
|
|
64
|
-
this.connection.transaction.rcpt_to= [ new Address.Address('test@any.com') ];
|
|
65
|
-
const cb = function () {
|
|
66
|
-
test.equal(undefined, arguments[0]);
|
|
67
|
-
};
|
|
68
|
-
this.plugin.cfg.check.reject_all=false;
|
|
69
|
-
this.plugin.reject_all(cb, this.connection, new Address.Address('<matt@example.com>'));
|
|
70
|
-
test.done();
|
|
71
|
-
},
|
|
72
|
-
'not bounce ok' (test) {
|
|
73
|
-
test.expect(1);
|
|
74
|
-
this.connection.transaction.mail_from= new Address.Address('<matt@example.com>');
|
|
75
|
-
this.connection.transaction.rcpt_to= [ new Address.Address('test@any.com') ];
|
|
76
|
-
const cb = function () {
|
|
77
|
-
test.equal(undefined, arguments[0]);
|
|
78
|
-
};
|
|
79
|
-
this.plugin.cfg.check.reject_all=true;
|
|
80
|
-
this.plugin.reject_all(cb, this.connection, new Address.Address('<matt@example.com>'));
|
|
81
|
-
test.done();
|
|
82
|
-
},
|
|
83
|
-
'bounce rejected' (test) {
|
|
84
|
-
test.expect(1);
|
|
85
|
-
this.connection.transaction.mail_from= new Address.Address('<>');
|
|
86
|
-
this.connection.transaction.rcpt_to= [ new Address.Address('test@any.com') ];
|
|
87
|
-
const cb = function () {
|
|
88
|
-
test.equal(DENY, arguments[0]);
|
|
89
|
-
};
|
|
90
|
-
this.plugin.cfg.check.reject_all=true;
|
|
91
|
-
this.plugin.reject_all(cb, this.connection, new Address.Address('<>'));
|
|
92
|
-
test.done();
|
|
93
|
-
},
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
exports.empty_return_path = {
|
|
97
|
-
setUp : _set_up,
|
|
98
|
-
'none' (test) {
|
|
99
|
-
test.expect(1);
|
|
100
|
-
this.connection.transaction.mail_from= new Address.Address('<>');
|
|
101
|
-
this.connection.transaction.rcpt_to= [ new Address.Address('test@good.com') ];
|
|
102
|
-
const cb = function () {
|
|
103
|
-
test.equal(undefined, arguments[0]);
|
|
104
|
-
};
|
|
105
|
-
this.plugin.empty_return_path(cb, this.connection);
|
|
106
|
-
test.done();
|
|
107
|
-
},
|
|
108
|
-
'has' (test) {
|
|
109
|
-
test.expect(1);
|
|
110
|
-
this.connection.transaction.mail_from= new Address.Address('<>');
|
|
111
|
-
this.connection.transaction.rcpt_to= [ new Address.Address('test@good.com') ];
|
|
112
|
-
this.connection.transaction.header.add('Return-Path', "Content doesn't matter");
|
|
113
|
-
const cb = function () {
|
|
114
|
-
test.equal(DENY, arguments[0]);
|
|
115
|
-
};
|
|
116
|
-
this.plugin.empty_return_path(cb, this.connection);
|
|
117
|
-
test.done();
|
|
118
|
-
},
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
exports.non_local_msgid = {
|
|
122
|
-
setUp: _set_up,
|
|
123
|
-
'no_msgid_in_headers' (test) {
|
|
124
|
-
test.expect(1);
|
|
125
|
-
this.connection.transaction.mail_from= new Address.Address('<>');
|
|
126
|
-
this.connection.transaction.rcpt_to= [ new Address.Address('test@good.com') ];
|
|
127
|
-
this.connection.transaction.body = new message.Body();
|
|
128
|
-
this.connection.transaction.body.bodytext = '';
|
|
129
|
-
const cb = function () {
|
|
130
|
-
test.equal(DENY, arguments[0]);
|
|
131
|
-
}
|
|
132
|
-
this.plugin.non_local_msgid(cb, this.connection);
|
|
133
|
-
test.done();
|
|
134
|
-
},
|
|
135
|
-
'no_domains_in_msgid' (test) {
|
|
136
|
-
test.expect(1);
|
|
137
|
-
this.connection.transaction.mail_from= new Address.Address('<>');
|
|
138
|
-
this.connection.transaction.rcpt_to= [ new Address.Address('test@good.com') ];
|
|
139
|
-
this.connection.transaction.body = new message.Body();
|
|
140
|
-
this.connection.transaction.body.bodytext = 'Message-ID:<blah>';
|
|
141
|
-
const cb = function () {
|
|
142
|
-
test.equal(DENY, arguments[0]);
|
|
143
|
-
}
|
|
144
|
-
this.plugin.non_local_msgid(cb, this.connection);
|
|
145
|
-
test.done();
|
|
146
|
-
},
|
|
147
|
-
'invalid_domain' (test) {
|
|
148
|
-
test.expect(2);
|
|
149
|
-
this.connection.transaction.mail_from= new Address.Address('<>');
|
|
150
|
-
this.connection.transaction.rcpt_to= [ new Address.Address('test@good.com') ];
|
|
151
|
-
this.connection.transaction.body = new message.Body();
|
|
152
|
-
this.connection.transaction.body.bodytext = 'Message-ID: <blah@foo.cooooooom>';
|
|
153
|
-
const cb = function () {
|
|
154
|
-
test.equal(DENY, arguments[0]);
|
|
155
|
-
test.ok(/without valid domain/.test(arguments[1]));
|
|
156
|
-
}
|
|
157
|
-
this.plugin.non_local_msgid(cb, this.connection);
|
|
158
|
-
test.done();
|
|
159
|
-
},
|
|
160
|
-
/* - commented out because the code looks bogus to me - see comment in plugins/bounce.js - @baudehlo
|
|
161
|
-
'non-local': function (test) {
|
|
162
|
-
test.expect(2);
|
|
163
|
-
this.connection.transaction.mail_from= new Address.Address('<>');
|
|
164
|
-
this.connection.transaction.rcpt_to= [ new Address.Address('test@good.com') ];
|
|
165
|
-
this.connection.transaction.body = new message.Body();
|
|
166
|
-
this.connection.transaction.body.bodytext = 'Message-ID: <blah@foo.com>';
|
|
167
|
-
var cb = function () {
|
|
168
|
-
test.equal(DENY, arguments[0]);
|
|
169
|
-
test.ok(/non-local Message-ID/.test(arguments[1]));
|
|
170
|
-
}
|
|
171
|
-
this.plugin.non_local_msgid(cb, this.connection);
|
|
172
|
-
test.done();
|
|
173
|
-
},
|
|
174
|
-
*/
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
exports.single_recipient = {
|
|
178
|
-
setUp : _set_up,
|
|
179
|
-
'valid' (test) {
|
|
180
|
-
test.expect(1);
|
|
181
|
-
this.connection.transaction.mail_from= new Address.Address('<>');
|
|
182
|
-
this.connection.transaction.rcpt_to= [ new Address.Address('test@good.com') ];
|
|
183
|
-
const cb = function () {
|
|
184
|
-
test.equal(undefined, arguments[0]);
|
|
185
|
-
};
|
|
186
|
-
this.plugin.single_recipient(cb, this.connection);
|
|
187
|
-
test.done();
|
|
188
|
-
},
|
|
189
|
-
'invalid' (test) {
|
|
190
|
-
test.expect(1);
|
|
191
|
-
this.connection.transaction.mail_from= new Address.Address('<>');
|
|
192
|
-
this.connection.transaction.rcpt_to= [
|
|
193
|
-
new Address.Address('test@good.com'),
|
|
194
|
-
new Address.Address('test2@good.com')
|
|
195
|
-
];
|
|
196
|
-
const cb = function () {
|
|
197
|
-
console.log(arguments[0]);
|
|
198
|
-
test.equal(DENY, arguments[0]);
|
|
199
|
-
};
|
|
200
|
-
this.plugin.single_recipient(cb, this.connection);
|
|
201
|
-
test.done();
|
|
202
|
-
},
|
|
203
|
-
'test@example.com' (test) {
|
|
204
|
-
test.expect(1);
|
|
205
|
-
this.connection.transaction.mail_from= new Address.Address('<>');
|
|
206
|
-
this.connection.transaction.rcpt_to= [ new Address.Address('test@example.com') ];
|
|
207
|
-
const cb = function () {
|
|
208
|
-
test.equal(undefined, arguments[0]);
|
|
209
|
-
};
|
|
210
|
-
this.plugin.single_recipient(cb, this.connection);
|
|
211
|
-
test.done();
|
|
212
|
-
},
|
|
213
|
-
'test@example.com,test2@example.com' (test) {
|
|
214
|
-
test.expect(1);
|
|
215
|
-
this.connection.transaction.mail_from= new Address.Address('<>');
|
|
216
|
-
this.connection.transaction.rcpt_to= [
|
|
217
|
-
new Address.Address('test1@example.com'),
|
|
218
|
-
new Address.Address('test2@example.com'),
|
|
219
|
-
];
|
|
220
|
-
const cb = function () {
|
|
221
|
-
test.equal(DENY, arguments[0]);
|
|
222
|
-
};
|
|
223
|
-
this.plugin.single_recipient(cb, this.connection);
|
|
224
|
-
test.done();
|
|
225
|
-
},
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
exports.bad_rcpt = {
|
|
229
|
-
setUp : _set_up,
|
|
230
|
-
'test@good.com' (test) {
|
|
231
|
-
test.expect(1);
|
|
232
|
-
this.connection.transaction.mail_from= new Address.Address('<>');
|
|
233
|
-
this.connection.transaction.rcpt_to= [ new Address.Address('test@good.com') ];
|
|
234
|
-
function cb (rc) {
|
|
235
|
-
test.equal(undefined, rc);
|
|
236
|
-
}
|
|
237
|
-
this.plugin.bad_rcpt(cb, this.connection);
|
|
238
|
-
test.done();
|
|
239
|
-
},
|
|
240
|
-
'test@bad1.com' (test) {
|
|
241
|
-
test.expect(1);
|
|
242
|
-
this.connection.transaction.mail_from= new Address.Address('<>');
|
|
243
|
-
this.connection.transaction.rcpt_to= [ new Address.Address('test@bad1.com') ];
|
|
244
|
-
function cb (rc) {
|
|
245
|
-
test.equal(DENY, rc);
|
|
246
|
-
}
|
|
247
|
-
this.plugin.cfg.invalid_addrs = {'test@bad1.com': true, 'test@bad2.com': true };
|
|
248
|
-
this.plugin.bad_rcpt(cb, this.connection);
|
|
249
|
-
test.done();
|
|
250
|
-
},
|
|
251
|
-
'test@bad1.com, test@bad2.com' (test) {
|
|
252
|
-
test.expect(1);
|
|
253
|
-
this.connection.transaction.mail_from= new Address.Address('<>');
|
|
254
|
-
this.connection.transaction.rcpt_to= [
|
|
255
|
-
new Address.Address('test@bad1.com'),
|
|
256
|
-
new Address.Address('test@bad2.com')
|
|
257
|
-
];
|
|
258
|
-
function cb (rc) {
|
|
259
|
-
test.equal(DENY, rc);
|
|
260
|
-
}
|
|
261
|
-
this.plugin.cfg.invalid_addrs = {'test@bad1.com': true, 'test@bad2.com': true };
|
|
262
|
-
this.plugin.bad_rcpt(cb, this.connection);
|
|
263
|
-
test.done();
|
|
264
|
-
},
|
|
265
|
-
'test@good.com, test@bad2.com' (test) {
|
|
266
|
-
test.expect(1);
|
|
267
|
-
this.connection.transaction.mail_from= new Address.Address('<>');
|
|
268
|
-
this.connection.transaction.rcpt_to= [
|
|
269
|
-
new Address.Address('test@good.com'),
|
|
270
|
-
new Address.Address('test@bad2.com')
|
|
271
|
-
];
|
|
272
|
-
function cb (rc) {
|
|
273
|
-
test.equal(DENY, rc);
|
|
274
|
-
}
|
|
275
|
-
this.plugin.cfg.invalid_addrs = {'test@bad1.com': true, 'test@bad2.com': true };
|
|
276
|
-
this.plugin.bad_rcpt(cb, this.connection);
|
|
277
|
-
test.done();
|
|
278
|
-
},
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
exports.has_null_sender = {
|
|
282
|
-
setUp : _set_up,
|
|
283
|
-
'<>' (test) {
|
|
284
|
-
test.expect(1);
|
|
285
|
-
this.connection.transaction.mail_from= new Address.Address('<>');
|
|
286
|
-
test.equal(true, this.plugin.has_null_sender(this.connection));
|
|
287
|
-
test.done();
|
|
288
|
-
},
|
|
289
|
-
' ' (test) {
|
|
290
|
-
test.expect(1);
|
|
291
|
-
this.connection.transaction.mail_from= new Address.Address('');
|
|
292
|
-
test.equal(true, this.plugin.has_null_sender(this.connection));
|
|
293
|
-
test.done();
|
|
294
|
-
},
|
|
295
|
-
'user@example' (test) {
|
|
296
|
-
test.expect(1);
|
|
297
|
-
this.connection.transaction.mail_from= new Address.Address('user@example');
|
|
298
|
-
test.equal(false, this.plugin.has_null_sender(this.connection));
|
|
299
|
-
test.done();
|
|
300
|
-
},
|
|
301
|
-
'user@example.com' (test) {
|
|
302
|
-
test.expect(1);
|
|
303
|
-
this.connection.transaction.mail_from= new Address.Address('user@example.com');
|
|
304
|
-
test.equal(false, this.plugin.has_null_sender(this.connection));
|
|
305
|
-
test.done();
|
|
306
|
-
},
|
|
307
|
-
}
|
package/tests/plugins/clamd.js
DELETED
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const net = require('net');
|
|
4
|
-
const fixtures = require('haraka-test-fixtures');
|
|
5
|
-
|
|
6
|
-
const Connection = fixtures.connection;
|
|
7
|
-
|
|
8
|
-
function _set_up (done) {
|
|
9
|
-
|
|
10
|
-
this.plugin = new fixtures.plugin('clamd');
|
|
11
|
-
this.plugin.register();
|
|
12
|
-
|
|
13
|
-
this.connection = Connection.createConnection();
|
|
14
|
-
this.connection.init_transaction();
|
|
15
|
-
|
|
16
|
-
done();
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
exports.load_clamd_ini = {
|
|
20
|
-
setUp : _set_up,
|
|
21
|
-
'none' (test) {
|
|
22
|
-
test.expect(1);
|
|
23
|
-
test.deepEqual([], this.plugin.skip_list);
|
|
24
|
-
test.done();
|
|
25
|
-
},
|
|
26
|
-
'defaults' (test) {
|
|
27
|
-
test.expect(6);
|
|
28
|
-
const cfg = this.plugin.cfg.main;
|
|
29
|
-
test.equal('localhost:3310', cfg.clamd_socket);
|
|
30
|
-
test.equal(30, cfg.timeout);
|
|
31
|
-
test.equal(10, cfg.connect_timeout);
|
|
32
|
-
test.equal(26214400, cfg.max_size);
|
|
33
|
-
test.equal(false, cfg.only_with_attachments);
|
|
34
|
-
test.equal(false, cfg.randomize_host_order);
|
|
35
|
-
test.done();
|
|
36
|
-
},
|
|
37
|
-
'reject opts' (test) {
|
|
38
|
-
test.expect(14);
|
|
39
|
-
test.equal(true, this.plugin.rejectRE.test('Encrypted.'));
|
|
40
|
-
test.equal(true, this.plugin.rejectRE.test('Heuristics.Structured.'));
|
|
41
|
-
test.equal(true, this.plugin.rejectRE.test(
|
|
42
|
-
'Heuristics.Structured.CreditCardNumber'));
|
|
43
|
-
test.equal(true, this.plugin.rejectRE.test('Broken.Executable.'));
|
|
44
|
-
test.equal(true, this.plugin.rejectRE.test('PUA.'));
|
|
45
|
-
test.equal(true, this.plugin.rejectRE.test(
|
|
46
|
-
'Heuristics.OLE2.ContainsMacros'));
|
|
47
|
-
test.equal(true, this.plugin.rejectRE.test('Heuristics.Safebrowsing.'));
|
|
48
|
-
test.equal(true, this.plugin.rejectRE.test(
|
|
49
|
-
'Heuristics.Safebrowsing.Suspected-phishing_safebrowsing.clamav.net'));
|
|
50
|
-
test.equal(true, this.plugin.rejectRE.test(
|
|
51
|
-
'Sanesecurity.Junk.50402.UNOFFICIAL'));
|
|
52
|
-
test.equal(false, this.plugin.rejectRE.test(
|
|
53
|
-
'Sanesecurity.UNOFFICIAL.oops'));
|
|
54
|
-
test.equal(false, this.plugin.rejectRE.test('Phishing'));
|
|
55
|
-
test.equal(false, this.plugin.rejectRE.test(
|
|
56
|
-
'Heuristics.Phishing.Email.SpoofedDomain'));
|
|
57
|
-
test.equal(false, this.plugin.rejectRE.test('Suspect.Executable'));
|
|
58
|
-
test.equal(false, this.plugin.rejectRE.test('MattWuzHere'));
|
|
59
|
-
test.done();
|
|
60
|
-
},
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
exports.hook_data = {
|
|
64
|
-
setUp : _set_up,
|
|
65
|
-
'only_with_attachments, false' (test) {
|
|
66
|
-
test.expect(2);
|
|
67
|
-
test.equal(false, this.plugin.cfg.main.only_with_attachments);
|
|
68
|
-
const next = function () {
|
|
69
|
-
test.equal(false, this.connection.transaction.parse_body);
|
|
70
|
-
test.done();
|
|
71
|
-
}.bind(this);
|
|
72
|
-
this.plugin.hook_data(next, this.connection);
|
|
73
|
-
},
|
|
74
|
-
'only_with_attachments, true' (test) {
|
|
75
|
-
this.plugin.cfg.main.only_with_attachments=true;
|
|
76
|
-
test.expect(2);
|
|
77
|
-
this.connection.transaction.attachment_hooks = () => {};
|
|
78
|
-
const next = function () {
|
|
79
|
-
test.equal(true, this.plugin.cfg.main.only_with_attachments);
|
|
80
|
-
test.equal(true, this.connection.transaction.parse_body);
|
|
81
|
-
test.done();
|
|
82
|
-
}.bind(this);
|
|
83
|
-
this.plugin.hook_data(next, this.connection);
|
|
84
|
-
},
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
exports.hook_data_post = {
|
|
88
|
-
setUp : _set_up,
|
|
89
|
-
'skip attachment' (test) {
|
|
90
|
-
this.connection.transaction.notes = { clamd_found_attachment: false };
|
|
91
|
-
this.plugin.cfg.main.only_with_attachments=true;
|
|
92
|
-
test.expect(1);
|
|
93
|
-
const next = function () {
|
|
94
|
-
test.ok(this.connection.transaction.results.get('clamd').skip.length > 0);
|
|
95
|
-
test.done();
|
|
96
|
-
}.bind(this);
|
|
97
|
-
this.plugin.hook_data_post(next, this.connection);
|
|
98
|
-
},
|
|
99
|
-
'skip authenticated' (test) {
|
|
100
|
-
this.connection.notes.auth_user = 'user';
|
|
101
|
-
this.plugin.cfg.check.authenticated = false;
|
|
102
|
-
test.expect(1);
|
|
103
|
-
const next = function () {
|
|
104
|
-
test.ok(this.connection.transaction.results.get('clamd').skip.length > 0);
|
|
105
|
-
test.done();
|
|
106
|
-
}.bind(this);
|
|
107
|
-
this.plugin.hook_data_post(next, this.connection);
|
|
108
|
-
},
|
|
109
|
-
'checks local IP' (test) {
|
|
110
|
-
this.connection.remote.is_local = true;
|
|
111
|
-
this.plugin.cfg.check.local_ip = true;
|
|
112
|
-
|
|
113
|
-
test.expect(1);
|
|
114
|
-
const next = function () {
|
|
115
|
-
test.ok(this.connection.transaction.results.get('clamd').skip.length === 0);
|
|
116
|
-
test.done();
|
|
117
|
-
}.bind(this);
|
|
118
|
-
this.plugin.hook_data_post(next, this.connection);
|
|
119
|
-
},
|
|
120
|
-
'skips local IP' (test) {
|
|
121
|
-
this.connection.remote.is_local = true;
|
|
122
|
-
this.plugin.cfg.check.local_ip = false;
|
|
123
|
-
|
|
124
|
-
test.expect(1);
|
|
125
|
-
const next = function () {
|
|
126
|
-
test.ok(this.connection.transaction.results.get('clamd').skip.length > 0);
|
|
127
|
-
test.done();
|
|
128
|
-
}.bind(this);
|
|
129
|
-
this.plugin.hook_data_post(next, this.connection);
|
|
130
|
-
},
|
|
131
|
-
'checks private IP' (test) {
|
|
132
|
-
this.connection.remote.is_private = true;
|
|
133
|
-
this.plugin.cfg.check.private_ip = true;
|
|
134
|
-
|
|
135
|
-
test.expect(1);
|
|
136
|
-
const next = function () {
|
|
137
|
-
test.ok(this.connection.transaction.results.get('clamd').skip.length === 0);
|
|
138
|
-
test.done();
|
|
139
|
-
}.bind(this);
|
|
140
|
-
this.plugin.hook_data_post(next, this.connection);
|
|
141
|
-
},
|
|
142
|
-
'skips private IP' (test) {
|
|
143
|
-
this.connection.remote.is_private = true;
|
|
144
|
-
this.plugin.cfg.check.private_ip = false;
|
|
145
|
-
|
|
146
|
-
test.expect(1);
|
|
147
|
-
const next = function () {
|
|
148
|
-
test.ok(this.connection.transaction.results.get('clamd').skip.length > 0);
|
|
149
|
-
test.done();
|
|
150
|
-
}.bind(this);
|
|
151
|
-
this.plugin.hook_data_post(next, this.connection);
|
|
152
|
-
},
|
|
153
|
-
'checks public ip' (test) {
|
|
154
|
-
test.expect(1);
|
|
155
|
-
const next = function () {
|
|
156
|
-
test.ok(this.connection.transaction.results.get('clamd').skip.length === 0);
|
|
157
|
-
test.done();
|
|
158
|
-
}.bind(this);
|
|
159
|
-
this.plugin.hook_data_post(next, this.connection);
|
|
160
|
-
},
|
|
161
|
-
'skip localhost if check.local_ip = false and check.private_ip = true' (test) {
|
|
162
|
-
this.connection.remote.is_local = true;
|
|
163
|
-
this.connection.remote.is_private = true;
|
|
164
|
-
|
|
165
|
-
this.plugin.cfg.check.local_ip = false;
|
|
166
|
-
this.plugin.cfg.check.private_ip = true;
|
|
167
|
-
|
|
168
|
-
test.expect(1);
|
|
169
|
-
const next = function () {
|
|
170
|
-
test.ok(this.connection.transaction.results.get('clamd').skip.length > 0);
|
|
171
|
-
test.done();
|
|
172
|
-
}.bind(this);
|
|
173
|
-
this.plugin.hook_data_post(next, this.connection);
|
|
174
|
-
},
|
|
175
|
-
'checks localhost if check.local_ip = true and check.private_ip = false' (test) {
|
|
176
|
-
this.connection.remote.is_local = true;
|
|
177
|
-
this.connection.remote.is_private = true;
|
|
178
|
-
|
|
179
|
-
this.plugin.cfg.check.local_ip = true;
|
|
180
|
-
this.plugin.cfg.check.private_ip = false;
|
|
181
|
-
|
|
182
|
-
test.expect(1);
|
|
183
|
-
const next = function () {
|
|
184
|
-
test.ok(this.connection.transaction.results.get('clamd').skip.length === 0);
|
|
185
|
-
test.done();
|
|
186
|
-
}.bind(this);
|
|
187
|
-
this.plugin.hook_data_post(next, this.connection);
|
|
188
|
-
},
|
|
189
|
-
'message too big' (test) {
|
|
190
|
-
this.connection.transaction.data_bytes=513;
|
|
191
|
-
this.plugin.cfg.main.max_size=512;
|
|
192
|
-
test.expect(1);
|
|
193
|
-
const next = function () {
|
|
194
|
-
test.ok(this.connection.transaction.results.get('clamd').skip.length > 0);
|
|
195
|
-
test.done();
|
|
196
|
-
}.bind(this);
|
|
197
|
-
this.plugin.hook_data_post(next, this.connection);
|
|
198
|
-
},
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
exports.send_clamd_predata = {
|
|
202
|
-
setUp : _set_up,
|
|
203
|
-
'writes the proper commands to clamd socket' (test) {
|
|
204
|
-
test.expect(1);
|
|
205
|
-
const server = new net.createServer((socket) => {
|
|
206
|
-
socket.on('data', (data) => {
|
|
207
|
-
test.ok(data.toString(), `zINSTREAM\0Received: from Haraka clamd plugin\r\n`)
|
|
208
|
-
// console.log(`${data.toString()}`)
|
|
209
|
-
})
|
|
210
|
-
socket.on('end', () => {
|
|
211
|
-
test.done()
|
|
212
|
-
})
|
|
213
|
-
})
|
|
214
|
-
|
|
215
|
-
server.listen(65535, () => {
|
|
216
|
-
const client = new net.Socket();
|
|
217
|
-
client.connect(65535, () => {
|
|
218
|
-
this.plugin.send_clamd_predata(client, () => {
|
|
219
|
-
client.end()
|
|
220
|
-
})
|
|
221
|
-
})
|
|
222
|
-
})
|
|
223
|
-
},
|
|
224
|
-
}
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const fixtures = require('haraka-test-fixtures');
|
|
4
|
-
|
|
5
|
-
function _set_up (done) {
|
|
6
|
-
|
|
7
|
-
this.plugin = new fixtures.plugin('relay_acl');
|
|
8
|
-
this.plugin.cfg = {};
|
|
9
|
-
|
|
10
|
-
this.connection = fixtures.connection.createConnection();
|
|
11
|
-
this.connection.transaction = {
|
|
12
|
-
results: new fixtures.results(this.connection),
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
done();
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
exports.is_acl_allowed = {
|
|
19
|
-
setUp : _set_up,
|
|
20
|
-
'bare IP' (test) {
|
|
21
|
-
test.expect(3);
|
|
22
|
-
this.plugin.acl_allow=['127.0.0.6'];
|
|
23
|
-
this.connection.remote.ip='127.0.0.6';
|
|
24
|
-
test.equal(true, this.plugin.is_acl_allowed(this.connection));
|
|
25
|
-
this.connection.remote.ip='127.0.0.5';
|
|
26
|
-
test.equal(false, this.plugin.is_acl_allowed(this.connection));
|
|
27
|
-
this.connection.remote.ip='127.0.1.5';
|
|
28
|
-
test.equal(false, this.plugin.is_acl_allowed(this.connection));
|
|
29
|
-
test.done();
|
|
30
|
-
},
|
|
31
|
-
'netmask' (test) {
|
|
32
|
-
test.expect(3);
|
|
33
|
-
this.plugin.acl_allow=['127.0.0.6/24'];
|
|
34
|
-
this.connection.remote.ip='127.0.0.6';
|
|
35
|
-
test.equal(true, this.plugin.is_acl_allowed(this.connection));
|
|
36
|
-
this.connection.remote.ip='127.0.0.5';
|
|
37
|
-
test.equal(true, this.plugin.is_acl_allowed(this.connection));
|
|
38
|
-
this.connection.remote.ip='127.0.1.5';
|
|
39
|
-
test.equal(false, this.plugin.is_acl_allowed(this.connection));
|
|
40
|
-
test.done();
|
|
41
|
-
},
|
|
42
|
-
'mixed (ipv4 & ipv6 (Issue #428))' (test) {
|
|
43
|
-
test.expect(3);
|
|
44
|
-
this.connection.remote.ip='2607:f060:b008:feed::2';
|
|
45
|
-
test.equal(false, this.plugin.is_acl_allowed(this.connection));
|
|
46
|
-
|
|
47
|
-
this.plugin.acl_allow=['2607:f060:b008:feed::2/64'];
|
|
48
|
-
this.connection.remote.ip='2607:f060:b008:feed::2';
|
|
49
|
-
test.equal(true, this.plugin.is_acl_allowed(this.connection));
|
|
50
|
-
|
|
51
|
-
this.plugin.acl_allow=['127.0.0.6/24'];
|
|
52
|
-
this.connection.remote.ip='2607:f060:b008:feed::2';
|
|
53
|
-
test.equal(false, this.plugin.is_acl_allowed(this.connection));
|
|
54
|
-
|
|
55
|
-
test.done();
|
|
56
|
-
},
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
exports.relay_dest_domains = {
|
|
60
|
-
setUp : _set_up,
|
|
61
|
-
'relaying' (test) {
|
|
62
|
-
test.expect(2);
|
|
63
|
-
const outer = this;
|
|
64
|
-
function next () {
|
|
65
|
-
// console.log(outer.connection.results.get('relay_acl'));
|
|
66
|
-
// console.log(outer.connection.transaction.results.get('relay_acl'));
|
|
67
|
-
test.equal(undefined, arguments[0]);
|
|
68
|
-
test.equal(1, outer.connection.transaction.results.get('relay_acl').skip.length);
|
|
69
|
-
test.done();
|
|
70
|
-
}
|
|
71
|
-
this.connection.relaying=true;
|
|
72
|
-
this.plugin.relay_dest_domains(next, this.connection, [{host:'foo'}]);
|
|
73
|
-
},
|
|
74
|
-
'no config' (test) {
|
|
75
|
-
test.expect(2);
|
|
76
|
-
const outer = this;
|
|
77
|
-
function next () {
|
|
78
|
-
test.equal(undefined, arguments[0]);
|
|
79
|
-
test.equal(1, outer.connection.transaction.results.get('relay_acl').skip.length);
|
|
80
|
-
test.done();
|
|
81
|
-
}
|
|
82
|
-
this.plugin.relay_dest_domains(next, this.connection, [{host:'foo'}]);
|
|
83
|
-
},
|
|
84
|
-
'action=undef' (test) {
|
|
85
|
-
test.expect(2);
|
|
86
|
-
const outer = this;
|
|
87
|
-
function next () {
|
|
88
|
-
test.equal(DENY, arguments[0]);
|
|
89
|
-
test.equal(1, outer.connection.transaction.results.get('relay_acl').fail.length);
|
|
90
|
-
test.done();
|
|
91
|
-
}
|
|
92
|
-
this.plugin.cfg.domains = { foo: '{"action":"dunno"}' };
|
|
93
|
-
this.plugin.relay_dest_domains(next, this.connection, [{host:'foo'}]);
|
|
94
|
-
},
|
|
95
|
-
'action=deny' (test) {
|
|
96
|
-
test.expect(2);
|
|
97
|
-
const outer = this;
|
|
98
|
-
function next () {
|
|
99
|
-
test.equal(DENY, arguments[0]);
|
|
100
|
-
test.equal(1, outer.connection.transaction.results.get('relay_acl').fail.length);
|
|
101
|
-
test.done();
|
|
102
|
-
}
|
|
103
|
-
this.plugin.cfg.domains = { foo: '{"action":"deny"}' };
|
|
104
|
-
this.plugin.relay_dest_domains(next, this.connection, [{host:'foo'}]);
|
|
105
|
-
},
|
|
106
|
-
'action=continue' (test) {
|
|
107
|
-
test.expect(2);
|
|
108
|
-
const outer = this;
|
|
109
|
-
function next () {
|
|
110
|
-
test.equal(CONT, arguments[0]);
|
|
111
|
-
test.equal(1, outer.connection.transaction.results.get('relay_acl').pass.length);
|
|
112
|
-
test.done();
|
|
113
|
-
}
|
|
114
|
-
this.plugin.cfg.domains = { foo: '{"action":"continue"}' };
|
|
115
|
-
this.plugin.relay_dest_domains(next, this.connection, [{host:'foo'}]);
|
|
116
|
-
},
|
|
117
|
-
'action=accept' (test) {
|
|
118
|
-
test.expect(2);
|
|
119
|
-
const outer = this;
|
|
120
|
-
function next () {
|
|
121
|
-
test.equal(CONT, arguments[0]);
|
|
122
|
-
test.equal(1, outer.connection.transaction.results.get('relay_acl').pass.length);
|
|
123
|
-
test.done();
|
|
124
|
-
}
|
|
125
|
-
this.plugin.cfg.domains = { foo: '{"action":"continue"}' };
|
|
126
|
-
this.plugin.relay_dest_domains(next, this.connection, [{host:'foo'}]);
|
|
127
|
-
},
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
exports.refresh_config = {
|
|
131
|
-
setUp : _set_up,
|
|
132
|
-
'callback' (test) {
|
|
133
|
-
test.expect(1);
|
|
134
|
-
function next () {
|
|
135
|
-
test.equal(undefined, arguments[0]);
|
|
136
|
-
test.done();
|
|
137
|
-
}
|
|
138
|
-
this.plugin.refresh_config(next, this.connection);
|
|
139
|
-
},
|
|
140
|
-
}
|