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.
Files changed (160) hide show
  1. package/.prettierignore +4 -0
  2. package/CONTRIBUTORS.md +5 -5
  3. package/Changes.md +69 -50
  4. package/Plugins.md +3 -1
  5. package/README.md +1 -1
  6. package/bin/haraka +475 -478
  7. package/config/outbound.ini +3 -0
  8. package/connection.js +1072 -1108
  9. package/docs/Connection.md +29 -30
  10. package/docs/CoreConfig.md +38 -39
  11. package/docs/CustomReturnCodes.md +0 -1
  12. package/docs/HAProxy.md +2 -2
  13. package/docs/Header.md +1 -1
  14. package/docs/Logging.md +29 -5
  15. package/docs/Outbound.md +93 -78
  16. package/docs/Plugins.md +103 -108
  17. package/docs/Transaction.md +49 -51
  18. package/docs/Tutorial.md +127 -143
  19. package/docs/deprecated/access.md +0 -1
  20. package/docs/deprecated/backscatterer.md +2 -3
  21. package/docs/deprecated/connect.rdns_access.md +18 -27
  22. package/docs/deprecated/data.headers.md +0 -1
  23. package/docs/deprecated/data.nomsgid.md +1 -2
  24. package/docs/deprecated/data.noreceived.md +1 -2
  25. package/docs/deprecated/data.rfc5322_header_checks.md +1 -2
  26. package/docs/deprecated/dkim_sign.md +13 -17
  27. package/docs/deprecated/dkim_verify.md +9 -17
  28. package/docs/deprecated/dnsbl.md +36 -38
  29. package/docs/deprecated/dnswl.md +41 -43
  30. package/docs/deprecated/lookup_rdns.strict.md +21 -34
  31. package/docs/deprecated/mail_from.access.md +17 -25
  32. package/docs/deprecated/mail_from.blocklist.md +9 -12
  33. package/docs/deprecated/mail_from.nobounces.md +1 -2
  34. package/docs/deprecated/rcpt_to.access.md +20 -27
  35. package/docs/deprecated/rcpt_to.blocklist.md +10 -13
  36. package/docs/deprecated/rcpt_to.routes.md +0 -1
  37. package/docs/deprecated/rdns.regexp.md +13 -15
  38. package/docs/plugins/aliases.md +89 -89
  39. package/docs/plugins/auth/auth_bridge.md +5 -7
  40. package/docs/plugins/auth/auth_ldap.md +11 -14
  41. package/docs/plugins/auth/auth_proxy.md +10 -12
  42. package/docs/plugins/auth/auth_vpopmaild.md +5 -6
  43. package/docs/plugins/auth/flat_file.md +4 -4
  44. package/docs/plugins/block_me.md +3 -3
  45. package/docs/plugins/data.signatures.md +1 -2
  46. package/docs/plugins/delay_deny.md +3 -4
  47. package/docs/plugins/max_unrecognized_commands.md +4 -4
  48. package/docs/plugins/prevent_credential_leaks.md +6 -6
  49. package/docs/plugins/process_title.md +18 -18
  50. package/docs/plugins/queue/deliver.md +2 -3
  51. package/docs/plugins/queue/discard.md +4 -4
  52. package/docs/plugins/queue/lmtp.md +1 -3
  53. package/docs/plugins/queue/qmail-queue.md +7 -9
  54. package/docs/plugins/queue/quarantine.md +16 -21
  55. package/docs/plugins/queue/rabbitmq.md +8 -11
  56. package/docs/plugins/queue/rabbitmq_amqplib.md +43 -39
  57. package/docs/plugins/queue/smtp_bridge.md +7 -10
  58. package/docs/plugins/queue/smtp_forward.md +42 -34
  59. package/docs/plugins/queue/smtp_proxy.md +30 -29
  60. package/docs/plugins/queue/test.md +1 -3
  61. package/docs/plugins/rcpt_to.in_host_list.md +6 -6
  62. package/docs/plugins/rcpt_to.max_count.md +1 -1
  63. package/docs/plugins/record_envelope_addresses.md +3 -3
  64. package/docs/plugins/reseed_rng.md +6 -6
  65. package/docs/plugins/status.md +9 -8
  66. package/docs/plugins/tarpit.md +7 -11
  67. package/docs/plugins/tls.md +12 -17
  68. package/docs/plugins/toobusy.md +4 -4
  69. package/docs/plugins/xclient.md +3 -3
  70. package/docs/tutorials/Migrating_from_v1_to_v2.md +19 -41
  71. package/docs/tutorials/SettingUpOutbound.md +6 -9
  72. package/endpoint.js +35 -38
  73. package/eslint.config.mjs +22 -19
  74. package/haraka.js +42 -47
  75. package/host_pool.js +75 -79
  76. package/http/html/404.html +45 -49
  77. package/http/html/index.html +39 -28
  78. package/http/package.json +2 -4
  79. package/line_socket.js +27 -28
  80. package/logger.js +182 -201
  81. package/outbound/client_pool.js +34 -27
  82. package/outbound/config.js +64 -59
  83. package/outbound/fsync_writestream.js +24 -25
  84. package/outbound/hmail.js +888 -835
  85. package/outbound/index.js +194 -187
  86. package/outbound/qfile.js +49 -52
  87. package/outbound/queue.js +197 -190
  88. package/outbound/timer_queue.js +41 -43
  89. package/outbound/tls.js +68 -61
  90. package/outbound/todo.js +11 -11
  91. package/package.json +38 -33
  92. package/plugins/.eslintrc.yaml +0 -1
  93. package/plugins/auth/auth_base.js +123 -127
  94. package/plugins/auth/auth_bridge.js +7 -7
  95. package/plugins/auth/auth_proxy.js +121 -126
  96. package/plugins/auth/auth_vpopmaild.js +84 -85
  97. package/plugins/auth/flat_file.js +18 -17
  98. package/plugins/block_me.js +31 -31
  99. package/plugins/data.signatures.js +13 -13
  100. package/plugins/delay_deny.js +65 -61
  101. package/plugins/prevent_credential_leaks.js +23 -23
  102. package/plugins/process_title.js +125 -128
  103. package/plugins/profile.js +5 -5
  104. package/plugins/queue/deliver.js +3 -3
  105. package/plugins/queue/discard.js +13 -14
  106. package/plugins/queue/lmtp.js +16 -17
  107. package/plugins/queue/qmail-queue.js +54 -55
  108. package/plugins/queue/quarantine.js +68 -70
  109. package/plugins/queue/rabbitmq.js +80 -87
  110. package/plugins/queue/rabbitmq_amqplib.js +75 -54
  111. package/plugins/queue/smtp_bridge.js +16 -16
  112. package/plugins/queue/smtp_forward.js +175 -179
  113. package/plugins/queue/smtp_proxy.js +69 -71
  114. package/plugins/queue/test.js +9 -9
  115. package/plugins/rcpt_to.host_list_base.js +30 -34
  116. package/plugins/rcpt_to.in_host_list.js +19 -19
  117. package/plugins/record_envelope_addresses.js +4 -4
  118. package/plugins/reseed_rng.js +4 -4
  119. package/plugins/status.js +90 -97
  120. package/plugins/tarpit.js +25 -14
  121. package/plugins/tls.js +68 -68
  122. package/plugins/toobusy.js +21 -23
  123. package/plugins/xclient.js +51 -53
  124. package/plugins.js +276 -293
  125. package/rfc1869.js +30 -35
  126. package/server.js +308 -299
  127. package/smtp_client.js +244 -228
  128. package/test/.eslintrc.yaml +0 -1
  129. package/test/connection.js +127 -134
  130. package/test/endpoint.js +53 -47
  131. package/test/fixtures/line_socket.js +12 -12
  132. package/test/fixtures/util_hmailitem.js +89 -85
  133. package/test/host_pool.js +90 -92
  134. package/test/installation/plugins/base_plugin.js +2 -2
  135. package/test/installation/plugins/folder_plugin/index.js +2 -3
  136. package/test/installation/plugins/inherits.js +3 -3
  137. package/test/installation/plugins/load_first.js +2 -3
  138. package/test/installation/plugins/plugin.js +1 -3
  139. package/test/installation/plugins/tls.js +2 -4
  140. package/test/logger.js +135 -116
  141. package/test/outbound/hmail.js +49 -35
  142. package/test/outbound/index.js +118 -101
  143. package/test/outbound/qfile.js +51 -53
  144. package/test/outbound_bounce_net_errors.js +84 -69
  145. package/test/outbound_bounce_rfc3464.js +235 -165
  146. package/test/plugins/auth/auth_base.js +420 -279
  147. package/test/plugins/auth/auth_vpopmaild.js +38 -39
  148. package/test/plugins/queue/smtp_forward.js +126 -104
  149. package/test/plugins/rcpt_to.host_list_base.js +85 -67
  150. package/test/plugins/rcpt_to.in_host_list.js +159 -112
  151. package/test/plugins/status.js +71 -64
  152. package/test/plugins/tls.js +37 -34
  153. package/test/plugins.js +97 -92
  154. package/test/rfc1869.js +19 -26
  155. package/test/server.js +293 -272
  156. package/test/smtp_client.js +180 -176
  157. package/test/tls_socket.js +62 -66
  158. package/test/transaction.js +159 -160
  159. package/tls_socket.js +331 -333
  160. package/transaction.js +129 -137
@@ -1,70 +1,73 @@
1
- 'use strict';
1
+ 'use strict'
2
2
 
3
3
  const assert = require('node:assert')
4
- const path = require('node:path');
4
+ const path = require('node:path')
5
5
 
6
- const fixtures = require('haraka-test-fixtures');
7
- const Plugin = fixtures.plugin;
6
+ const fixtures = require('haraka-test-fixtures')
7
+ const Plugin = fixtures.plugin
8
8
 
9
9
  const _set_up = (done) => {
10
10
  this.plugin = new Plugin('tls')
11
- this.connection = new fixtures.connection.createConnection();
11
+ this.connection = new fixtures.connection.createConnection()
12
12
 
13
13
  // use test/config instead of ./config
14
- this.plugin.config = this.plugin.config.module_config(path.resolve('test'));
15
- this.plugin.net_utils.config = this.plugin.net_utils.config.module_config(path.resolve('test'));
14
+ this.plugin.config = this.plugin.config.module_config(path.resolve('test'))
15
+ this.plugin.net_utils.config = this.plugin.net_utils.config.module_config(path.resolve('test'))
16
16
 
17
- this.plugin.tls_opts = {};
18
- done();
17
+ this.plugin.tls_opts = {}
18
+ done()
19
19
  }
20
20
 
21
- describe('tls', ()=> {
21
+ describe('tls', () => {
22
22
  beforeEach(_set_up)
23
23
 
24
24
  it('has function register', () => {
25
- assert.ok(this.plugin);
26
- assert.equal('function', typeof this.plugin.register);
25
+ assert.ok(this.plugin)
26
+ assert.equal('function', typeof this.plugin.register)
27
27
  })
28
28
 
29
29
  it('has function upgrade_connection', () => {
30
- assert.equal('function', typeof this.plugin.upgrade_connection);
30
+ assert.equal('function', typeof this.plugin.upgrade_connection)
31
31
  })
32
32
 
33
33
  it('has function advertise_starttls', () => {
34
- assert.equal('function', typeof this.plugin.advertise_starttls);
34
+ assert.equal('function', typeof this.plugin.advertise_starttls)
35
35
  })
36
36
 
37
37
  it('has function emit_upgrade_msg', () => {
38
- assert.equal('function', typeof this.plugin.emit_upgrade_msg);
38
+ assert.equal('function', typeof this.plugin.emit_upgrade_msg)
39
39
  })
40
40
 
41
- describe('register', ()=> {
41
+ describe('register', () => {
42
42
  it('with certs, should call register_hook()', () => {
43
- this.plugin.register();
44
- assert.ok(this.plugin.register_hook.called);
43
+ this.plugin.register()
44
+ assert.ok(this.plugin.register_hook.called)
45
45
  })
46
46
  })
47
47
 
48
- describe('emit_upgrade_msg', ()=> {
49
-
48
+ describe('emit_upgrade_msg', () => {
50
49
  it('should emit a log message', () => {
51
- assert.equal(this.plugin.emit_upgrade_msg(this.connection, true, '', {
52
- subject: {
53
- CN: 'TLS.subject',
54
- O: 'TLS.org'
55
- },
56
- }),
57
- 'secured: verified=true cn="TLS.subject" organization="TLS.org"');
50
+ assert.equal(
51
+ this.plugin.emit_upgrade_msg(this.connection, true, '', {
52
+ subject: {
53
+ CN: 'TLS.subject',
54
+ O: 'TLS.org',
55
+ },
56
+ }),
57
+ 'secured: verified=true cn="TLS.subject" organization="TLS.org"',
58
+ )
58
59
  })
59
60
 
60
61
  it('should emit a log message with error', () => {
61
- assert.equal(this.plugin.emit_upgrade_msg(this.connection, true, 'oops', {
62
- subject: {
63
- CN: 'TLS.subject',
64
- O: 'TLS.org'
65
- },
66
- }),
67
- 'secured: verified=true error="oops" cn="TLS.subject" organization="TLS.org"');
62
+ assert.equal(
63
+ this.plugin.emit_upgrade_msg(this.connection, true, 'oops', {
64
+ subject: {
65
+ CN: 'TLS.subject',
66
+ O: 'TLS.org',
67
+ },
68
+ }),
69
+ 'secured: verified=true error="oops" cn="TLS.subject" organization="TLS.org"',
70
+ )
68
71
  })
69
72
  })
70
73
  })
package/test/plugins.js CHANGED
@@ -1,14 +1,14 @@
1
- 'use strict';
1
+ 'use strict'
2
2
 
3
- process.env.WITHOUT_CONFIG_CACHE=true;
3
+ process.env.WITHOUT_CONFIG_CACHE = true
4
4
 
5
5
  const assert = require('node:assert')
6
- const fs = require('node:fs');
7
- const path = require('node:path');
6
+ const fs = require('node:fs')
7
+ const path = require('node:path')
8
8
 
9
- const plugin = require('../plugins');
9
+ const plugin = require('../plugins')
10
10
 
11
- const piName = 'testPlugin';
11
+ const piName = 'testPlugin'
12
12
 
13
13
  /*
14
14
 
@@ -42,187 +42,192 @@ From: https://github.com/haraka/Haraka/pull/1278#issuecomment-172134064
42
42
  */
43
43
 
44
44
  describe('plugin', () => {
45
-
46
45
  it('new Plugin() object', () => {
47
- const pi = new plugin.Plugin(piName);
48
- assert.ok(pi);
46
+ const pi = new plugin.Plugin(piName)
47
+ assert.ok(pi)
49
48
  })
50
49
 
51
50
  describe('get_timeout', () => {
52
- const toPath = path.resolve('config', `${piName}.timeout`);
51
+ const toPath = path.resolve('config', `${piName}.timeout`)
53
52
  it('0s', (done) => {
54
53
  fs.writeFile(toPath, '0', () => {
55
- this.plugin = new plugin.Plugin(piName);
56
- assert.equal(this.plugin.timeout, 0);
57
- fs.unlink(toPath, done);
54
+ this.plugin = new plugin.Plugin(piName)
55
+ assert.equal(this.plugin.timeout, 0)
56
+ fs.unlink(toPath, done)
58
57
  })
59
58
  })
60
59
 
61
60
  it('3s', (done) => {
62
61
  fs.writeFile(toPath, '3', () => {
63
- this.plugin = new plugin.Plugin(piName);
64
- assert.equal(this.plugin.timeout, 3);
65
- fs.unlink(toPath, done);
62
+ this.plugin = new plugin.Plugin(piName)
63
+ assert.equal(this.plugin.timeout, 3)
64
+ fs.unlink(toPath, done)
66
65
  })
67
66
  })
68
67
 
69
68
  it('60s', (done) => {
70
69
  fs.writeFile(toPath, '60', () => {
71
- this.plugin = new plugin.Plugin(piName);
72
- assert.equal(this.plugin.timeout, 60);
73
- fs.unlink(toPath, done);
70
+ this.plugin = new plugin.Plugin(piName)
71
+ assert.equal(this.plugin.timeout, 60)
72
+ fs.unlink(toPath, done)
74
73
  })
75
74
  })
76
75
 
77
76
  it('30s default (overrides NaN)', (done) => {
78
77
  fs.writeFile(toPath, 'apple', () => {
79
- this.plugin = new plugin.Plugin(piName);
80
- assert.equal(this.plugin.timeout, 30);
81
- fs.unlink(toPath, done);
78
+ this.plugin = new plugin.Plugin(piName)
79
+ assert.equal(this.plugin.timeout, 30)
80
+ fs.unlink(toPath, done)
82
81
  })
83
82
  })
84
83
  })
85
84
 
86
85
  describe('plugin_paths', () => {
87
86
  beforeEach((done) => {
88
- delete process.env.HARAKA;
87
+ delete process.env.HARAKA
89
88
  done()
90
89
  })
91
90
 
92
91
  afterEach((done) => {
93
- delete process.env.HARAKA;
92
+ delete process.env.HARAKA
94
93
  done()
95
94
  })
96
95
 
97
96
  it('CORE plugin: (tls)', () => {
98
- const p = new plugin.Plugin('tls');
97
+ const p = new plugin.Plugin('tls')
99
98
 
100
- assert.equal(p.plugin_path, path.resolve(__dirname, '..', 'plugins', 'tls.js'));
99
+ assert.equal(p.plugin_path, path.resolve(__dirname, '..', 'plugins', 'tls.js'))
101
100
  })
102
101
 
103
102
  it('INSTALLED override: (tls)', () => {
104
- process.env.HARAKA = path.resolve(__dirname, '..', 'test', 'installation');
103
+ process.env.HARAKA = path.resolve(__dirname, '..', 'test', 'installation')
105
104
 
106
- const p = new plugin.Plugin('tls');
105
+ const p = new plugin.Plugin('tls')
107
106
 
108
- assert.equal(p.plugin_path, path.resolve(__dirname, 'installation', 'plugins', 'tls.js'));
107
+ assert.equal(p.plugin_path, path.resolve(__dirname, 'installation', 'plugins', 'tls.js'))
109
108
  })
110
109
 
111
110
  it('INSTALLED node_modules package plugin: (test-plugin)', () => {
112
- process.env.HARAKA = path.resolve(__dirname, '..', 'test', 'installation');
111
+ process.env.HARAKA = path.resolve(__dirname, '..', 'test', 'installation')
113
112
 
114
- const p = new plugin.Plugin('test-plugin');
113
+ const p = new plugin.Plugin('test-plugin')
115
114
 
116
- assert.equal(p.plugin_path, path.resolve(__dirname, 'installation', 'node_modules', 'test-plugin', 'package.json'));
117
- assert.ok(p.hasPackageJson);
115
+ assert.equal(
116
+ p.plugin_path,
117
+ path.resolve(__dirname, 'installation', 'node_modules', 'test-plugin', 'package.json'),
118
+ )
119
+ assert.ok(p.hasPackageJson)
118
120
  try {
119
- p._compile();
120
- assert.ok(true, "compiles OK");
121
- }
122
- catch (e) {
123
- console.error(e.stack);
124
- assert.ok(false, "compiles OK");
121
+ p._compile()
122
+ assert.ok(true, 'compiles OK')
123
+ } catch (e) {
124
+ console.error(e.stack)
125
+ assert.ok(false, 'compiles OK')
125
126
  }
126
127
  })
127
128
 
128
129
  it('CORE package plugin: redis', () => {
129
- const p = new plugin.Plugin('haraka-plugin-redis');
130
+ const p = new plugin.Plugin('haraka-plugin-redis')
130
131
 
131
- assert.equal(p.plugin_path, path.resolve(__dirname, '..', 'node_modules', 'haraka-plugin-redis', 'package.json'));
132
- assert.ok(p.hasPackageJson);
132
+ assert.equal(
133
+ p.plugin_path,
134
+ path.resolve(__dirname, '..', 'node_modules', 'haraka-plugin-redis', 'package.json'),
135
+ )
136
+ assert.ok(p.hasPackageJson)
133
137
  })
134
138
 
135
139
  it('plugins overrides node_modules', () => {
136
- process.env.HARAKA = path.resolve(__dirname, '..', 'test', 'installation');
140
+ process.env.HARAKA = path.resolve(__dirname, '..', 'test', 'installation')
137
141
 
138
- const p = new plugin.Plugin('load_first');
142
+ const p = new plugin.Plugin('load_first')
139
143
 
140
- assert.equal(p.plugin_path, path.resolve(__dirname, 'installation', 'plugins', 'load_first.js'));
144
+ assert.equal(p.plugin_path, path.resolve(__dirname, 'installation', 'plugins', 'load_first.js'))
141
145
  try {
142
- p._compile();
143
- assert.ok(true, "compiles OK");
144
- }
145
- catch (e) {
146
- console.error(e.stack);
147
- assert.ok(false, "compiles OK");
146
+ p._compile()
147
+ assert.ok(true, 'compiles OK')
148
+ } catch (e) {
149
+ console.error(e.stack)
150
+ assert.ok(false, 'compiles OK')
148
151
  }
149
- assert.ok(p.loaded_first);
152
+ assert.ok(p.loaded_first)
150
153
  })
151
154
 
152
155
  it('INSTALLED plugins folder plugin: (folder_plugin)', () => {
153
- process.env.HARAKA = path.resolve(__dirname, '..', 'test', 'installation');
156
+ process.env.HARAKA = path.resolve(__dirname, '..', 'test', 'installation')
154
157
 
155
- const p = new plugin.Plugin('folder_plugin');
158
+ const p = new plugin.Plugin('folder_plugin')
156
159
 
157
- assert.equal(p.plugin_path, path.resolve(__dirname, 'installation', 'plugins', 'folder_plugin', 'package.json'));
158
- assert.ok(p.hasPackageJson);
160
+ assert.equal(
161
+ p.plugin_path,
162
+ path.resolve(__dirname, 'installation', 'plugins', 'folder_plugin', 'package.json'),
163
+ )
164
+ assert.ok(p.hasPackageJson)
159
165
  try {
160
- p._compile();
161
- assert.ok(true, "compiles OK");
162
- }
163
- catch (e) {
164
- console.error(e.stack);
165
- assert.ok(false, "compiles OK");
166
+ p._compile()
167
+ assert.ok(true, 'compiles OK')
168
+ } catch (e) {
169
+ console.error(e.stack)
170
+ assert.ok(false, 'compiles OK')
166
171
  }
167
172
  })
168
173
 
169
174
  it('Inheritance: (inherits)', () => {
170
- process.env.HARAKA = path.resolve(__dirname, '..', 'test', 'installation');
175
+ process.env.HARAKA = path.resolve(__dirname, '..', 'test', 'installation')
171
176
 
172
- const p = new plugin.Plugin('inherits');
177
+ const p = new plugin.Plugin('inherits')
173
178
 
174
- assert.equal(p.plugin_path, path.resolve(__dirname, 'installation', 'plugins', 'inherits.js'));
179
+ assert.equal(p.plugin_path, path.resolve(__dirname, 'installation', 'plugins', 'inherits.js'))
175
180
  try {
176
- p._compile();
177
- assert.ok(true, "compiles OK");
178
- }
179
- catch (e) {
180
- console.error(e.stack);
181
- assert.ok(false, "compiles OK");
181
+ p._compile()
182
+ assert.ok(true, 'compiles OK')
183
+ } catch (e) {
184
+ console.error(e.stack)
185
+ assert.ok(false, 'compiles OK')
182
186
  }
183
- p.register();
184
- assert.ok(p.base.base_plugin);
187
+ p.register()
188
+ assert.ok(p.base.base_plugin)
185
189
  })
186
190
  })
187
191
 
188
192
  describe('plugin_config', () => {
189
193
  beforeEach((done) => {
190
- delete process.env.HARAKA;
191
- done();
194
+ delete process.env.HARAKA
195
+ done()
192
196
  })
193
197
 
194
198
  afterEach((done) => {
195
- delete process.env.HARAKA;
196
- done();
199
+ delete process.env.HARAKA
200
+ done()
197
201
  })
198
202
 
199
203
  it('CORE plugin: (tls)', () => {
200
- const p = new plugin.Plugin('tls');
204
+ const p = new plugin.Plugin('tls')
201
205
 
202
- assert.equal(p.config.root_path, path.resolve(__dirname, '..', 'config'));
203
- assert.equal(p.config.overrides_path, undefined);
206
+ assert.equal(p.config.root_path, path.resolve(__dirname, '..', 'config'))
207
+ assert.equal(p.config.overrides_path, undefined)
204
208
  })
205
209
 
206
210
  it('INSTALLED override: (tls)', () => {
211
+ process.env.HARAKA = path.resolve(__dirname, '..', 'test', 'installation')
207
212
 
208
- process.env.HARAKA = path.resolve(__dirname, '..', 'test', 'installation');
213
+ const p = new plugin.Plugin('tls')
209
214
 
210
- const p = new plugin.Plugin('tls');
211
-
212
- assert.equal(p.config.root_path, path.resolve(__dirname, '..', 'config'));
213
- assert.equal(p.config.overrides_path, path.resolve(__dirname, 'installation', 'config'));
214
- const tls_ini = p.config.get('tls.ini');
215
- assert.equal(tls_ini.main.ciphers, 'test');
215
+ assert.equal(p.config.root_path, path.resolve(__dirname, '..', 'config'))
216
+ assert.equal(p.config.overrides_path, path.resolve(__dirname, 'installation', 'config'))
217
+ const tls_ini = p.config.get('tls.ini')
218
+ assert.equal(tls_ini.main.ciphers, 'test')
216
219
  })
217
220
 
218
221
  it('INSTALLED node_modules package plugin: (test-plugin)', () => {
222
+ process.env.HARAKA = path.resolve(__dirname, '..', 'test', 'installation')
219
223
 
220
- process.env.HARAKA = path.resolve(__dirname, '..', 'test', 'installation');
221
-
222
- const p = new plugin.Plugin('test-plugin');
224
+ const p = new plugin.Plugin('test-plugin')
223
225
 
224
- assert.equal(p.config.root_path, path.resolve(__dirname, 'installation', 'node_modules', 'test-plugin', 'config'));
225
- assert.equal(p.config.overrides_path, path.resolve(__dirname, 'installation', 'config'));
226
+ assert.equal(
227
+ p.config.root_path,
228
+ path.resolve(__dirname, 'installation', 'node_modules', 'test-plugin', 'config'),
229
+ )
230
+ assert.equal(p.config.overrides_path, path.resolve(__dirname, 'installation', 'config'))
226
231
  })
227
232
  })
228
233
  })
package/test/rfc1869.js CHANGED
@@ -1,73 +1,66 @@
1
1
  const assert = require('node:assert')
2
2
 
3
- const { parse } = require('../rfc1869');
3
+ const { parse } = require('../rfc1869')
4
4
 
5
- function _check (line, expected) {
6
- const match = /^(MAIL|RCPT)\s+(.*)$/.exec(line);
7
- const parsed = parse(match[1].toLowerCase(), match[2]);
8
- assert.equal(parsed.length, expected.length);
5
+ function _check(line, expected) {
6
+ const match = /^(MAIL|RCPT)\s+(.*)$/.exec(line)
7
+ const parsed = parse(match[1].toLowerCase(), match[2])
8
+ assert.equal(parsed.length, expected.length)
9
9
  for (let x = 0; x < expected.length; x++) {
10
- assert.equal(parsed[x], expected[x]);
10
+ assert.equal(parsed[x], expected[x])
11
11
  }
12
12
  }
13
13
 
14
14
  describe('rfc1869', () => {
15
15
  it('MAIL FROM:<>', () => {
16
- _check('MAIL FROM:<>', ['<>']);
16
+ _check('MAIL FROM:<>', ['<>'])
17
17
  })
18
18
 
19
19
  it('MAIL FROM:', () => {
20
- _check('MAIL FROM:', ['<>']);
20
+ _check('MAIL FROM:', ['<>'])
21
21
  })
22
22
 
23
23
  it('MAIL FROM:<postmaster>', () => {
24
- _check('MAIL FROM:<postmaster>', ['<postmaster>']);
24
+ _check('MAIL FROM:<postmaster>', ['<postmaster>'])
25
25
  })
26
26
 
27
27
  it('MAIL FROM:user', () => {
28
- _check('MAIL FROM:user', ['user']);
28
+ _check('MAIL FROM:user', ['user'])
29
29
  })
30
30
 
31
31
  it('MAIL FROM:user size=1234', () => {
32
- _check('MAIL FROM:user size=1234', ['user', 'size=1234']);
32
+ _check('MAIL FROM:user size=1234', ['user', 'size=1234'])
33
33
  })
34
34
 
35
35
  it('MAIL FROM:user@domain size=1234', () => {
36
- _check('MAIL FROM:user@domain size=1234',
37
- ['user@domain', 'size=1234']);
36
+ _check('MAIL FROM:user@domain size=1234', ['user@domain', 'size=1234'])
38
37
  })
39
38
 
40
39
  it('MAIL FROM:<user@domain> size=1234', () => {
41
- _check('MAIL FROM:<user@domain> size=1234',
42
- ['<user@domain>', 'size=1234']);
40
+ _check('MAIL FROM:<user@domain> size=1234', ['<user@domain>', 'size=1234'])
43
41
  })
44
42
 
45
43
  it('MAIL FROM:<user@domain> somekey', () => {
46
- _check('MAIL FROM:<user@domain> somekey',
47
- ['<user@domain>', 'somekey']);
44
+ _check('MAIL FROM:<user@domain> somekey', ['<user@domain>', 'somekey'])
48
45
  })
49
46
 
50
47
  it('MAIL FROM:<user@domain> somekey other=foo', () => {
51
- _check('MAIL FROM:<user@domain> somekey other=foo',
52
- ['<user@domain>', 'somekey', 'other=foo']);
48
+ _check('MAIL FROM:<user@domain> somekey other=foo', ['<user@domain>', 'somekey', 'other=foo'])
53
49
  })
54
50
 
55
51
  it('RCPT TO ugly', () => {
56
- _check('RCPT TO: 0@mailblog.biz 0=9 1=9',
57
- ['<0@mailblog.biz>', '0=9', '1=9']);
52
+ _check('RCPT TO: 0@mailblog.biz 0=9 1=9', ['<0@mailblog.biz>', '0=9', '1=9'])
58
53
  })
59
54
 
60
55
  it('RCPT TO:<r86x-ray@emailitin.com> state=1', () => {
61
- _check('RCPT TO:<r86x-ray@emailitin.com> state=1',
62
- ['<r86x-ray@emailitin.com>', 'state=1']);
56
+ _check('RCPT TO:<r86x-ray@emailitin.com> state=1', ['<r86x-ray@emailitin.com>', 'state=1'])
63
57
  })
64
58
 
65
59
  it('RCPT TO:<user=name@domain.com> foo=bar', () => {
66
- _check('RCPT TO:<user=name@domain.com> foo=bar',
67
- ['<user=name@domain.com>', 'foo=bar']);
60
+ _check('RCPT TO:<user=name@domain.com> foo=bar', ['<user=name@domain.com>', 'foo=bar'])
68
61
  })
69
62
 
70
63
  it('RCPT TO:<postmaster>', () => {
71
- _check('RCPT TO:<postmaster>', ['<postmaster>']);
64
+ _check('RCPT TO:<postmaster>', ['<postmaster>'])
72
65
  })
73
66
  })