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.
Files changed (267) hide show
  1. package/.eslintrc.yaml +5 -9
  2. package/.prettierrc.yml +1 -0
  3. package/CONTRIBUTORS.md +11 -0
  4. package/Changes.md +1393 -1211
  5. package/Dockerfile +3 -3
  6. package/Plugins.md +119 -106
  7. package/README.md +7 -16
  8. package/TODO +1 -24
  9. package/bin/haraka +197 -298
  10. package/config/auth_flat_file.ini +2 -0
  11. package/config/auth_vpopmaild.ini +4 -2
  12. package/config/dhparams.pem +8 -0
  13. package/config/mail_from.is_resolvable.ini +4 -2
  14. package/config/me +1 -0
  15. package/config/outbound.ini +0 -2
  16. package/config/plugins +36 -35
  17. package/config/rabbitmq_amqplib.ini +8 -1
  18. package/config/smtp.ini +0 -1
  19. package/config/smtp.json +17 -0
  20. package/config/tls_cert.pem +23 -0
  21. package/config/tls_key.pem +28 -0
  22. package/connection.js +46 -73
  23. package/contrib/bsd-rc.d/haraka +3 -1
  24. package/contrib/plugin2npm.sh +6 -36
  25. package/docs/Connection.md +1 -1
  26. package/docs/CoreConfig.md +2 -2
  27. package/docs/Logging.md +7 -21
  28. package/docs/Outbound.md +104 -210
  29. package/docs/Plugins.md +47 -40
  30. package/docs/Transaction.md +59 -82
  31. package/docs/{plugins → deprecated}/connect.rdns_access.md +1 -1
  32. package/docs/{plugins → deprecated}/mail_from.access.md +1 -1
  33. package/docs/{plugins → deprecated}/rcpt_to.access.md +1 -1
  34. package/docs/plugins/auth/auth_vpopmaild.md +15 -19
  35. package/docs/plugins/auth/flat_file.md +23 -30
  36. package/docs/plugins/queue/rabbitmq_amqplib.md +7 -0
  37. package/docs/plugins/queue/smtp_forward.md +1 -1
  38. package/docs/plugins/queue/smtp_proxy.md +5 -10
  39. package/docs/plugins/relay.md +2 -2
  40. package/docs/plugins/tls.md +29 -9
  41. package/endpoint.js +16 -13
  42. package/haraka.js +10 -14
  43. package/host_pool.js +5 -5
  44. package/line_socket.js +3 -4
  45. package/logger.js +44 -28
  46. package/outbound/client_pool.js +27 -23
  47. package/outbound/config.js +4 -6
  48. package/outbound/fsync_writestream.js +1 -1
  49. package/outbound/hmail.js +180 -220
  50. package/outbound/index.js +86 -99
  51. package/outbound/qfile.js +1 -1
  52. package/outbound/queue.js +55 -43
  53. package/outbound/timer_queue.js +3 -2
  54. package/outbound/tls.js +19 -7
  55. package/package.json +66 -55
  56. package/plugins/.eslintrc.yaml +0 -6
  57. package/plugins/auth/auth_base.js +30 -12
  58. package/plugins/auth/auth_proxy.js +14 -12
  59. package/plugins/auth/auth_vpopmaild.js +30 -20
  60. package/plugins/auth/flat_file.js +17 -12
  61. package/plugins/block_me.js +1 -1
  62. package/plugins/data.signatures.js +2 -4
  63. package/plugins/early_talker.js +2 -1
  64. package/plugins/mail_from.is_resolvable.js +65 -135
  65. package/plugins/queue/deliver.js +4 -5
  66. package/plugins/queue/lmtp.js +11 -14
  67. package/plugins/queue/qmail-queue.js +2 -2
  68. package/plugins/queue/quarantine.js +2 -2
  69. package/plugins/queue/rabbitmq.js +16 -17
  70. package/plugins/queue/rabbitmq_amqplib.js +1 -1
  71. package/plugins/queue/smtp_forward.js +6 -6
  72. package/plugins/queue/smtp_proxy.js +10 -1
  73. package/plugins/queue/test.js +2 -2
  74. package/plugins/rcpt_to.host_list_base.js +5 -5
  75. package/plugins/rcpt_to.in_host_list.js +2 -2
  76. package/plugins/relay.js +6 -7
  77. package/plugins/reseed_rng.js +1 -1
  78. package/plugins/status.js +37 -33
  79. package/plugins/tls.js +2 -2
  80. package/plugins/xclient.js +3 -2
  81. package/plugins.js +51 -54
  82. package/run_tests +3 -30
  83. package/server.js +190 -190
  84. package/smtp_client.js +30 -23
  85. package/{tests → test}/config/plugins +0 -2
  86. package/{tests → test}/config/smtp.ini +1 -1
  87. package/test/config/tls/example.com/_.example.com.key +28 -0
  88. package/test/config/tls/example.com/example.com.crt +25 -0
  89. package/test/connection.js +302 -0
  90. package/test/endpoint.js +94 -0
  91. package/{tests → test}/fixtures/line_socket.js +1 -1
  92. package/{tests → test}/fixtures/util_hmailitem.js +19 -25
  93. package/{tests → test}/host_pool.js +42 -57
  94. package/test/logger.js +258 -0
  95. package/test/outbound/hmail.js +141 -0
  96. package/test/outbound/index.js +220 -0
  97. package/test/outbound/qfile.js +126 -0
  98. package/test/outbound_bounce_net_errors.js +142 -0
  99. package/{tests → test}/outbound_bounce_rfc3464.js +110 -122
  100. package/test/plugins/auth/auth_base.js +484 -0
  101. package/test/plugins/auth/auth_vpopmaild.js +83 -0
  102. package/test/plugins/early_talker.js +104 -0
  103. package/test/plugins/mail_from.is_resolvable.js +35 -0
  104. package/test/plugins/queue/smtp_forward.js +206 -0
  105. package/test/plugins/rcpt_to.host_list_base.js +122 -0
  106. package/test/plugins/rcpt_to.in_host_list.js +193 -0
  107. package/test/plugins/relay.js +303 -0
  108. package/test/plugins/status.js +130 -0
  109. package/test/plugins/tls.js +70 -0
  110. package/test/plugins.js +228 -0
  111. package/{tests → test}/queue/multibyte +0 -0
  112. package/{tests → test}/queue/plain +0 -0
  113. package/test/rfc1869.js +73 -0
  114. package/test/server.js +491 -0
  115. package/test/smtp_client.js +299 -0
  116. package/test/tls_socket.js +273 -0
  117. package/test/transaction.js +270 -0
  118. package/tls_socket.js +202 -252
  119. package/transaction.js +9 -24
  120. package/CONTRIBUTING.md +0 -1
  121. package/bin/dkimverify +0 -40
  122. package/config/access.domains +0 -13
  123. package/config/attachment.ctype.regex +0 -2
  124. package/config/attachment.filename.regex +0 -1
  125. package/config/avg.ini +0 -5
  126. package/config/bounce.ini +0 -15
  127. package/config/data.headers.ini +0 -61
  128. package/config/dkim/dkim_key_gen.sh +0 -78
  129. package/config/dkim_sign.ini +0 -4
  130. package/config/dkim_verify.ini +0 -7
  131. package/config/dnsbl.ini +0 -23
  132. package/config/greylist.ini +0 -43
  133. package/config/helo.checks.ini +0 -52
  134. package/config/lookup_rdns.strict.ini +0 -12
  135. package/config/lookup_rdns.strict.timeout +0 -1
  136. package/config/lookup_rdns.strict.whitelist +0 -1
  137. package/config/lookup_rdns.strict.whitelist_regex +0 -5
  138. package/config/messagesniffer.ini +0 -18
  139. package/config/rcpt_to.blocklist +0 -1
  140. package/config/rdns.allow_regexps +0 -0
  141. package/config/rdns.deny_regexps +0 -0
  142. package/config/spamassassin.ini +0 -56
  143. package/config.js +0 -6
  144. package/dkim.js +0 -614
  145. package/docs/plugins/avg.md +0 -35
  146. package/docs/plugins/bounce.md +0 -69
  147. package/docs/plugins/clamd.md +0 -147
  148. package/docs/plugins/esets.md +0 -8
  149. package/docs/plugins/greylist.md +0 -90
  150. package/docs/plugins/helo.checks.md +0 -135
  151. package/docs/plugins/messagesniffer.md +0 -163
  152. package/docs/plugins/relay_acl.md +0 -29
  153. package/docs/plugins/relay_all.md +0 -15
  154. package/docs/plugins/relay_force_routing.md +0 -33
  155. package/docs/plugins/spamassassin.md +0 -180
  156. package/outbound/mx_lookup.js +0 -70
  157. package/plugins/auth/auth_ldap.js +0 -3
  158. package/plugins/avg.js +0 -162
  159. package/plugins/backscatterer.js +0 -25
  160. package/plugins/bounce.js +0 -381
  161. package/plugins/clamd.js +0 -381
  162. package/plugins/data.headers.js +0 -4
  163. package/plugins/data.uribl.js +0 -4
  164. package/plugins/dkim_sign.js +0 -395
  165. package/plugins/dkim_verify.js +0 -62
  166. package/plugins/dns_list_base.js +0 -221
  167. package/plugins/dnsbl.js +0 -146
  168. package/plugins/dnswl.js +0 -58
  169. package/plugins/esets.js +0 -71
  170. package/plugins/graph.js +0 -5
  171. package/plugins/greylist.js +0 -645
  172. package/plugins/helo.checks.js +0 -533
  173. package/plugins/messagesniffer.js +0 -381
  174. package/plugins/rcpt_to.ldap.js +0 -3
  175. package/plugins/rcpt_to.max_count.js +0 -24
  176. package/plugins/relay_all.js +0 -13
  177. package/plugins/spamassassin.js +0 -384
  178. package/tests/config/dkim/example.com/dns +0 -29
  179. package/tests/config/dkim/example.com/private +0 -6
  180. package/tests/config/dkim/example.com/public +0 -4
  181. package/tests/config/dkim/example.com/selector +0 -1
  182. package/tests/config/dkim.private.key +0 -6
  183. package/tests/config/dkim_sign.ini +0 -4
  184. package/tests/config/helo.checks.ini +0 -52
  185. package/tests/connection.js +0 -327
  186. package/tests/endpoint.js +0 -128
  187. package/tests/fixtures/vm_harness.js +0 -59
  188. package/tests/logger.js +0 -327
  189. package/tests/outbound/hmail.js +0 -112
  190. package/tests/outbound/index.js +0 -324
  191. package/tests/outbound/qfile.js +0 -67
  192. package/tests/outbound_bounce_net_errors.js +0 -173
  193. package/tests/plugins/auth/auth_base.js +0 -463
  194. package/tests/plugins/auth/auth_vpopmaild.js +0 -91
  195. package/tests/plugins/bounce.js +0 -307
  196. package/tests/plugins/clamd.js +0 -224
  197. package/tests/plugins/deprecated/relay_acl.js +0 -140
  198. package/tests/plugins/deprecated/relay_all.js +0 -59
  199. package/tests/plugins/dkim_sign.js +0 -315
  200. package/tests/plugins/dkim_signer.js +0 -108
  201. package/tests/plugins/dns_list_base.js +0 -259
  202. package/tests/plugins/dnsbl.js +0 -101
  203. package/tests/plugins/early_talker.js +0 -115
  204. package/tests/plugins/greylist.js +0 -58
  205. package/tests/plugins/helo.checks.js +0 -525
  206. package/tests/plugins/mail_from.is_resolvable.js +0 -116
  207. package/tests/plugins/queue/smtp_forward.js +0 -221
  208. package/tests/plugins/rcpt_to.host_list_base.js +0 -132
  209. package/tests/plugins/rcpt_to.in_host_list.js +0 -218
  210. package/tests/plugins/relay.js +0 -339
  211. package/tests/plugins/spamassassin.js +0 -171
  212. package/tests/plugins/status.js +0 -138
  213. package/tests/plugins/tls.js +0 -84
  214. package/tests/plugins.js +0 -247
  215. package/tests/rfc1869.js +0 -61
  216. package/tests/server.js +0 -510
  217. package/tests/smtp_client/auth.js +0 -105
  218. package/tests/smtp_client/basic.js +0 -101
  219. package/tests/smtp_client.js +0 -80
  220. package/tests/tls_socket.js +0 -333
  221. package/tests/transaction.js +0 -284
  222. /package/docs/{plugins → deprecated}/dkim_sign.md +0 -0
  223. /package/docs/{plugins → deprecated}/dkim_verify.md +0 -0
  224. /package/docs/{plugins → deprecated}/dnsbl.md +0 -0
  225. /package/docs/{plugins → deprecated}/dnswl.md +0 -0
  226. /package/docs/{plugins → deprecated}/rcpt_to.routes.md +0 -0
  227. /package/{tests → test}/.eslintrc.yaml +0 -0
  228. /package/{tests → test}/config/auth_flat_file.ini +0 -0
  229. /package/{tests → test}/config/dhparams.pem +0 -0
  230. /package/{tests → test}/config/host_list +0 -0
  231. /package/{tests → test}/config/outbound_tls_cert.pem +0 -0
  232. /package/{tests → test}/config/outbound_tls_key.pem +0 -0
  233. /package/{tests → test}/config/smtp_forward.ini +0 -0
  234. /package/{tests → test}/config/tls/ec.pem +0 -0
  235. /package/{tests → test}/config/tls/haraka.local.pem +0 -0
  236. /package/{tests → test}/config/tls/mismatched.pem +0 -0
  237. /package/{tests → test}/config/tls.ini +0 -0
  238. /package/{tests → test}/config/tls_cert.pem +0 -0
  239. /package/{tests → test}/config/tls_key.pem +0 -0
  240. /package/{tests → test}/fixtures/todo_qfile.txt +0 -0
  241. /package/{tests → test}/installation/config/test-plugin-flat +0 -0
  242. /package/{tests → test}/installation/config/test-plugin.ini +0 -0
  243. /package/{tests → test}/installation/config/tls.ini +0 -0
  244. /package/{tests → test}/installation/node_modules/load_first/index.js +0 -0
  245. /package/{tests → test}/installation/node_modules/load_first/package.json +0 -0
  246. /package/{tests → test}/installation/node_modules/test-plugin/config/test-plugin-flat +0 -0
  247. /package/{tests → test}/installation/node_modules/test-plugin/config/test-plugin.ini +0 -0
  248. /package/{tests → test}/installation/node_modules/test-plugin/package.json +0 -0
  249. /package/{tests → test}/installation/node_modules/test-plugin/test-plugin.js +0 -0
  250. /package/{tests → test}/installation/plugins/base_plugin.js +0 -0
  251. /package/{tests → test}/installation/plugins/folder_plugin/index.js +0 -0
  252. /package/{tests → test}/installation/plugins/folder_plugin/package.json +0 -0
  253. /package/{tests → test}/installation/plugins/inherits.js +0 -0
  254. /package/{tests → test}/installation/plugins/load_first.js +0 -0
  255. /package/{tests → test}/installation/plugins/plugin.js +0 -0
  256. /package/{tests → test}/installation/plugins/tls.js +0 -0
  257. /package/{tests → test}/loud/config/dhparams.pem +0 -0
  258. /package/{tests → test}/loud/config/tls/goobered.pem +0 -0
  259. /package/{tests → test}/loud/config/tls.ini +0 -0
  260. /package/{tests → test}/mail_specimen/base64-root-part.txt +0 -0
  261. /package/{tests → test}/mail_specimen/varied-fold-lengths-preserve-data.txt +0 -0
  262. /package/{tests → test}/queue/1507509981169_1507509981169_0_61403_e0Y0Ym_1_fixed +0 -0
  263. /package/{tests → test}/queue/1507509981169_1507509981169_0_61403_e0Y0Ym_1_haraka +0 -0
  264. /package/{tests → test}/queue/1508269674999_1508269674999_0_34002_socVUF_1_haraka +0 -0
  265. /package/{tests → test}/queue/1508455115683_1508455115683_0_90253_9Q4o4V_1_haraka +0 -0
  266. /package/{tests → test}/queue/zero-length +0 -0
  267. /package/{tests → test}/test-queue/delete-me +0 -0
@@ -1,7 +1,9 @@
1
+ [main]
1
2
  host=127.0.0.6
2
3
  port=89
3
- ;sysadmin=postmaster@example.com:sekret
4
+ ; sysadmin=postmaster@example.com:sekret
5
+ ; constrain_sender=true
4
6
 
5
7
  [example.com]
6
8
  host=127.0.0.10
7
- ;sysadmin=postmaster@example.com:sekret
9
+ ; sysadmin=postmaster@example.com:sekret
@@ -0,0 +1,8 @@
1
+ -----BEGIN DH PARAMETERS-----
2
+ MIIBDAKCAQEApFk8xNOjLnepwoVTwGBOtmR25KqRjdF3A/DPb+enmE6Kmwtr5KCP
3
+ EwdaSyjLVFMqE9DQzMdfl5mpU+1HghTBRmiUIWnpUWhkXJsGVYvMN/ny6aVO8zuO
4
+ K+7RtqqPo0Cop6ayMmMYg+cFKTEdP6B3LDZgrTRUy1jLVq2RsZajOn+pQMQjCgjK
5
+ bF44ctsUgc3RRL5bO/bsyh+N+KC0LpwcsnvNxX8lwVry9+4uPwH1j/PORAt1AxvT
6
+ AEW4PET1C44IoocclLKXA4jaGxLW8Bhhf875KnH8ACzi24Wn0doIbPzm5KY2nSEw
7
+ e5tD4DLWs6jk66lRKJ/WtEKMwxgum8SFDwIBAgICAOE=
8
+ -----END DH PARAMETERS-----
@@ -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
@@ -9,4 +9,11 @@ queueName = emails
9
9
  deliveryMode = 2
10
10
  confirm = true
11
11
  durable = true
12
- autoDelete = false
12
+ autoDelete = false
13
+
14
+ ; Optional queue arguments
15
+ ; [queue_args]
16
+ ; x-dead-letter-exchange =
17
+ ; x-dead-letter-routing-key = emails_dlq
18
+ ; x-overflow = reject-publish
19
+ ; x-queue-type = quorum
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/eKhkpsSvZ3OzpAWLkYEwDQYJKoZIhvcNAQEL
3
+ BQAwfzELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xEjAQBgNVBAcM
4
+ CVNob3JlbGluZTENMAsGA1UECgwEVE5QSTEaMBgGA1UEAwwRaG9tZS5zaW1lcnNv
5
+ bi5uZXQxHDAaBgkqhkiG9w0BCQEWDW1hdHRAdG5waS5uZXQwHhcNMjQwNDI3MDM1
6
+ MzI2WhcNMzAwNDI2MDM1MzI2WjB/MQswCQYDVQQGEwJVUzETMBEGA1UECAwKV2Fz
7
+ aGluZ3RvbjESMBAGA1UEBwwJU2hvcmVsaW5lMQ0wCwYDVQQKDARUTlBJMRowGAYD
8
+ VQQDDBFob21lLnNpbWVyc29uLm5ldDEcMBoGCSqGSIb3DQEJARYNbWF0dEB0bnBp
9
+ Lm5ldDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKotMDxPuAU+ygZy
10
+ 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AXcKZgsvS97ILWRTgdw3tc7XBgxL
20
+ RWJd1tTSTHtfu6F8qxjoh3umcND45tGB27rMDFnvq5/9fLAs63xf9RhSNTTB++pe
21
+ 1Vgy+bvx285KY4LXbNB8ncXfvf+CUIV021KzhWmYqqOSpmdIp3rFtDOFMQKBgQCP
22
+ jqfXSBccFCgaApf7aEcFLknYGz7MEe8AobSvKAl96GxQMLK41AA6G8K74oaU9N6b
23
+ 8kN01WvTjRsIahmLKy/ptkEFzYpRSB7llNNkNi9T4TsZVaCIdwDCjA6nwBNGVWSy
24
+ Mvh5h149gZIrAuHZxjBlDpPU/pdTp1fjjmAeGtDNuQKBgHuKQaE5AYqBmeZUoGPP
25
+ AsvnSvBt9ZY+vCjUK255s7CPWrA5kN4EZWXGB9EBYNit80CvkaNAK1jsR5qErNA0
26
+ HGUfBIIsUAoOV9VdeN5PoYsE4dqxlpRvuEJpgXzk4KATSdBxP7jAs2SepVlBExa9
27
+ yLRsVL/PYvEykaKHAyS2dwp4
28
+ -----END PRIVATE KEY-----
package/connection.js CHANGED
@@ -1,12 +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
@@ -63,5 +63,5 @@ For low level use. This value is set when the remote host drops the connection.
63
63
 
64
64
  * connection.results
65
65
 
66
- Store results of processing in a structured format. See [docs/Results](http://haraka.github.io/manual/Results.html)
66
+ Store results of processing in a structured format. See [haraka-results](https://github.com/haraka/haraka-results)
67
67
 
@@ -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