Haraka 3.0.3 → 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.
Files changed (238) hide show
  1. package/.eslintrc.yaml +5 -9
  2. package/.prettierrc.yml +1 -0
  3. package/CONTRIBUTORS.md +11 -0
  4. package/Changes.md +1365 -1214
  5. package/Plugins.md +117 -105
  6. package/README.md +4 -13
  7. package/bin/haraka +197 -298
  8. package/config/auth_flat_file.ini +1 -0
  9. package/config/dhparams.pem +8 -0
  10. package/config/mail_from.is_resolvable.ini +4 -2
  11. package/config/me +1 -0
  12. package/config/outbound.ini +0 -2
  13. package/config/plugins +36 -35
  14. package/config/smtp.ini +0 -1
  15. package/config/smtp.json +17 -0
  16. package/config/tls_cert.pem +23 -0
  17. package/config/tls_key.pem +28 -0
  18. package/connection.js +46 -73
  19. package/contrib/bsd-rc.d/haraka +3 -1
  20. package/contrib/plugin2npm.sh +6 -36
  21. package/docs/CoreConfig.md +2 -2
  22. package/docs/Logging.md +7 -21
  23. package/docs/Outbound.md +104 -201
  24. package/docs/Plugins.md +2 -2
  25. package/docs/Transaction.md +59 -82
  26. package/docs/plugins/queue/smtp_proxy.md +5 -10
  27. package/docs/plugins/tls.md +29 -9
  28. package/endpoint.js +16 -13
  29. package/haraka.js +10 -14
  30. package/host_pool.js +5 -5
  31. package/line_socket.js +3 -4
  32. package/logger.js +44 -28
  33. package/outbound/client_pool.js +27 -23
  34. package/outbound/config.js +4 -6
  35. package/outbound/fsync_writestream.js +1 -1
  36. package/outbound/hmail.js +178 -218
  37. package/outbound/index.js +86 -99
  38. package/outbound/qfile.js +1 -1
  39. package/outbound/queue.js +51 -44
  40. package/outbound/timer_queue.js +3 -2
  41. package/outbound/tls.js +19 -7
  42. package/package.json +59 -48
  43. package/plugins/.eslintrc.yaml +0 -6
  44. package/plugins/auth/auth_base.js +4 -2
  45. package/plugins/auth/auth_proxy.js +14 -12
  46. package/plugins/auth/auth_vpopmaild.js +1 -1
  47. package/plugins/block_me.js +1 -1
  48. package/plugins/data.signatures.js +2 -4
  49. package/plugins/early_talker.js +2 -1
  50. package/plugins/mail_from.is_resolvable.js +65 -135
  51. package/plugins/queue/deliver.js +4 -5
  52. package/plugins/queue/lmtp.js +11 -14
  53. package/plugins/queue/qmail-queue.js +2 -2
  54. package/plugins/queue/quarantine.js +2 -2
  55. package/plugins/queue/rabbitmq.js +16 -17
  56. package/plugins/queue/smtp_forward.js +3 -3
  57. package/plugins/queue/smtp_proxy.js +10 -1
  58. package/plugins/queue/test.js +2 -2
  59. package/plugins/rcpt_to.host_list_base.js +5 -5
  60. package/plugins/rcpt_to.in_host_list.js +2 -2
  61. package/plugins/relay.js +6 -7
  62. package/plugins/reseed_rng.js +1 -1
  63. package/plugins/status.js +37 -33
  64. package/plugins/tls.js +2 -2
  65. package/plugins/xclient.js +3 -2
  66. package/plugins.js +50 -54
  67. package/run_tests +3 -30
  68. package/server.js +190 -190
  69. package/smtp_client.js +30 -23
  70. package/{tests → test}/config/plugins +0 -2
  71. package/{tests → test}/config/smtp.ini +1 -1
  72. package/test/config/tls/example.com/_.example.com.key +28 -0
  73. package/test/config/tls/example.com/example.com.crt +25 -0
  74. package/test/connection.js +302 -0
  75. package/test/endpoint.js +94 -0
  76. package/{tests → test}/fixtures/line_socket.js +1 -1
  77. package/{tests → test}/fixtures/util_hmailitem.js +19 -25
  78. package/{tests → test}/host_pool.js +42 -57
  79. package/test/logger.js +258 -0
  80. package/test/outbound/hmail.js +141 -0
  81. package/test/outbound/index.js +220 -0
  82. package/test/outbound/qfile.js +126 -0
  83. package/test/outbound_bounce_net_errors.js +142 -0
  84. package/{tests → test}/outbound_bounce_rfc3464.js +110 -122
  85. package/test/plugins/auth/auth_base.js +484 -0
  86. package/test/plugins/auth/auth_vpopmaild.js +83 -0
  87. package/test/plugins/early_talker.js +104 -0
  88. package/test/plugins/mail_from.is_resolvable.js +35 -0
  89. package/test/plugins/queue/smtp_forward.js +206 -0
  90. package/test/plugins/rcpt_to.host_list_base.js +122 -0
  91. package/test/plugins/rcpt_to.in_host_list.js +193 -0
  92. package/test/plugins/relay.js +303 -0
  93. package/test/plugins/status.js +130 -0
  94. package/test/plugins/tls.js +70 -0
  95. package/test/plugins.js +228 -0
  96. package/test/rfc1869.js +73 -0
  97. package/test/server.js +491 -0
  98. package/test/smtp_client.js +299 -0
  99. package/test/tls_socket.js +273 -0
  100. package/test/transaction.js +270 -0
  101. package/tls_socket.js +202 -252
  102. package/transaction.js +8 -23
  103. package/CONTRIBUTING.md +0 -1
  104. package/bin/dkimverify +0 -40
  105. package/config/access.domains +0 -13
  106. package/config/attachment.ctype.regex +0 -2
  107. package/config/attachment.filename.regex +0 -1
  108. package/config/avg.ini +0 -5
  109. package/config/bounce.ini +0 -15
  110. package/config/data.headers.ini +0 -61
  111. package/config/dkim/dkim_key_gen.sh +0 -78
  112. package/config/dkim_sign.ini +0 -4
  113. package/config/dkim_verify.ini +0 -7
  114. package/config/dnsbl.ini +0 -23
  115. package/config/greylist.ini +0 -43
  116. package/config/helo.checks.ini +0 -52
  117. package/config/messagesniffer.ini +0 -18
  118. package/config/spamassassin.ini +0 -56
  119. package/dkim.js +0 -614
  120. package/docs/plugins/avg.md +0 -35
  121. package/docs/plugins/bounce.md +0 -69
  122. package/docs/plugins/clamd.md +0 -147
  123. package/docs/plugins/esets.md +0 -8
  124. package/docs/plugins/greylist.md +0 -90
  125. package/docs/plugins/helo.checks.md +0 -135
  126. package/docs/plugins/messagesniffer.md +0 -163
  127. package/docs/plugins/spamassassin.md +0 -180
  128. package/outbound/mx_lookup.js +0 -70
  129. package/plugins/auth/auth_ldap.js +0 -3
  130. package/plugins/avg.js +0 -162
  131. package/plugins/backscatterer.js +0 -25
  132. package/plugins/bounce.js +0 -381
  133. package/plugins/clamd.js +0 -382
  134. package/plugins/data.uribl.js +0 -4
  135. package/plugins/dkim_sign.js +0 -395
  136. package/plugins/dkim_verify.js +0 -62
  137. package/plugins/dns_list_base.js +0 -221
  138. package/plugins/dnsbl.js +0 -146
  139. package/plugins/dnswl.js +0 -58
  140. package/plugins/esets.js +0 -71
  141. package/plugins/graph.js +0 -5
  142. package/plugins/greylist.js +0 -645
  143. package/plugins/helo.checks.js +0 -533
  144. package/plugins/messagesniffer.js +0 -381
  145. package/plugins/rcpt_to.ldap.js +0 -3
  146. package/plugins/rcpt_to.max_count.js +0 -24
  147. package/plugins/spamassassin.js +0 -384
  148. package/tests/config/dkim/example.com/dns +0 -29
  149. package/tests/config/dkim/example.com/private +0 -6
  150. package/tests/config/dkim/example.com/public +0 -4
  151. package/tests/config/dkim/example.com/selector +0 -1
  152. package/tests/config/dkim.private.key +0 -6
  153. package/tests/config/dkim_sign.ini +0 -4
  154. package/tests/config/helo.checks.ini +0 -52
  155. package/tests/connection.js +0 -327
  156. package/tests/endpoint.js +0 -128
  157. package/tests/fixtures/vm_harness.js +0 -59
  158. package/tests/logger.js +0 -327
  159. package/tests/outbound/hmail.js +0 -112
  160. package/tests/outbound/index.js +0 -324
  161. package/tests/outbound/qfile.js +0 -67
  162. package/tests/outbound_bounce_net_errors.js +0 -173
  163. package/tests/plugins/auth/auth_base.js +0 -463
  164. package/tests/plugins/auth/auth_vpopmaild.js +0 -91
  165. package/tests/plugins/bounce.js +0 -307
  166. package/tests/plugins/clamd.js +0 -224
  167. package/tests/plugins/deprecated/relay_acl.js +0 -140
  168. package/tests/plugins/deprecated/relay_all.js +0 -59
  169. package/tests/plugins/dkim_sign.js +0 -315
  170. package/tests/plugins/dkim_signer.js +0 -108
  171. package/tests/plugins/dns_list_base.js +0 -259
  172. package/tests/plugins/dnsbl.js +0 -101
  173. package/tests/plugins/early_talker.js +0 -115
  174. package/tests/plugins/greylist.js +0 -58
  175. package/tests/plugins/helo.checks.js +0 -525
  176. package/tests/plugins/mail_from.is_resolvable.js +0 -116
  177. package/tests/plugins/queue/smtp_forward.js +0 -221
  178. package/tests/plugins/rcpt_to.host_list_base.js +0 -132
  179. package/tests/plugins/rcpt_to.in_host_list.js +0 -218
  180. package/tests/plugins/relay.js +0 -339
  181. package/tests/plugins/spamassassin.js +0 -171
  182. package/tests/plugins/status.js +0 -138
  183. package/tests/plugins/tls.js +0 -84
  184. package/tests/plugins.js +0 -247
  185. package/tests/rfc1869.js +0 -61
  186. package/tests/server.js +0 -510
  187. package/tests/smtp_client/auth.js +0 -105
  188. package/tests/smtp_client/basic.js +0 -101
  189. package/tests/smtp_client.js +0 -80
  190. package/tests/tls_socket.js +0 -333
  191. package/tests/transaction.js +0 -284
  192. /package/docs/{plugins → deprecated}/dkim_sign.md +0 -0
  193. /package/docs/{plugins → deprecated}/dkim_verify.md +0 -0
  194. /package/docs/{plugins → deprecated}/dnsbl.md +0 -0
  195. /package/docs/{plugins → deprecated}/dnswl.md +0 -0
  196. /package/{tests → test}/.eslintrc.yaml +0 -0
  197. /package/{tests → test}/config/auth_flat_file.ini +0 -0
  198. /package/{tests → test}/config/dhparams.pem +0 -0
  199. /package/{tests → test}/config/host_list +0 -0
  200. /package/{tests → test}/config/outbound_tls_cert.pem +0 -0
  201. /package/{tests → test}/config/outbound_tls_key.pem +0 -0
  202. /package/{tests → test}/config/smtp_forward.ini +0 -0
  203. /package/{tests → test}/config/tls/ec.pem +0 -0
  204. /package/{tests → test}/config/tls/haraka.local.pem +0 -0
  205. /package/{tests → test}/config/tls/mismatched.pem +0 -0
  206. /package/{tests → test}/config/tls.ini +0 -0
  207. /package/{tests → test}/config/tls_cert.pem +0 -0
  208. /package/{tests → test}/config/tls_key.pem +0 -0
  209. /package/{tests → test}/fixtures/todo_qfile.txt +0 -0
  210. /package/{tests → test}/installation/config/test-plugin-flat +0 -0
  211. /package/{tests → test}/installation/config/test-plugin.ini +0 -0
  212. /package/{tests → test}/installation/config/tls.ini +0 -0
  213. /package/{tests → test}/installation/node_modules/load_first/index.js +0 -0
  214. /package/{tests → test}/installation/node_modules/load_first/package.json +0 -0
  215. /package/{tests → test}/installation/node_modules/test-plugin/config/test-plugin-flat +0 -0
  216. /package/{tests → test}/installation/node_modules/test-plugin/config/test-plugin.ini +0 -0
  217. /package/{tests → test}/installation/node_modules/test-plugin/package.json +0 -0
  218. /package/{tests → test}/installation/node_modules/test-plugin/test-plugin.js +0 -0
  219. /package/{tests → test}/installation/plugins/base_plugin.js +0 -0
  220. /package/{tests → test}/installation/plugins/folder_plugin/index.js +0 -0
  221. /package/{tests → test}/installation/plugins/folder_plugin/package.json +0 -0
  222. /package/{tests → test}/installation/plugins/inherits.js +0 -0
  223. /package/{tests → test}/installation/plugins/load_first.js +0 -0
  224. /package/{tests → test}/installation/plugins/plugin.js +0 -0
  225. /package/{tests → test}/installation/plugins/tls.js +0 -0
  226. /package/{tests → test}/loud/config/dhparams.pem +0 -0
  227. /package/{tests → test}/loud/config/tls/goobered.pem +0 -0
  228. /package/{tests → test}/loud/config/tls.ini +0 -0
  229. /package/{tests → test}/mail_specimen/base64-root-part.txt +0 -0
  230. /package/{tests → test}/mail_specimen/varied-fold-lengths-preserve-data.txt +0 -0
  231. /package/{tests → test}/queue/1507509981169_1507509981169_0_61403_e0Y0Ym_1_fixed +0 -0
  232. /package/{tests → test}/queue/1507509981169_1507509981169_0_61403_e0Y0Ym_1_haraka +0 -0
  233. /package/{tests → test}/queue/1508269674999_1508269674999_0_34002_socVUF_1_haraka +0 -0
  234. /package/{tests → test}/queue/1508455115683_1508455115683_0_90253_9Q4o4V_1_haraka +0 -0
  235. /package/{tests → test}/queue/multibyte +0 -0
  236. /package/{tests → test}/queue/plain +0 -0
  237. /package/{tests → test}/queue/zero-length +0 -0
  238. /package/{tests → test}/test-queue/delete-me +0 -0
@@ -1,4 +1,6 @@
1
1
  timeout=29
2
- allow_mx_ip=0
3
- reject_no_mx=1
2
+ allow_mx_ip=false
4
3
  re_bogus_ip=^(?:0\.0\.0\.0|255\.255\.255\.255|127\.)
4
+
5
+ [reject]
6
+ no_mx=true
package/config/me ADDED
@@ -0,0 +1 @@
1
+ home.simerson.net
@@ -11,8 +11,6 @@
11
11
 
12
12
  ; maxTempFailures (default: 13)
13
13
 
14
- ; ipv6_enabled (default: false)
15
-
16
14
  ; load_pid_queue
17
15
  ; flush_queue
18
16
 
package/config/plugins CHANGED
@@ -1,71 +1,72 @@
1
1
  # This file lists plugins that Haraka will run
2
2
  #
3
3
  # Plugin ordering often matters, run 'haraka -o -c /path/to/haraka/config'
4
- # to see the order plugins (and their hooks) will run in.
4
+ # to see the order plugins (and their hooks) will run.
5
5
  #
6
- # To see a list of all plugins, run 'haraka -l'
6
+ # To see a list of installed plugins, run 'haraka -l'
7
7
  #
8
- # To see the help docs for a particular plugin, run 'haraka -h plugin.name'
8
+ # The plugin registry: https://github.com/haraka/Haraka/blob/master/Plugins.md
9
+ #
10
+ # To see the docs for a plugin, run 'haraka -h plugin.name'
9
11
 
10
- #status
11
- #process_title
12
- # Log to syslog (see 'haraka -h syslog')
12
+ # status
13
+ # process_title
13
14
  # syslog
15
+ # watch
14
16
 
15
17
  # CONNECT
16
- #toobusy
17
- #karma
18
- #relay
19
- # control which IPs, rDNS hostnames, HELO hostnames, MAIL FROM addresses, and
20
- # RCPT TO address you accept mail from. See 'haraka -h access'.
18
+ # ----------
19
+ # toobusy
20
+ # karma
21
+ # relay
21
22
  # access
22
23
  # p0f
23
24
  # geoip
24
25
  # asn
25
26
  # fcrdns
26
- # block mails from known bad hosts (see config/dnsbl.zones for the DNS zones queried)
27
- dnsbl
27
+ # dns-list
28
28
 
29
29
  # HELO
30
- #early_talker
31
- # see config/helo.checks.ini for configuration
32
- helo.checks
33
- # see 'haraka -h tls' for config instructions before enabling!
30
+ # ----------
31
+ # early_talker
32
+ # helo.checks
33
+ # see 'haraka -h tls' before enabling!
34
34
  # tls
35
35
  #
36
36
  # AUTH plugins require TLS before AUTH is advertised, see
37
37
  # https://github.com/haraka/Haraka/wiki/Require-SSL-TLS
38
+ # ----------
38
39
  # auth/flat_file
39
40
  # auth/auth_proxy
40
41
  # auth/auth_ldap
41
42
 
42
43
  # MAIL FROM
43
- # Only accept mail where the MAIL FROM domain is resolvable to an MX record
44
+ # ----------
44
45
  mail_from.is_resolvable
45
- #spf
46
+ # spf
46
47
 
47
48
  # RCPT TO
48
- # At least one rcpt_to plugin is REQUIRED for inbound email. The simplest
49
- # plugin is in_host_list, see 'haraka -h rcpt_to.in_host_list' to configure.
49
+ # ----------
50
+ # At least one rcpt_to plugin is REQUIRED for inbound email.
50
51
  rcpt_to.in_host_list
51
- #qmail-deliverable
52
- #rcpt_to.ldap
53
- #rcpt_to.routes
52
+ # qmail-deliverable
53
+ # rcpt_to.ldap
54
+ # rcpt_to.routes
54
55
 
55
56
  # DATA
56
- #bounce
57
- # Check mail headers are valid
58
- headers
59
- #uribl
60
- #attachment
61
- #clamd
62
- #spamassassin
63
- #dkim_sign
64
- #limit
57
+ # ----------
58
+ # attachment
59
+ # bounce
60
+ # clamd
61
+ # dkim
62
+ # headers
63
+ # limit
64
+ # rspamd
65
+ # spamassassin
66
+ # uribl
65
67
 
66
68
  # QUEUE
69
+ # ----------
67
70
  # queues: discard qmail-queue quarantine smtp_forward smtp_proxy
68
71
  # Queue mail via smtp - see config/smtp_forward.ini for where your mail goes
69
72
  queue/smtp_forward
70
-
71
- #watch
package/config/smtp.ini CHANGED
@@ -54,7 +54,6 @@
54
54
  ;add_received=true
55
55
  ;clean_auth_results=true
56
56
 
57
- ; replace header_hide_version
58
57
  ;show_version=true
59
58
 
60
59
  ; replace max_header_lines
@@ -0,0 +1,17 @@
1
+ {
2
+ "!smtp.ini": {
3
+ "main": {
4
+ "listen": "[::0]:25, [::0]:465, [::0]:587",
5
+ "nodes": 1
6
+ },
7
+ "headers": {
8
+ "max_lines": 1000,
9
+ "max_received": 100
10
+ }
11
+ },
12
+ "!relay.ini": {
13
+ "relay": {
14
+ "acl": true
15
+ }
16
+ }
17
+ }
@@ -0,0 +1,23 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIID3zCCAsegAwIBAgIULzqgBA7/eKhkpsSvZ3OzpAWLkYEwDQYJKoZIhvc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 +1,9 @@
1
1
  'use strict';
2
2
  // a single connection
3
3
 
4
- // node.js built-in libs
5
- const dns = require('dns');
6
- const fs = require('fs');
7
- const net = require('net');
8
- const os = require('os');
9
- const path = require('path');
4
+ const dns = require('node:dns');
5
+ const net = require('node:net');
6
+ const os = require('node:os');
10
7
 
11
8
  // npm libs
12
9
  const ipaddr = require('ipaddr.js');
@@ -55,36 +52,36 @@ class Connection {
55
52
  this.server = server;
56
53
  this.cfg = cfg;
57
54
 
58
- this.local = { // legacy property locations
59
- ip: null, // c.local_ip
60
- port: null, // c.local_port
55
+ this.local = {
56
+ ip: null,
57
+ port: null,
61
58
  host: net_utils.get_primary_host_name(),
62
59
  info: 'Haraka',
63
60
  };
64
61
  this.remote = {
65
- ip: null, // c.remote_ip
66
- port: null, // c.remote_port
67
- host: null, // c.remote_host
68
- info: null, // c.remote_info
69
- closed: false, // c.remote_closed
62
+ ip: null,
63
+ port: null,
64
+ host: null,
65
+ info: null,
66
+ closed: false,
70
67
  is_private: false,
71
68
  is_local: false,
72
69
  };
73
70
  this.hello = {
74
- host: null, // c.hello_host
75
- verb: null, // c.greeting
71
+ host: null,
72
+ verb: null,
76
73
  };
77
74
  this.tls = {
78
- enabled: false, // c.using_tls
79
- advertised: false, // c.notes.tls_enabled
75
+ enabled: false,
76
+ advertised: false,
80
77
  verified: false,
81
78
  cipher: {},
82
79
  };
83
80
  this.proxy = {
84
- allowed: false, // c.proxy
85
- ip: null, // c.haproxy_ip
81
+ allowed: false,
82
+ ip: null,
86
83
  type: null,
87
- timer: null, // c.proxy_timer
84
+ timer: null,
88
85
  };
89
86
  this.set('tls', 'enabled', (!!server.has_tls));
90
87
 
@@ -132,8 +129,7 @@ class Connection {
132
129
  this.last_rcpt_msg = null;
133
130
  this.hook = null;
134
131
  if (this.cfg.headers.show_version) {
135
- const hpj = JSON.parse(fs.readFileSync(path.join(__dirname, 'package.json')));
136
- this.local.info += `/${hpj.version}`;
132
+ this.local.info += `/${utils.getVersion(__dirname)}`;
137
133
  }
138
134
  Connection.setupClient(this);
139
135
  }
@@ -223,11 +219,10 @@ class Connection {
223
219
  setTLS (obj) {
224
220
  this.set('hello', 'host', undefined);
225
221
  this.set('tls', 'enabled', true);
226
- const options = ['cipher','verified','verifyError','peerCertificate'];
227
- options.forEach(t => {
222
+ for (const t of ['cipher','verified','verifyError','peerCertificate']) {
228
223
  if (obj[t] === undefined) return;
229
224
  this.set('tls', t, obj[t]);
230
- })
225
+ }
231
226
  // prior to 2017-07, authorized and verified were both used. Verified
232
227
  // seems to be the more common and has the property updated in the
233
228
  // tls object. However, authorized has been up-to-date in the notes. Store
@@ -269,25 +264,9 @@ class Connection {
269
264
  this.set('remote.is_private', true);
270
265
  }
271
266
  else {
272
- this.set('remote.is_private', net_utils.is_private_ipv4(this.remote.ip));
267
+ this.set('remote.is_private', net_utils.is_private_ip(this.remote.ip));
273
268
  }
274
269
  }
275
-
276
- // sunset 3.0.0
277
- if (prop_str === 'hello.verb') {
278
- this.greeting = val;
279
- }
280
- else if (prop_str === 'tls.enabled') {
281
- this.using_tls = val;
282
- }
283
- else if (prop_str === 'proxy.ip') {
284
- this.haproxy_ip = val;
285
- }
286
- else {
287
- const legacy_name = prop_str.split('.').join('_');
288
- this[legacy_name] = val;
289
- }
290
- // /sunset
291
270
  }
292
271
  get (prop_str) {
293
272
  return prop_str.split('.').reduce((prev, curr) => {
@@ -395,7 +374,7 @@ class Connection {
395
374
  }
396
375
  process_data (data) {
397
376
  if (this.state >= states.DISCONNECTING) {
398
- this.logwarn(`data after disconnect from ${this.remote.ip}`);
377
+ this.loginfo(`data after disconnect from ${this.remote.ip}`);
399
378
  return;
400
379
  }
401
380
 
@@ -538,6 +517,7 @@ class Connection {
538
517
  code = msg.code;
539
518
  msg = msg.reply;
540
519
  }
520
+
541
521
  if (!Array.isArray(msg)) {
542
522
  messages = msg.toString().split(/\n/);
543
523
  }
@@ -574,6 +554,8 @@ class Connection {
574
554
  buf = `${buf}${line}\r\n`;
575
555
  }
576
556
 
557
+ if (this.client.write === undefined) return buf; // testing
558
+
577
559
  try {
578
560
  this.client.write(buf);
579
561
  }
@@ -635,7 +617,6 @@ class Connection {
635
617
  this.client.end();
636
618
  }
637
619
  get_capabilities () {
638
-
639
620
  return [];
640
621
  }
641
622
  tran_uuid () {
@@ -869,7 +850,7 @@ class Connection {
869
850
  default:
870
851
  // RFC5321 section 4.1.1.1
871
852
  // Hostname/domain should appear after 250
872
- this.respond(250, `${this.local.host} Hello ${this.get_remote('host')}${this.ehlo_hello_message}`);
853
+ this.respond(250, `${this.local.host} Hello ${this.get_remote('host')}, ${this.ehlo_hello_message}`);
873
854
  }
874
855
  }
875
856
  ehlo_respond (retval, msg) {
@@ -902,7 +883,7 @@ class Connection {
902
883
  // Hostname/domain should appear after 250
903
884
 
904
885
  const response = [
905
- `${this.local.host} Hello ${this.get_remote('host')}${this.ehlo_hello_message}`,
886
+ `${this.local.host} Hello ${this.get_remote('host')}, ${this.ehlo_hello_message}`,
906
887
  "PIPELINING",
907
888
  "8BITMIME",
908
889
  ];
@@ -977,7 +958,6 @@ class Connection {
977
958
  })
978
959
  }
979
960
  mail_respond (retval, msg) {
980
- const self = this;
981
961
  if (!this.transaction) {
982
962
  this.logerror("mail_respond found no transaction!");
983
963
  return;
@@ -992,12 +972,12 @@ class Connection {
992
972
  }
993
973
  );
994
974
 
995
- function store_results (action) {
975
+ const store_results = (action) => {
996
976
  let addr = sender.format();
997
977
  if (addr.length > 2) { // all but null sender
998
978
  addr = addr.substr(1, addr.length -2); // trim off < >
999
979
  }
1000
- self.transaction.results.add({name: 'mail_from'}, {
980
+ this.transaction.results.add({name: 'mail_from'}, {
1001
981
  action,
1002
982
  code: constants.translate(retval),
1003
983
  address: addr,
@@ -1008,25 +988,25 @@ class Connection {
1008
988
  case constants.deny:
1009
989
  this.respond(550, msg || `${dmsg} denied`, () => {
1010
990
  store_results('reject');
1011
- self.reset_transaction();
991
+ this.reset_transaction();
1012
992
  });
1013
993
  break;
1014
994
  case constants.denydisconnect:
1015
995
  this.respond(550, msg || `${dmsg} denied`, () => {
1016
996
  store_results('reject');
1017
- self.disconnect();
997
+ this.disconnect();
1018
998
  });
1019
999
  break;
1020
1000
  case constants.denysoft:
1021
1001
  this.respond(450, msg || `${dmsg} denied`, () => {
1022
1002
  store_results('tempfail');
1023
- self.reset_transaction();
1003
+ this.reset_transaction();
1024
1004
  });
1025
1005
  break;
1026
1006
  case constants.denysoftdisconnect:
1027
1007
  this.respond(450, msg || `${dmsg} denied`, () => {
1028
1008
  store_results('tempfail');
1029
- self.disconnect();
1009
+ this.disconnect();
1030
1010
  });
1031
1011
  break;
1032
1012
  default:
@@ -1469,7 +1449,7 @@ class Connection {
1469
1449
  return received_header;
1470
1450
  }
1471
1451
  auth_results (message) {
1472
- // http://tools.ietf.org/search/rfc7001
1452
+ // https://datatracker.ietf.org/doc/rfc7001/
1473
1453
  const has_tran = !!((this.transaction?.notes));
1474
1454
 
1475
1455
  // initialize connection note
@@ -1719,7 +1699,12 @@ class Connection {
1719
1699
  });
1720
1700
  }
1721
1701
  queue_msg (retval, msg) {
1722
- if (msg) return msg;
1702
+ if (msg) {
1703
+ if (typeof msg === 'object' && msg.constructor.name === 'DSN') {
1704
+ return msg.reply
1705
+ }
1706
+ return msg;
1707
+ }
1723
1708
 
1724
1709
  switch (retval) {
1725
1710
  case constants.ok:
@@ -1754,7 +1739,8 @@ class Connection {
1754
1739
  }
1755
1740
  }
1756
1741
  queue_outbound_respond (retval, msg) {
1757
- if (!msg) msg = this.queue_msg(retval, msg) || 'Message Queued';
1742
+ if (this.remote.closed) return;
1743
+ msg = this.queue_msg(retval, msg) || 'Message Queued';
1758
1744
  this.store_queue_result(retval, msg);
1759
1745
  msg = `${msg} (${this.transaction.uuid})`;
1760
1746
  if (retval !== constants.ok) {
@@ -1799,7 +1785,7 @@ class Connection {
1799
1785
  });
1800
1786
  break;
1801
1787
  default:
1802
- outbound.send_email(this.transaction, (retval2, msg2) => {
1788
+ outbound.send_trans_email(this.transaction, (retval2, msg2) => {
1803
1789
  if (!msg2) msg2 = this.queue_msg(retval2, msg);
1804
1790
  switch (retval2) {
1805
1791
  case constants.ok:
@@ -1830,7 +1816,7 @@ class Connection {
1830
1816
  }
1831
1817
  }
1832
1818
  queue_respond (retval, msg) {
1833
- if (!msg) msg = this.queue_msg(retval, msg);
1819
+ msg = this.queue_msg(retval, msg);
1834
1820
  this.store_queue_result(retval, msg);
1835
1821
  msg = `${msg} (${this.transaction.uuid})`;
1836
1822
 
@@ -1910,17 +1896,4 @@ exports.createConnection = (client, server, cfg) => {
1910
1896
  return new Connection(client, server, cfg);
1911
1897
  }
1912
1898
 
1913
- // add logger methods to Connection:
1914
- for (const key in logger) {
1915
- if (!/^log\w/.test(key)) continue;
1916
- Connection.prototype[key] = (function (level) {
1917
- return function () {
1918
- // pass the connection instance to logger
1919
- const args = [ this ];
1920
- for (let i=0, l=arguments.length; i<l; i++) {
1921
- args.push(arguments[i]);
1922
- }
1923
- logger[level].apply(logger, args);
1924
- };
1925
- })(key);
1926
- }
1899
+ logger.add_log_methods(Connection)
@@ -14,6 +14,8 @@ rcvar="haraka_enable"
14
14
  command="/usr/local/bin/haraka"
15
15
  pidfile="/var/run/${name}.pid"
16
16
 
17
+ haraka_flags=${haraka_flags:="-c /data"}
18
+
17
19
  start_cmd="start"
18
20
  status_cmd="status"
19
21
  stop_cmd="stop"
@@ -30,7 +32,7 @@ status()
30
32
  if [ -f $pidfile ];
31
33
  then
32
34
  LPID=`cat $pidfile`
33
- LPROC=`/bin/ps | grep '^$PID'`
35
+ LPROC=`/bin/ps -p $PID`
34
36
  if [ -n $LPROC ];
35
37
  then
36
38
  echo "$name is running as $LPID"
@@ -32,7 +32,8 @@ if grep template "$PLUGIN_REPO/README.md"; then
32
32
  -e "s/template\.ini/$1.ini/" \
33
33
  "$PLUGIN_REPO/test/index.js"
34
34
 
35
- sed -i '' -e "s/template/${1}/g" package.json
35
+ sed -i '' -e "s/template/${1}/g" "$PLUGIN_REPO/package.json"
36
+
36
37
  sed -i '' \
37
38
  -e "s/_template/_${1}/g" \
38
39
  -e "s/template\.ini/$1.ini/" \
@@ -73,39 +74,8 @@ DEPRECATED
73
74
  $GIT_CMD add index.js
74
75
  fi
75
76
 
76
-
77
- if [ -f "tests/plugins/$1.js" ]; then
78
- echo "copying tests/plugins/$1.js"
79
- cp "tests/plugins/$1.js" "$PLUGIN_REPO/test/index.js"
80
- git rm "tests/plugins/$1.js"
81
- if [ ! -f "$PLUGIN_REPO/run_tests" ]; then
82
- tee "$PLUGIN_REPO/run_tests" <<'EO_TEST_RUN'
83
- #!/usr/bin/env node
84
- 'use strict'
85
- try {
86
- var reporter = require('nodeunit-x').reporters.default;
87
- }
88
- catch (e) {
89
- console.log(`
90
- Error: ${e.message}
91
-
92
- Cannot find nodeunit. Did you run 'npm install'?
93
- `)
94
- process.exit()
95
- }
96
-
97
- process.chdir(__dirname);
98
-
99
- reporter.run([ 'test' ], undefined, (err) => {
100
- process.exit(((err) ? 1 : 0));
101
- });
102
- EO_TEST_RUN
103
-
104
- sed -i '' \
105
- -e 's/"_mocha"/"nodeunit-x"/' \
106
- -e 's/"mocha"/"nodeunit-x"/' \
107
- "$PLUGIN_REPO/package.json"
108
-
109
- $GIT_CMD add package.json
110
- fi
77
+ if [ -f "test/plugins/$1.js" ]; then
78
+ echo "copying test/plugins/$1.js"
79
+ cp "test/plugins/$1.js" "$PLUGIN_REPO/test/index.js"
80
+ git rm "test/plugins/$1.js"
111
81
  fi
@@ -7,9 +7,9 @@ The Haraka core reads some configuration files to determine a few actions:
7
7
 
8
8
  * smtp.yaml or smtp.json
9
9
 
10
- If either of these files exist then they are loaded first after log.ini.
10
+ If either of these files exist then they are loaded first.
11
11
  This file is designed to use the JSON/YAML file overrides documented in
12
- Config.md to optionally provide the entire configuration in a single file.
12
+ [haraka-config](https://github.com/haraka/haraka-config) to optionally provide the entire configuration in a single file.
13
13
 
14
14
  * databytes
15
15
 
package/docs/Logging.md CHANGED
@@ -17,20 +17,13 @@ Logging conventions within Haraka
17
17
 
18
18
  This section pertains to the built in logging. For log plugins like ([haraka-plugin-syslog](https://github.com/haraka/haraka-plugin-syslog)), refer to the plugin's docs.
19
19
 
20
- See also
21
- ------------------
22
- [https://github.com/haraka/Haraka/pull/119](https://github.com/haraka/Haraka/pull/119)
23
-
24
20
  The logline by default will be in the form of:
25
21
 
26
22
  [level] [uuid] [origin] message
27
23
 
28
- Where origin is "core" or the name of the plugin which
29
- triggered the message, and "uuid" is the ID of the
30
- connection associated with the message.
24
+ Where origin is "core" or the name of the plugin which triggered the message, and "uuid" is the ID of the connection associated with the message.
31
25
 
32
- When calling a log method on logger, you should provide the
33
- plugin object and the connection object anywhere in the arguments
26
+ When calling a log method on logger, you should provide the plugin object and the connection object anywhere in the arguments
34
27
  to the log method.
35
28
 
36
29
  logger.logdebug("i like turtles", plugin, connection);
@@ -39,8 +32,7 @@ Will yield, for example,
39
32
 
40
33
  [DEBUG] [7F1C820F-DC79-4192-9AA6-5307354B20A6] [dnsbl] i like turtles
41
34
 
42
- If you call the log method on the connection object, you can
43
- forego the connection as argument:
35
+ If you call the log method on the connection object, you can forego the connection as argument:
44
36
 
45
37
  connection.logdebug("turtles all the way down", plugin);
46
38
 
@@ -48,18 +40,13 @@ and similarly for the log methods on the plugin object:
48
40
 
49
41
  plugin.logdebug("he just really likes turtles", connection);
50
42
 
51
- failing to provide a connection and/or plugin object will leave
52
- the default values in the log (currently "core").
43
+ failing to provide a connection and/or plugin object will leavethe default values in the log (currently "core").
53
44
 
54
- This is implemented by testing for argument type in
55
- the logger.js log\* method. objects-as-arguments are then sniffed
56
- to try to determine if they're a connection or plugin instance.
45
+ This is implemented by testing for argument type in the logger.js log\* method. objects-as-arguments are then sniffed to try to determine if they're a connection or plugin instance.
57
46
 
58
47
  ### Log formats
59
48
 
60
- Apart from the default log format described above, Haraka also supports logging
61
- as [`logfmt`](https://brandur.org/logfmt) and JSON. These can be used by
62
- changing the `format` attribute in `log.ini` to the desired format, e.g.:
49
+ Apart from the default log format described above, Haraka also supports logging as [`logfmt`](https://brandur.org/logfmt) and JSON. These can be used by changing the `format` attribute in `log.ini` to the desired format, e.g.:
63
50
 
64
51
  ```ini
65
52
  ; format=default
@@ -77,8 +64,7 @@ And the same line formatted as JSON:
77
64
  {"level":"PROTOCOL","uuid":"9FF7F70E-5D57-435A-AAD9-EA069B6159D9.1","source":"core","message":"S: 354 go ahead, make my day"}
78
65
  ```
79
66
 
80
- Any objects passed to the log methods will also have their properties included
81
- in the log line. For example, using `logfmt`:
67
+ Any objects passed to the log methods will also have their properties included in the log line. For example, using `logfmt`:
82
68
 
83
69
  level=NOTICE uuid=9FF7F70E-5D57-435A-AAD9-EA069B6159D9.1 source=core message=disconnect ip=127.0.0.1 rdns=Unknown helo=3h2dnz8a0if relay=N early=N esmtp=N tls=N pipe=N errors=0 txns=1 rcpts=1/0/0 msgs=1/0/0 bytes=222 lr="" time=0.052
84
70