Haraka 3.1.1 → 3.1.3

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 (168) hide show
  1. package/.prettierignore +4 -0
  2. package/CONTRIBUTORS.md +5 -5
  3. package/Changes.md +72 -50
  4. package/Plugins.md +3 -1
  5. package/README.md +1 -1
  6. package/bin/haraka +475 -479
  7. package/config/connection.ini +10 -0
  8. package/config/outbound.ini +3 -0
  9. package/config/smtp.ini +0 -9
  10. package/connection.js +1072 -1108
  11. package/docs/Connection.md +29 -30
  12. package/docs/CoreConfig.md +38 -40
  13. package/docs/CustomReturnCodes.md +0 -1
  14. package/docs/HAProxy.md +2 -2
  15. package/docs/Header.md +1 -1
  16. package/docs/Logging.md +29 -5
  17. package/docs/Outbound.md +93 -78
  18. package/docs/Plugins.md +103 -108
  19. package/docs/Transaction.md +49 -51
  20. package/docs/Tutorial.md +127 -143
  21. package/docs/deprecated/access.md +0 -1
  22. package/docs/deprecated/backscatterer.md +2 -3
  23. package/docs/deprecated/connect.rdns_access.md +18 -27
  24. package/docs/deprecated/data.headers.md +0 -1
  25. package/docs/deprecated/data.nomsgid.md +1 -2
  26. package/docs/deprecated/data.noreceived.md +1 -2
  27. package/docs/deprecated/data.rfc5322_header_checks.md +1 -2
  28. package/docs/deprecated/dkim_sign.md +13 -17
  29. package/docs/deprecated/dkim_verify.md +9 -17
  30. package/docs/deprecated/dnsbl.md +36 -38
  31. package/docs/deprecated/dnswl.md +41 -43
  32. package/docs/deprecated/lookup_rdns.strict.md +21 -34
  33. package/docs/deprecated/mail_from.access.md +17 -25
  34. package/docs/deprecated/mail_from.blocklist.md +9 -12
  35. package/docs/deprecated/mail_from.nobounces.md +1 -2
  36. package/docs/deprecated/rcpt_to.access.md +20 -27
  37. package/docs/deprecated/rcpt_to.blocklist.md +10 -13
  38. package/docs/deprecated/rcpt_to.routes.md +0 -1
  39. package/docs/deprecated/rdns.regexp.md +13 -15
  40. package/docs/plugins/aliases.md +89 -89
  41. package/docs/plugins/auth/auth_bridge.md +5 -7
  42. package/docs/plugins/auth/auth_ldap.md +11 -14
  43. package/docs/plugins/auth/auth_proxy.md +10 -12
  44. package/docs/plugins/auth/auth_vpopmaild.md +5 -6
  45. package/docs/plugins/auth/flat_file.md +4 -4
  46. package/docs/plugins/block_me.md +3 -3
  47. package/docs/plugins/data.signatures.md +1 -2
  48. package/docs/plugins/delay_deny.md +3 -4
  49. package/docs/plugins/max_unrecognized_commands.md +4 -4
  50. package/docs/plugins/prevent_credential_leaks.md +6 -6
  51. package/docs/plugins/process_title.md +18 -18
  52. package/docs/plugins/queue/deliver.md +2 -3
  53. package/docs/plugins/queue/discard.md +4 -4
  54. package/docs/plugins/queue/lmtp.md +1 -3
  55. package/docs/plugins/queue/qmail-queue.md +7 -9
  56. package/docs/plugins/queue/quarantine.md +16 -21
  57. package/docs/plugins/queue/rabbitmq.md +8 -11
  58. package/docs/plugins/queue/rabbitmq_amqplib.md +43 -39
  59. package/docs/plugins/queue/smtp_bridge.md +7 -10
  60. package/docs/plugins/queue/smtp_forward.md +42 -34
  61. package/docs/plugins/queue/smtp_proxy.md +30 -29
  62. package/docs/plugins/queue/test.md +1 -3
  63. package/docs/plugins/rcpt_to.in_host_list.md +6 -6
  64. package/docs/plugins/rcpt_to.max_count.md +1 -1
  65. package/docs/plugins/record_envelope_addresses.md +3 -3
  66. package/docs/plugins/reseed_rng.md +6 -6
  67. package/docs/plugins/status.md +9 -8
  68. package/docs/plugins/tarpit.md +7 -11
  69. package/docs/plugins/tls.md +12 -17
  70. package/docs/plugins/toobusy.md +4 -4
  71. package/docs/plugins/xclient.md +3 -3
  72. package/docs/tutorials/Migrating_from_v1_to_v2.md +19 -41
  73. package/docs/tutorials/SettingUpOutbound.md +6 -9
  74. package/endpoint.js +35 -38
  75. package/eslint.config.mjs +22 -19
  76. package/haraka.js +42 -47
  77. package/host_pool.js +75 -79
  78. package/http/html/404.html +45 -49
  79. package/http/html/index.html +39 -28
  80. package/http/package.json +2 -4
  81. package/line_socket.js +27 -28
  82. package/logger.js +182 -201
  83. package/outbound/client_pool.js +33 -33
  84. package/outbound/config.js +64 -59
  85. package/outbound/fsync_writestream.js +24 -25
  86. package/outbound/hmail.js +888 -835
  87. package/outbound/index.js +194 -187
  88. package/outbound/qfile.js +49 -52
  89. package/outbound/queue.js +197 -190
  90. package/outbound/timer_queue.js +41 -43
  91. package/outbound/tls.js +68 -61
  92. package/outbound/todo.js +11 -11
  93. package/package.json +35 -36
  94. package/plugins/.eslintrc.yaml +0 -1
  95. package/plugins/auth/auth_base.js +123 -127
  96. package/plugins/auth/auth_bridge.js +7 -7
  97. package/plugins/auth/auth_proxy.js +121 -126
  98. package/plugins/auth/auth_vpopmaild.js +84 -85
  99. package/plugins/auth/flat_file.js +18 -17
  100. package/plugins/block_me.js +31 -31
  101. package/plugins/data.signatures.js +13 -13
  102. package/plugins/delay_deny.js +65 -61
  103. package/plugins/prevent_credential_leaks.js +23 -23
  104. package/plugins/process_title.js +125 -128
  105. package/plugins/profile.js +5 -5
  106. package/plugins/queue/deliver.js +3 -3
  107. package/plugins/queue/discard.js +13 -14
  108. package/plugins/queue/lmtp.js +16 -17
  109. package/plugins/queue/qmail-queue.js +54 -55
  110. package/plugins/queue/quarantine.js +68 -70
  111. package/plugins/queue/rabbitmq.js +80 -87
  112. package/plugins/queue/rabbitmq_amqplib.js +75 -54
  113. package/plugins/queue/smtp_bridge.js +16 -16
  114. package/plugins/queue/smtp_forward.js +175 -179
  115. package/plugins/queue/smtp_proxy.js +69 -71
  116. package/plugins/queue/test.js +9 -9
  117. package/plugins/rcpt_to.host_list_base.js +30 -34
  118. package/plugins/rcpt_to.in_host_list.js +19 -19
  119. package/plugins/record_envelope_addresses.js +4 -4
  120. package/plugins/reseed_rng.js +4 -4
  121. package/plugins/status.js +90 -97
  122. package/plugins/tarpit.js +25 -14
  123. package/plugins/tls.js +68 -68
  124. package/plugins/toobusy.js +21 -23
  125. package/plugins/xclient.js +51 -53
  126. package/plugins.js +276 -293
  127. package/rfc1869.js +30 -35
  128. package/server.js +308 -299
  129. package/smtp_client.js +244 -228
  130. package/test/.eslintrc.yaml +0 -1
  131. package/test/connection.js +127 -134
  132. package/test/endpoint.js +53 -47
  133. package/test/fixtures/line_socket.js +12 -12
  134. package/test/fixtures/util_hmailitem.js +89 -85
  135. package/test/host_pool.js +90 -92
  136. package/test/installation/plugins/base_plugin.js +2 -2
  137. package/test/installation/plugins/folder_plugin/index.js +2 -3
  138. package/test/installation/plugins/inherits.js +3 -3
  139. package/test/installation/plugins/load_first.js +2 -3
  140. package/test/installation/plugins/plugin.js +1 -3
  141. package/test/installation/plugins/tls.js +2 -4
  142. package/test/logger.js +135 -116
  143. package/test/outbound/hmail.js +49 -35
  144. package/test/outbound/index.js +118 -101
  145. package/test/outbound/qfile.js +51 -53
  146. package/test/outbound_bounce_net_errors.js +84 -69
  147. package/test/outbound_bounce_rfc3464.js +235 -165
  148. package/test/plugins/auth/auth_base.js +420 -279
  149. package/test/plugins/auth/auth_vpopmaild.js +38 -39
  150. package/test/plugins/queue/smtp_forward.js +126 -104
  151. package/test/plugins/rcpt_to.host_list_base.js +85 -67
  152. package/test/plugins/rcpt_to.in_host_list.js +159 -112
  153. package/test/plugins/status.js +71 -64
  154. package/test/plugins/tls.js +37 -34
  155. package/test/plugins.js +97 -92
  156. package/test/rfc1869.js +19 -26
  157. package/test/server.js +293 -272
  158. package/test/smtp_client.js +180 -176
  159. package/test/tls_socket.js +62 -66
  160. package/test/transaction.js +159 -160
  161. package/tls_socket.js +331 -333
  162. package/transaction.js +129 -137
  163. package/config/me +0 -1
  164. package/config/tls_cert.pem +0 -23
  165. package/config/tls_key.pem +0 -28
  166. package/test/queue/multibyte +0 -0
  167. package/test/queue/plain +0 -0
  168. package/test/test-queue/delete-me +0 -0
@@ -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
  })