haraka 0.0.33 → 3.3.0

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 (309) hide show
  1. package/.claude/settings.local.json +28 -0
  2. package/.githooks/pre-commit +41 -0
  3. package/.prettierignore +6 -0
  4. package/.qlty/.gitignore +7 -0
  5. package/.qlty/configs/.shellcheckrc +1 -0
  6. package/.qlty/qlty.toml +15 -0
  7. package/CHANGELOG.md +1894 -0
  8. package/CLAUDE.md +40 -0
  9. package/CONTRIBUTORS.md +34 -0
  10. package/Dockerfile +50 -0
  11. package/GEMINI.md +38 -0
  12. package/LICENSE +22 -0
  13. package/Plugins.md +227 -0
  14. package/README.md +119 -4
  15. package/SECURITY.md +178 -0
  16. package/TODO +22 -0
  17. package/address.js +53 -0
  18. package/bin/haraka +593 -0
  19. package/bin/haraka_grep +32 -0
  20. package/config/aliases +2 -0
  21. package/config/auth_flat_file.ini +7 -0
  22. package/config/auth_vpopmaild.ini +9 -0
  23. package/config/connection.ini +79 -0
  24. package/config/delay_deny.ini +7 -0
  25. package/config/dhparams.pem +8 -0
  26. package/config/host_list +3 -0
  27. package/config/host_list_regex +6 -0
  28. package/config/http.ini +11 -0
  29. package/config/lmtp.ini +7 -0
  30. package/config/log.ini +11 -0
  31. package/config/me +1 -0
  32. package/config/outbound.bounce_message +18 -0
  33. package/config/outbound.bounce_message_html +36 -0
  34. package/config/outbound.bounce_message_image +106 -0
  35. package/config/outbound.ini +24 -0
  36. package/config/plugins +67 -0
  37. package/config/smtp.ini +37 -0
  38. package/config/smtp_bridge.ini +4 -0
  39. package/config/smtp_forward.ini +31 -0
  40. package/config/smtp_proxy.ini +27 -0
  41. package/config/tarpit.timeout +1 -0
  42. package/config/tls.ini +83 -0
  43. package/config/tls_cert.pem +23 -0
  44. package/config/tls_key.pem +28 -0
  45. package/config/watch.ini +12 -0
  46. package/config/xclient.hosts +2 -0
  47. package/connection.js +1863 -0
  48. package/contrib/Haraka.cf +6 -0
  49. package/contrib/Haraka.pm +35 -0
  50. package/contrib/bad_smtp_server.pl +25 -0
  51. package/contrib/bsd-rc.d/haraka +61 -0
  52. package/contrib/debian-init.d/haraka +87 -0
  53. package/contrib/haraka.init +96 -0
  54. package/contrib/haraka.service +23 -0
  55. package/contrib/plugin2npm.sh +81 -0
  56. package/contrib/ubuntu-upstart/haraka.conf +27 -0
  57. package/coverage/coverage-final.json +2 -0
  58. package/coverage/coverage-summary.json +33 -0
  59. package/coverage/tmp/coverage-79131-1779241025146-0.json +1 -0
  60. package/coverage/tmp/coverage-79132-1779240999690-0.json +1 -0
  61. package/coverage/tmp/coverage-79172-1779241000095-0.json +1 -0
  62. package/coverage/tmp/coverage-79210-1779241000156-0.json +1 -0
  63. package/coverage/tmp/coverage-79211-1779241000209-0.json +1 -0
  64. package/coverage/tmp/coverage-79212-1779241000266-0.json +1 -0
  65. package/coverage/tmp/coverage-79213-1779241000441-0.json +1 -0
  66. package/coverage/tmp/coverage-79214-1779241000626-0.json +1 -0
  67. package/coverage/tmp/coverage-79215-1779241000795-0.json +1 -0
  68. package/coverage/tmp/coverage-79216-1779241000965-0.json +1 -0
  69. package/coverage/tmp/coverage-79218-1779241001013-0.json +1 -0
  70. package/coverage/tmp/coverage-79219-1779241001179-0.json +1 -0
  71. package/coverage/tmp/coverage-79220-1779241006249-0.json +1 -0
  72. package/coverage/tmp/coverage-79227-1779241011453-0.json +1 -0
  73. package/coverage/tmp/coverage-79229-1779241011537-0.json +1 -0
  74. package/coverage/tmp/coverage-79230-1779241011647-0.json +1 -0
  75. package/coverage/tmp/coverage-79231-1779241011765-0.json +1 -0
  76. package/coverage/tmp/coverage-79232-1779241011841-0.json +1 -0
  77. package/coverage/tmp/coverage-79233-1779241011909-0.json +1 -0
  78. package/coverage/tmp/coverage-79234-1779241011984-0.json +1 -0
  79. package/coverage/tmp/coverage-79235-1779241012055-0.json +1 -0
  80. package/coverage/tmp/coverage-79236-1779241012230-0.json +1 -0
  81. package/coverage/tmp/coverage-79237-1779241012300-0.json +1 -0
  82. package/coverage/tmp/coverage-79238-1779241012368-0.json +1 -0
  83. package/coverage/tmp/coverage-79239-1779241012438-0.json +1 -0
  84. package/coverage/tmp/coverage-79240-1779241012511-0.json +1 -0
  85. package/coverage/tmp/coverage-79241-1779241012582-0.json +1 -0
  86. package/coverage/tmp/coverage-79242-1779241012652-0.json +1 -0
  87. package/coverage/tmp/coverage-79243-1779241012814-0.json +1 -0
  88. package/coverage/tmp/coverage-79244-1779241012931-0.json +1 -0
  89. package/coverage/tmp/coverage-79245-1779241013007-0.json +1 -0
  90. package/coverage/tmp/coverage-79246-1779241013106-0.json +1 -0
  91. package/coverage/tmp/coverage-79247-1779241013178-0.json +1 -0
  92. package/coverage/tmp/coverage-79248-1779241013244-0.json +1 -0
  93. package/coverage/tmp/coverage-79249-1779241013409-0.json +1 -0
  94. package/coverage/tmp/coverage-79250-1779241013697-0.json +1 -0
  95. package/coverage/tmp/coverage-79251-1779241013847-0.json +1 -0
  96. package/coverage/tmp/coverage-79252-1779241014288-0.json +1 -0
  97. package/coverage/tmp/coverage-79253-1779241014378-0.json +1 -0
  98. package/coverage/tmp/coverage-79254-1779241014428-0.json +1 -0
  99. package/coverage/tmp/coverage-79255-1779241021774-0.json +1 -0
  100. package/coverage/tmp/coverage-80382-1779241021949-0.json +1 -0
  101. package/coverage/tmp/coverage-80383-1779241025019-0.json +1 -0
  102. package/coverage/tmp/coverage-80384-1779241025133-0.json +1 -0
  103. package/docs/Body.md +1 -0
  104. package/docs/Config.md +1 -0
  105. package/docs/Connection.md +153 -0
  106. package/docs/CoreConfig.md +96 -0
  107. package/docs/CustomReturnCodes.md +3 -0
  108. package/docs/HAProxy.md +62 -0
  109. package/docs/Header.md +1 -0
  110. package/docs/Logging.md +129 -0
  111. package/docs/Outbound.md +210 -0
  112. package/docs/Plugins.md +372 -0
  113. package/docs/Results.md +7 -0
  114. package/docs/Transaction.md +135 -0
  115. package/docs/Tutorial.md +183 -0
  116. package/docs/deprecated/access.md +3 -0
  117. package/docs/deprecated/backscatterer.md +9 -0
  118. package/docs/deprecated/connect.rdns_access.md +53 -0
  119. package/docs/deprecated/data.headers.md +3 -0
  120. package/docs/deprecated/data.nomsgid.md +7 -0
  121. package/docs/deprecated/data.noreceived.md +11 -0
  122. package/docs/deprecated/data.rfc5322_header_checks.md +11 -0
  123. package/docs/deprecated/dkim_sign.md +97 -0
  124. package/docs/deprecated/dkim_verify.md +28 -0
  125. package/docs/deprecated/dnsbl.md +80 -0
  126. package/docs/deprecated/dnswl.md +73 -0
  127. package/docs/deprecated/lookup_rdns.strict.md +67 -0
  128. package/docs/deprecated/mail_from.access.md +52 -0
  129. package/docs/deprecated/mail_from.blocklist.md +18 -0
  130. package/docs/deprecated/mail_from.nobounces.md +8 -0
  131. package/docs/deprecated/rcpt_to.access.md +53 -0
  132. package/docs/deprecated/rcpt_to.blocklist.md +18 -0
  133. package/docs/deprecated/rcpt_to.routes.md +3 -0
  134. package/docs/deprecated/rdns.regexp.md +30 -0
  135. package/docs/plugins/aliases.md +3 -0
  136. package/docs/plugins/auth/auth_bridge.md +34 -0
  137. package/docs/plugins/auth/auth_ldap.md +4 -0
  138. package/docs/plugins/auth/auth_proxy.md +36 -0
  139. package/docs/plugins/auth/auth_vpopmaild.md +33 -0
  140. package/docs/plugins/auth/flat_file.md +40 -0
  141. package/docs/plugins/block_me.md +18 -0
  142. package/docs/plugins/data.signatures.md +11 -0
  143. package/docs/plugins/delay_deny.md +23 -0
  144. package/docs/plugins/max_unrecognized_commands.md +6 -0
  145. package/docs/plugins/prevent_credential_leaks.md +22 -0
  146. package/docs/plugins/process_title.md +42 -0
  147. package/docs/plugins/queue/deliver.md +3 -0
  148. package/docs/plugins/queue/discard.md +32 -0
  149. package/docs/plugins/queue/lmtp.md +24 -0
  150. package/docs/plugins/queue/qmail-queue.md +16 -0
  151. package/docs/plugins/queue/quarantine.md +87 -0
  152. package/docs/plugins/queue/smtp_bridge.md +32 -0
  153. package/docs/plugins/queue/smtp_forward.md +127 -0
  154. package/docs/plugins/queue/smtp_proxy.md +68 -0
  155. package/docs/plugins/queue/test.md +7 -0
  156. package/docs/plugins/rcpt_to.in_host_list.md +34 -0
  157. package/docs/plugins/rcpt_to.max_count.md +3 -0
  158. package/docs/plugins/record_envelope_addresses.md +20 -0
  159. package/docs/plugins/relay.md +3 -0
  160. package/docs/plugins/reseed_rng.md +16 -0
  161. package/docs/plugins/status.md +41 -0
  162. package/docs/plugins/tarpit.md +50 -0
  163. package/docs/plugins/tls.md +235 -0
  164. package/docs/plugins/toobusy.md +27 -0
  165. package/docs/plugins/xclient.md +10 -0
  166. package/docs/tutorials/Migrating_from_v1_to_v2.md +96 -0
  167. package/docs/tutorials/SettingUpOutbound.md +62 -0
  168. package/eslint.config.mjs +2 -0
  169. package/haraka.js +74 -0
  170. package/haraka.sh +2 -0
  171. package/http/html/404.html +58 -0
  172. package/http/html/index.html +47 -0
  173. package/http/package.json +21 -0
  174. package/line_socket.js +24 -0
  175. package/logger.js +322 -0
  176. package/outbound/client_pool.js +59 -0
  177. package/outbound/config.js +134 -0
  178. package/outbound/hmail.js +1504 -0
  179. package/outbound/index.js +349 -0
  180. package/outbound/qfile.js +93 -0
  181. package/outbound/queue.js +399 -0
  182. package/outbound/tls.js +85 -0
  183. package/outbound/todo.js +17 -0
  184. package/package.json +99 -4
  185. package/plugins/.eslintrc.yaml +3 -0
  186. package/plugins/auth/auth_base.js +261 -0
  187. package/plugins/auth/auth_bridge.js +20 -0
  188. package/plugins/auth/auth_proxy.js +227 -0
  189. package/plugins/auth/auth_vpopmaild.js +162 -0
  190. package/plugins/auth/flat_file.js +44 -0
  191. package/plugins/block_me.js +88 -0
  192. package/plugins/data.signatures.js +30 -0
  193. package/plugins/delay_deny.js +153 -0
  194. package/plugins/prevent_credential_leaks.js +61 -0
  195. package/plugins/process_title.js +197 -0
  196. package/plugins/profile.js +11 -0
  197. package/plugins/queue/deliver.js +12 -0
  198. package/plugins/queue/discard.js +27 -0
  199. package/plugins/queue/lmtp.js +45 -0
  200. package/plugins/queue/qmail-queue.js +93 -0
  201. package/plugins/queue/quarantine.js +133 -0
  202. package/plugins/queue/smtp_bridge.js +45 -0
  203. package/plugins/queue/smtp_forward.js +371 -0
  204. package/plugins/queue/smtp_proxy.js +142 -0
  205. package/plugins/queue/test.js +15 -0
  206. package/plugins/rcpt_to.host_list_base.js +65 -0
  207. package/plugins/rcpt_to.in_host_list.js +56 -0
  208. package/plugins/record_envelope_addresses.js +17 -0
  209. package/plugins/reseed_rng.js +7 -0
  210. package/plugins/status.js +274 -0
  211. package/plugins/tarpit.js +45 -0
  212. package/plugins/tls.js +164 -0
  213. package/plugins/toobusy.js +47 -0
  214. package/plugins/xclient.js +124 -0
  215. package/plugins.js +604 -0
  216. package/queue/1772642154987_1775581346001_4_82235_TGwgfd_2_mattbook-m3.home.simerson.net +0 -0
  217. package/run_tests +11 -0
  218. package/server.js +827 -0
  219. package/smtp_client.js +504 -0
  220. package/test/.eslintrc.yaml +11 -0
  221. package/test/config/auth_flat_file.ini +5 -0
  222. package/test/config/block_me.recipient +1 -0
  223. package/test/config/block_me.senders +1 -0
  224. package/test/config/dhparams.pem +8 -0
  225. package/test/config/host_list +2 -0
  226. package/test/config/outbound_tls_cert.pem +1 -0
  227. package/test/config/outbound_tls_key.pem +1 -0
  228. package/test/config/plugins +7 -0
  229. package/test/config/smtp.ini +11 -0
  230. package/test/config/smtp_forward.ini +30 -0
  231. package/test/config/tls/example.com/_.example.com.key +28 -0
  232. package/test/config/tls/example.com/example.com.crt +25 -0
  233. package/test/config/tls/haraka.local.pem +51 -0
  234. package/test/config/tls.ini +45 -0
  235. package/test/config/tls_cert.pem +21 -0
  236. package/test/config/tls_key.pem +28 -0
  237. package/test/connection.js +817 -0
  238. package/test/fixtures/haproxy_allowed/config/connection.ini +3 -0
  239. package/test/fixtures/haproxy_disabled/config/connection.ini +3 -0
  240. package/test/fixtures/haproxy_untrusted/config/connection.ini +3 -0
  241. package/test/fixtures/line_socket.js +21 -0
  242. package/test/fixtures/todo_qfile.txt +0 -0
  243. package/test/fixtures/util_hmailitem.js +156 -0
  244. package/test/installation/config/test-plugin-flat +1 -0
  245. package/test/installation/config/test-plugin.ini +10 -0
  246. package/test/installation/config/tls.ini +1 -0
  247. package/test/installation/node_modules/load_first/index.js +5 -0
  248. package/test/installation/node_modules/load_first/package.json +11 -0
  249. package/test/installation/node_modules/test-plugin/config/test-plugin-flat +1 -0
  250. package/test/installation/node_modules/test-plugin/config/test-plugin.ini +9 -0
  251. package/test/installation/node_modules/test-plugin/package.json +5 -0
  252. package/test/installation/node_modules/test-plugin/test-plugin.js +5 -0
  253. package/test/installation/plugins/base_plugin.js +3 -0
  254. package/test/installation/plugins/folder_plugin/index.js +3 -0
  255. package/test/installation/plugins/folder_plugin/package.json +11 -0
  256. package/test/installation/plugins/inherits.js +7 -0
  257. package/test/installation/plugins/load_first.js +3 -0
  258. package/test/installation/plugins/plugin.js +1 -0
  259. package/test/installation/plugins/tls.js +3 -0
  260. package/test/logger.js +217 -0
  261. package/test/loud/config/dhparams.pem +0 -0
  262. package/test/loud/config/tls/goobered.pem +45 -0
  263. package/test/loud/config/tls.ini +43 -0
  264. package/test/mail_specimen/base64-root-part.txt +23 -0
  265. package/test/mail_specimen/varied-fold-lengths-preserve-data.txt +283 -0
  266. package/test/outbound/bounce_net_errors.js +133 -0
  267. package/test/outbound/bounce_rfc3464.js +226 -0
  268. package/test/outbound/hmail.js +210 -0
  269. package/test/outbound/index.js +385 -0
  270. package/test/outbound/qfile.js +124 -0
  271. package/test/outbound/queue.js +325 -0
  272. package/test/plugins/auth/auth_base.js +620 -0
  273. package/test/plugins/auth/auth_bridge.js +80 -0
  274. package/test/plugins/auth/auth_vpopmaild.js +81 -0
  275. package/test/plugins/auth/flat_file.js +123 -0
  276. package/test/plugins/block_me.js +141 -0
  277. package/test/plugins/data.signatures.js +111 -0
  278. package/test/plugins/delay_deny.js +262 -0
  279. package/test/plugins/prevent_credential_leaks.js +174 -0
  280. package/test/plugins/process_title.js +141 -0
  281. package/test/plugins/queue/deliver.js +98 -0
  282. package/test/plugins/queue/discard.js +78 -0
  283. package/test/plugins/queue/lmtp.js +137 -0
  284. package/test/plugins/queue/qmail-queue.js +98 -0
  285. package/test/plugins/queue/quarantine.js +80 -0
  286. package/test/plugins/queue/smtp_bridge.js +152 -0
  287. package/test/plugins/queue/smtp_forward.js +1023 -0
  288. package/test/plugins/queue/smtp_proxy.js +138 -0
  289. package/test/plugins/rcpt_to.host_list_base.js +102 -0
  290. package/test/plugins/rcpt_to.in_host_list.js +186 -0
  291. package/test/plugins/record_envelope_addresses.js +66 -0
  292. package/test/plugins/reseed_rng.js +34 -0
  293. package/test/plugins/status.js +207 -0
  294. package/test/plugins/tarpit.js +90 -0
  295. package/test/plugins/tls.js +86 -0
  296. package/test/plugins/toobusy.js +21 -0
  297. package/test/plugins/xclient.js +119 -0
  298. package/test/plugins.js +230 -0
  299. package/test/queue/1507509981169_1507509981169_0_61403_e0Y0Ym_1_fixed +0 -0
  300. package/test/queue/1507509981169_1507509981169_0_61403_e0Y0Ym_1_haraka +0 -0
  301. package/test/queue/1508269674999_1508269674999_0_34002_socVUF_1_haraka +0 -0
  302. package/test/queue/1508455115683_1508455115683_0_90253_9Q4o4V_1_haraka +0 -0
  303. package/test/queue/zero-length +0 -0
  304. package/test/server.js +1012 -0
  305. package/test/smtp_client.js +1303 -0
  306. package/test/tls_socket.js +321 -0
  307. package/test/transaction.js +554 -0
  308. package/tls_socket.js +771 -0
  309. package/transaction.js +267 -0
@@ -0,0 +1,127 @@
1
+ # queue/smtp_forward
2
+
3
+ ==================
4
+
5
+ This plugin delivers to another mail server. This is a common setup when you want to have a mail server with a solid pedigree of outbound delivery to other hosts, and inbound delivery to users.
6
+
7
+ In comparison to `queue/smtp_proxy`, this plugin waits until queue time to attempt the ongoing connection. This can be a benefit in reducing connections to your inbound mail server when you have content filtering (such as spamassassin) enabled. A possible downside is that it also delays recipient validation that the ongoing mail server may provide until queue time.
8
+
9
+ ## Configuration
10
+
11
+ ---
12
+
13
+ Configuration is stored in smtp_forward.ini in the following keys:
14
+
15
+ - enable_outbound=[true]
16
+
17
+ SMTP forward outbound messages (set to false to enable Haraka's separate Outbound mail routing (MX based delivery)).
18
+
19
+ - host=HOST
20
+
21
+ The host to connect to.
22
+
23
+ - port=PORT
24
+
25
+ The port to connect to. Default: 25
26
+
27
+ - connect_timeout=SECONDS
28
+
29
+ The maximum amount of time to wait when creating a new connection to the host. Default: 30 seconds.
30
+
31
+ - timeout=SECONDS
32
+
33
+ The amount of seconds to let a backend connection live idle in the connection pool. This should always be less than the global plugin timeout, which should in turn be less than the connection timeout.
34
+
35
+ - max_connections=NUMBER
36
+
37
+ Maximum number of connections at any given time. Default: 1000
38
+
39
+ - enable_tls=[true]
40
+
41
+ Enable opportunistic TLS with the forward host via `STARTTLS` (if the host advertises it). This plugin does not work with implicit SMTP over TLS.
42
+
43
+ - auth_type=[plain\|login]
44
+
45
+ Enable PLAIN or LOGIN SMTP AUTH. This is required to enable AUTH.
46
+
47
+ - auth_user=USERNAME
48
+
49
+ SMTP AUTH username to use.
50
+
51
+ - auth_pass=PASSWORD
52
+
53
+ SMTP AUTH password to use.
54
+
55
+ - queue
56
+
57
+ Which queue plugin to use. Default: undefined. The default bahavior is to use smtp_forward for inbound connections and outbound for relaying connections. This option is used for complex mail routes.
58
+
59
+ - check_sender=false
60
+
61
+ Requires that sender domains defined in smtp_forward.ini (see Per-Domain below) have relaying privileges. This is a form of spoof prevention and assumes that any mail clients have relaying or AUTH privileges. This is usually the case.
62
+
63
+ - check_recipient=false
64
+
65
+ By default, Haraka accepts no emails until a recipient plugin has been configured to accept mails for a domain. The simplest common case is the in_host_list plugin with a list of domains in config/host_list. An alternative is to set `check_recipient=true` and list each domain in a definition block in smtp_forward.ini (see Per-Domain Configuration). An example for two domains:
66
+
67
+ [example.com]
68
+ [example.net]
69
+
70
+ - [tls]
71
+
72
+ Client STARTTLS options are assembled by merging:
73
+
74
+ 1. `tls.ini` `[main]` — the global Haraka TLS config
75
+ 2. `smtp_forward.ini` `[tls]` — overrides. Anything set here wins.
76
+
77
+ Example `smtp_forward.ini` `[tls]` section:
78
+
79
+ [tls]
80
+ rejectUnauthorized=true
81
+ minVersion=TLSv1.2
82
+ no_tls_hosts[]=10.0.0.5
83
+
84
+ Per-domain `enable_tls=false` still disables STARTTLS for that backend. Per-domain TLS cipher/cert overrides are not currently supported.
85
+
86
+ Changes to `tls.ini` require a Haraka restart to apply to the forward path; changes to `smtp_forward.ini` are picked up by the existing reload hook.
87
+
88
+ # Per-Domain Configuration
89
+
90
+ More specific forward routes for domains can be defined. The domain is chosen based on the value of the `domain_selector` config variable.
91
+
92
+ When `domain_selector` is set to `rcpt_to` (the default), more specific routes are only honored for SMTP connections with a single recipient or SMTP connections where every recipient host is identical.
93
+
94
+ When `domain_selector` is set to `mail_from`, it first searches for configuration using the complete email address, falls back to the domain if not found, then to main configuration.
95
+
96
+ enable_outbound can be set or unset on a per-domain level to enable or disable forwarding for specific domains.
97
+
98
+ # default SMTP host
99
+ host=1.2.3.4
100
+ # auth_type=plain
101
+ # auth_user=user
102
+ # auth_user=pass
103
+
104
+ [example1.com]
105
+ host=1.2.3.5
106
+ # auth_type=plain
107
+ # auth_user=user
108
+ # auth_pass=pass
109
+
110
+ [email@example1.com]
111
+ host=1.2.3.5
112
+ # auth_type=plain
113
+ # auth_user=user
114
+ # auth_pass=pass
115
+
116
+ [example2.com]
117
+ host=1.2.3.5
118
+
119
+ [example3.com]
120
+ host=1.2.3.6
121
+
122
+ [example4.com]
123
+ enable\_outbound=false
124
+
125
+ # Split host forward routing
126
+
127
+ When an incoming email transaction has multiple recipients with different forward routes, recipients to subsequent forward routes are deferred. Example: an incoming email transaction has recipients user@example1.com, user@example2.com, and user@example3.com. The first two recipients will be accepted (they share the same forward destination) and the latter will be deferred. It will arrive in a future delivery attempt by the remote.
@@ -0,0 +1,68 @@
1
+ # queue/smtp_proxy
2
+
3
+ ================
4
+
5
+ This plugin delivers to another mail server. This is a common setup when you want to have a mail server with a solid pedigree of outbound delivery to other hosts, and inbound delivery to users.
6
+
7
+ In comparison to `queue/smtp_forward`, this plugin makes a connection at MAIL FROM time to the ongoing SMTP server. This can be a benefit in that you get any SMTP-time filtering that the ongoing server provides, in particular one important facility to some setups is recipient filtering.
8
+
9
+ Be aware that other than connect and HELO-time filtering, you will have as many connections to your ongoing SMTP server as you have to Haraka.
10
+
11
+ ## Configuration
12
+
13
+ ---
14
+
15
+ Configuration is stored in smtp_proxy.ini in the following keys:
16
+
17
+ - enable_outbound=[true]
18
+
19
+ SMTP proxy outbound messages (set to false to enable Haraka's
20
+ separate Outbound mail routing (MX based delivery)).
21
+
22
+ - host=HOST
23
+
24
+ The host to connect to.
25
+
26
+ - port=PORT
27
+
28
+ The port to connect to.
29
+
30
+ - connect_timeout=SECONDS
31
+
32
+ The maximum amount of time to wait when creating a new connection
33
+ to the host. Default if unspecified is 30 seconds.
34
+
35
+ - timeout=SECONDS
36
+
37
+ The amount of seconds to let a backend connection live idle in the
38
+ proxy pool. This should always be less than the global plugin timeout,
39
+ which should in turn be less than the connection timeout.
40
+
41
+ - max_connections=NUMBER
42
+
43
+ Maximum number of connections to create at any given time.
44
+
45
+ - enable_tls=[true|yes|1]
46
+
47
+ Enable opportunistic TLS with the forward host via `STARTTLS` (if the host advertises it).
48
+
49
+ - auth_type=[plain|login]
50
+
51
+ Enable PLAIN or LOGIN SMTP AUTH. This is required to enable AUTH.
52
+
53
+ - auth_user=USERNAME
54
+
55
+ SMTP AUTH username to use.
56
+
57
+ - auth_pass=PASSWORD
58
+
59
+ SMTP AUTH password to use.
60
+
61
+ - [tls]
62
+
63
+ Client STARTTLS options are assembled by merging:
64
+
65
+ 1. `tls.ini` `[main]` — the global Haraka TLS config.
66
+ 2. `smtp_proxy.ini` `[tls]` — overrides. Anything set here wins.
67
+
68
+ Changes to `tls.ini` require a Haraka restart to apply to the proxy path; changes to `smtp_proxy.ini` are picked up by the existing reload hook.
@@ -0,0 +1,7 @@
1
+ # queue/test
2
+
3
+ This plugin saves incoming E-Mail to your temporary directory, as `mail_{message_id}.eml`, where message_id is a UUID.
4
+
5
+ This plugin can be useful to quickly test if you're able to receive incoming E-Mail and just dump them to disk.
6
+
7
+ The temporary directory is determined using Node's [`os.tmpdir()`](https://nodejs.org/api/os.html#ostmpdir), which respects standard platform configurations.
@@ -0,0 +1,34 @@
1
+ # rcpt_to.in_host_list
2
+
3
+ This plugin is the mainstay of an inbound Haraka server. It should list the
4
+ domains that are local to the host. Mails that have RCPT TO not matching
5
+ a host in the given list will be passed onto other rcpt hooks. If no rcpt
6
+ hook accepts the connection, it will be rejected.
7
+
8
+ ## Configuration
9
+
10
+ - host_list
11
+
12
+ Specifies the list of hosts that are local to this server.
13
+
14
+ - host_list_regex
15
+
16
+ Specifies the list of regexes that are local to this server. Note
17
+ all these regexes are anchored with ^regex$. One can choose not to
18
+ anchor with .\*. There is the potential for bad regexes to be
19
+ too permissive if we don't anchor.
20
+
21
+ - host_list.anti_spoof
22
+
23
+ When enabled, this will cause Haraka to reject any MAIL FROM where
24
+ the host appears within the host list but the connected host is not
25
+ a relay, e.g. connection.relaying is not set either by SMTP AUTH or
26
+ another plugin like 'relay'.
27
+
28
+ ## Relaying
29
+
30
+ This plugin checks to see if the MAIL FROM domain is local. When
31
+ connection.relaying is detected (haraka -h relay) and the MAIL FROM domain is
32
+ local, this plugin will vouch for any RCPT. This limits relaying users to
33
+ sending from local domains, which is much safer than letting relay clients
34
+ send from any domain.
@@ -0,0 +1,3 @@
1
+ # rcpt_to.max_count
2
+
3
+ The functionality of this plugin was integrated in to [haraka-plugin-limit](https://github.com/haraka/haraka-plugin-limit).
@@ -0,0 +1,20 @@
1
+ # record_envelope_addresses
2
+
3
+ This plugin adds two new header lines.
4
+
5
+ - X-Envelope-To: the envelope RCPT TO address
6
+ - X-Envelope-From: the envelope MAIL FROM address
7
+
8
+ It is useful if you need to know the exact addresses used to send an email, e.g. when
9
+ the email was sent to you as BCC or if it is a newsletter. In both cases the recipient
10
+ address is normally not recorded in the headers.
11
+
12
+ ## Caveats
13
+
14
+ If you enable this plugin you may introduce a possible information leak, i.e. disclosure
15
+ of BCC recipients. So you never want to use this on an outgoing mail server and maybe also
16
+ not if this server is used as a relay.
17
+
18
+ ## Configuration
19
+
20
+ This plugin has no configuration.
@@ -0,0 +1,3 @@
1
+ # relay
2
+
3
+ Repackaged as [haraka-plugin-relay](https://github.com/haraka/haraka-plugin-relay).
@@ -0,0 +1,16 @@
1
+ # reseed_rng
2
+
3
+ Reseeds `Math.random()` in each cluster worker at start-up using
4
+ `crypto.randomBytes(256)`. Without this, workers forked at nearly the
5
+ same time can end up with correlated PRNG state, which can produce
6
+ UUID collisions and other "this should be impossible" bugs.
7
+
8
+ The plugin relies on [seedrandom](https://www.npmjs.com/package/seedrandom)
9
+ being loaded so that `Math.seedrandom()` is available.
10
+
11
+ Anyone running with `nodes=...` in `smtp.ini` (i.e. cluster mode) should
12
+ consider enabling this plugin.
13
+
14
+ ## Configuration
15
+
16
+ No configuration.
@@ -0,0 +1,41 @@
1
+ # Status
2
+
3
+ This plugin allows to get internal status of queues and pools with SMTP commands sent from localhost.
4
+
5
+ ## Communication
6
+
7
+ - **Request** &rarr; `STATUS <CMD> [param1] [param2]....`
8
+ - **Response** &larr; _&lt;SMTP code 211 or 500>&lt;space>&lt;json encoded response>\r\n_
9
+
10
+ ### Example
11
+
12
+ ```
13
+ < 220 example.com ESMTP Haraka ready
14
+ > STATUS QUEUE INSPECT
15
+ < 211 {"delivery_queue":[],"temp_fail_queue":[]}
16
+ ```
17
+
18
+ ## Available commands list
19
+
20
+ - `STATUS POOL LIST` - map of active outbound connection pools, keyed by `host:port`
21
+ - `STATUS QUEUE STATS` - queue statistics in format `"<in_progress>/<delivery_queue length>/<temp_fail_queue length>"`
22
+ - `STATUS QUEUE LIST` - list of queue files on disk with _uuid, domain, mail_from, rcpt_to_ attributes
23
+ - `STATUS QUEUE INSPECT` - returns merged content of `outbound.delivery_queue` and `outbound.temp_fail_queue` across all workers
24
+ - `STATUS QUEUE DISCARD file` - stop delivering email file
25
+ - `STATUS QUEUE PUSH file` - try to re-deliver email immediately
26
+
27
+ ## Notes
28
+
29
+ ### Live data only
30
+
31
+ `POOL LIST`, `QUEUE STATS`, and `QUEUE INSPECT` reflect live in-memory state. They show only messages currently being processed or waiting in the retry queue. `QUEUE LIST` reads queue files from disk and may show messages that have already been delivered if they haven't been cleaned up yet.
32
+
33
+ ### Cluster mode
34
+
35
+ In cluster mode, `POOL LIST`, `QUEUE STATS`, and `QUEUE INSPECT` aggregate results from all worker processes into a single response:
36
+
37
+ - `POOL LIST` — pool maps from all workers are merged into one object
38
+ - `QUEUE STATS` — counters from all workers are summed into a single `"N/N/N"` string
39
+ - `QUEUE INSPECT` — `delivery_queue` and `temp_fail_queue` arrays from all workers are concatenated
40
+
41
+ `QUEUE LIST` always runs on the master process since it reads shared queue files from disk.
@@ -0,0 +1,50 @@
1
+ # tarpit
2
+
3
+ This plugin is designed to introduce deliberate delays on the response
4
+ of every hook in order to slow down a connection. It has no
5
+ configuration and is designed to be used only by other plugins.
6
+
7
+ It must be loaded early in config/plugins (e.g. before any plugins
8
+ that accept recipients or that return OK) but must be loaded _after_
9
+ any plugins that wish to use it.
10
+
11
+ ## Usage
12
+
13
+ To use this plugin in another plugin set:
14
+
15
+ connection.notes.tarpit = <seconds to delay>;
16
+
17
+ or
18
+
19
+ connection.transaction.notes.tarpit = <seconds to delay>;
20
+
21
+ ## Configuration
22
+
23
+ The configuration file for tarpit is config/tarpit.ini.
24
+
25
+ - hooks_to_delay - a list of hooks to delay at. This setting can be used to
26
+ override the default list in the plugin. For example, if you notice that
27
+ malware is disconnecting after delaying rcpt_ok, you can remove just that
28
+ hook from the list:
29
+
30
+ hooks_to_delay=connect,helo,ehlo,mail,rcpt,data,data_post,queue,unrecognized_command,vrfy,noop,rset,quit
31
+
32
+ ## Plugin Timeout
33
+
34
+ config/tarpit.timeout (Default: 0)
35
+
36
+ All Haraka plugins can configure a _name_.timeout file. The timeout specifies
37
+ how long Haraka lets the plugin do nothing before it times out. When zero,
38
+ there is no timeout. When non-zero and _seconds to delay_ is longer than
39
+ tarpit.timeout (default: 1s), you'll get errors like this in your log files:
40
+
41
+ [core] Plugin tarpit timed out on hook rcpt - make sure it calls the callback
42
+ [core] Plugin tarpit timed out on hook quit - make sure it calls the callback
43
+
44
+ The solution is to set the contents of config/tarpit.timeout to zero or
45
+ **seconds to delay** + 1.
46
+
47
+ ## Logging
48
+
49
+ When tarpitting a command it will log 'tarpitting response for Ns' to
50
+ the INFO facility where N is the number of seconds.
@@ -0,0 +1,235 @@
1
+ # tls
2
+
3
+ This plugin enables the use of TLS (via `STARTTLS`) in Haraka.
4
+
5
+ For this plugin to work you must have SSL certificates installed correctly.
6
+
7
+ Haraka has [SNI](https://en.wikipedia.org/wiki/Server_Name_Indication) support. When the remote MUA/MTA presents a servername during the TLS handshake and a TLS certificate with that Common Name matches, that certificate will be presented. If no match is found, the default certificate (see Certificate Files) is presented.
8
+
9
+ ## Certificate Files
10
+
11
+ Defaults settings are shown and can be overridden in `config/tls.ini`.
12
+
13
+ ```ini
14
+ key=tls_key.pem
15
+ cert=tls_cert.pem
16
+ dhparam=dhparams.pem
17
+ ```
18
+
19
+ ## Certificate Directory
20
+
21
+ If the directory `config/tls` exists, files within the directory are PEM encoded TLS files in one of two formats: bundles or Wild Wild West.
22
+
23
+ ### Certificate bundles
24
+
25
+ Generate PEM bundles in The Usual Way[TM] by concatenating the key, certificate, and CA/chain certs in that order. Example:
26
+
27
+ ```sh
28
+ cat example.com.key example.com.crt ca-int.crt > haraka/config/tls/example.com.pem
29
+ ```
30
+
31
+ An example [acme.sh](https://acme.sh) deployment [script](https://github.com/msimerson/Mail-Toaster-6/blob/master/provision/letsencrypt.sh) installs [Let's Encrypt](https://letsencrypt.org) certificate bundles to the Haraka `config/tls`directory.
32
+
33
+ ### Wild Wild West
34
+
35
+ PEM encoded TLS certificates and keys can be stored in files in `config/tls`. The certificate loader is recursive, so TLS files can be in subdirs like `config/tls/mx1.example.com`. The certificate names are parsed from the 1st cert in each file and indexed by the certs Common Name(s). Subject Alternate Names are supported. The file name containing the certificates does _not_ matter. Additional certificates within each file are presumed to be CA chain (intermediate) certificates.
36
+
37
+ If the TLS key is stored in the same file as the matching certificate, then the name of the file does not matter. If the TLS key is alone in a file, the file MUST be named with the keys Common Name. The file extension does not matter, `.pem` and `.key` are common. If the key is used for multiple CNs, the key must be stored in a file name matching each CN. Examples of working TLS key/cert file pairs for the Common Name mx1.example.com:
38
+
39
+ 1. certificate bundle (see above), key & cert in same file
40
+ - config/tls/mx1.example.com.pem (recommended)
41
+ - config/tls/any-unique-name.pem (CN is extracted from 1st cert)
42
+ 2. files in TLS dir
43
+ - config/tls/mx1.example.com.crt
44
+ - config/tls/mx1.example.com.key
45
+ 3. files in subdir
46
+ - config/tls/example.com/mx1.cert
47
+ - config/tls/example.com/mx1.example.com.key
48
+ 4. wildcard bundle on Windows platform (\* is not allowed in file names)
49
+ - config/tls/\_.example.com.pem
50
+
51
+ ## Purchased Certificate
52
+
53
+ For purchased certificate, append any intermediate/chained/ca-cert files to the certificate in this order:
54
+
55
+ 1. The CA signed SSL cert
56
+ 2. Any intermediate certificates
57
+ 3. The CA root certificate
58
+
59
+ See also [Setting Up TLS](https://github.com/haraka/Haraka/wiki/Setting-up-TLS-with-CA-certificates)
60
+
61
+ ## Self Issued (unsigned) Certificate
62
+
63
+ Create a certificate and key file in the config directory with the following command:
64
+
65
+ openssl req -x509 -nodes -days 2190 -newkey rsa:2048 \
66
+ -keyout config/tls_key.pem -out config/tls_cert.pem
67
+
68
+ You will be prompted to provide details of your organization. Make sure the
69
+ Common Name is set to your servers Fully Qualified Domain Name, which should
70
+ be the same as the contents of your `config/me` file.
71
+
72
+ ## Configuration
73
+
74
+ The following settings can be specified in `config/tls.ini`.
75
+
76
+ ### key
77
+
78
+ Specifies an alternative location for the key file. For multiple keys, use `key[]=` assignment for each. Non-absolute paths are relative to the `config/` directory.
79
+
80
+ To configure a single key and a cert chain, located in the `config/`
81
+ directory, use the following in `tls.ini`:
82
+
83
+ ```ini
84
+ key=example.com.key.pem
85
+ cert=example.com.crt-chain.pem
86
+ ```
87
+
88
+ To use multiple pairs of key and cert chain files outside of the haraka
89
+ `config/` directory, configure instead:
90
+
91
+ ```ini
92
+ key[]=/etc/ssl/private/example.com.rsa.key.pem
93
+ cert[]=/etc/ssl/private/example.com.rsa.crt-chain.pem
94
+ key[]=/etc/ssl/private/example.com.ecdsa.key.pem
95
+ cert[]=/etc/ssl/private/example.com.ecdsa.crt-chain.pem
96
+ ```
97
+
98
+ ### cert
99
+
100
+ Specifies the location(s) for the certificate chain file. For multiple certificate chains, use `cert[]=` assignment for each. Non-absolute paths are relative to the `config/` directory. See the description of the `key` parameter for specific use.
101
+
102
+ ### no_tls_hosts
103
+
104
+ If needed, add this section to the `config/tls.ini` file and list any IP ranges that have broken TLS hosts. Ex:
105
+
106
+ ```ini
107
+ [no_tls_hosts]
108
+ 192.168.1.3
109
+ 172.16.0.0/16
110
+ ```
111
+
112
+ Note: `[no_tls_hosts]` section applies to inbound only. For outbound mail, this feature is implemented as an array like `force_tls_hosts`:
113
+
114
+ ```ini
115
+ [outbound]
116
+ no_tls_hosts[]=192.168.1.3
117
+ no_tls_hosts[]=172.16.0.0/16
118
+ ```
119
+
120
+ The [Node.js TLS](http://nodejs.org/api/tls.html) page has additional information about the following options.
121
+
122
+ ### no_starttls_ports
123
+
124
+ An array of incoming ports on which Haraka will not advertise STARTTLS capability.
125
+
126
+ ```ini
127
+ no_starttls_ports[]=2525
128
+ ```
129
+
130
+ ### force_tls_hosts
131
+
132
+ For known good TLS hosts, it's possible to force that the outbound mailer will only connect via secure sockets. This makes Haraka use _forced TLS_ instead of _opportunistic TLS_. For forced TLS, the STARTTLS upgrade must succeed with a valid certificate (overriding `rejectUnauthorized`). The list is matched both against the host (MX record or `nexthop` in `relay_dest_domains.ini`), and the domain name of the email address.
133
+
134
+ Note: unlike `no_tls_hosts`, this feature is implemented as an array:
135
+
136
+ ```ini
137
+ [outbound]
138
+ force_tls_hosts[]=172.17.123.1
139
+ force_tls_hosts[]=172.17.124.0/24
140
+ force_tls_hosts[]=mx.example.org
141
+ force_tls_hosts[]=example.com
142
+ ```
143
+
144
+ ### ciphers
145
+
146
+ A list of allowable ciphers to use. Example:
147
+
148
+ ciphers=EECDH+AESGCM:EDH+aRSA+AESGCM:EECDH+AES256:EDH+aRSA+AES256:EECDH+AES128:EDH+aRSA+AES128:RSA+AES:RSA+3DES
149
+
150
+ See also: [Mozilla SSL configuration generator](https://ssl-config.mozilla.org/) and the [SSLlabs Test Page](https://www.ssllabs.com/ssltest/index.html)
151
+
152
+ ### minVersion
153
+
154
+ Specifies minimum allowable TLS protocol version to use. Example:
155
+
156
+ minVersion=TLSv1.1
157
+
158
+ If unset, the default is Node's `tls.DEFAULT_MIN_VERSION` constant
159
+ (currently `'TLSv1.2'`). Valid values: `'TLSv1.3'`, `'TLSv1.2'`,
160
+ `'TLSv1.1'`, `'TLSv1'`.
161
+
162
+ ### honorCipherOrder
163
+
164
+ If specified, the list of configured ciphers is treated as the cipher priority from highest to lowest. The first matching cipher will be used, instead of letting the client choose. The default is `true`.
165
+
166
+ ### ecdhCurve
167
+
168
+ Specifies the elliptic curve used for ECDH or ECDHE ciphers.
169
+ Only one curve can be specified. The default is `prime256v1` (NIST P-256).
170
+
171
+ ### dhparam
172
+
173
+ Specifies the file containing the diffie-hellman parameters to use for DH or DHE key exchange. If this param or file is missing, it will be generated automatically. Default: `dhparams.pem`.
174
+
175
+ ### requestCert
176
+
177
+ Whether Haraka should request a certificate from a connecting client.
178
+
179
+ requestCert=[true|false] (default: true)
180
+
181
+ ### rejectUnauthorized
182
+
183
+ Reject connections from clients without a CA validated TLS certificate.
184
+
185
+ rejectUnauthorized=[true|false] (default: false)
186
+
187
+ ### requireAuthorized
188
+
189
+ When `rejectUnauthorized=false`, require validated TLS certificates on just the specified ports.
190
+
191
+ ```ini
192
+ requireAuthorized[]=465
193
+ ;requireAuthorized[]=587
194
+ ```
195
+
196
+ ### secureProtocol
197
+
198
+ Legacy. Specifies the OpenSSL API function used to negotiate TLS — see
199
+ the [OpenSSL API page](https://www.openssl.org/docs/manmaster/ssl/ssl.html).
200
+ Prefer `minVersion` for modern setups; `secureProtocol` is only useful
201
+ to lock to a specific historic protocol.
202
+
203
+ ### requestOCSP
204
+
205
+ Specifies that OCSP Stapling should be enabled, according to RFC 6066.
206
+ Stapling of OCSP messages allows the client to receive these along the
207
+ TLS session setup instead of delaying the session setup by requiring a
208
+ separate http connection to the OCSP server.
209
+
210
+ requestOCSP=[true|false] (default: false)
211
+
212
+ OCSP responses from the OCSP server are cached in memory for as long as
213
+ they are valid, and get refreshed after that time. A server restart
214
+ requires the OCSP responses to be fetched again upon the first client
215
+ connection.
216
+
217
+ ## Inbound Specific Configuration
218
+
219
+ By default the above options are shared with outbound mail (either
220
+ using `smtp_forward`, `smtp_proxy` or plain outbound mail heading to
221
+ an external destination). To make these options specific to inbound
222
+ mail, put them under an `[inbound]` parameter group. Outbound options
223
+ can go under an `[outbound]` parameter group, and plugins that use
224
+ SMTP tls for queueing such as `smtp_proxy` and `smtp_forward` can
225
+ use that plugin name for plugin specific options.
226
+
227
+ ## `[redis]` section
228
+
229
+ This section is mainly used to enable so called _TLS NO-GO_ feature that essentially stops advertising/using TLS if there was a problem setting it up previously. We use `no_tls|ip.add.re.ss` key to store the flag in redis. There are a couple of settings that control the behavior:
230
+
231
+ `disable_for_failed_hosts = true` to enable the feature
232
+
233
+ `disable_expiry = 604800` to set for how long we disable TLS for failing host, in seconds
234
+
235
+ `disable_inbound_expiry = 3600` same as above, but applies to inbound (aka STARTTLS capability) only
@@ -0,0 +1,27 @@
1
+ # toobusy
2
+
3
+ This plugin will stop Haraka accepting new connections when the event loop
4
+ latency is too high.
5
+
6
+ See https://github.com/STRML/node-toobusy for details.
7
+
8
+ To use this plugin you must install the [`toobusy-js`](https://www.npmjs.com/package/toobusy-js)
9
+ module — it is not bundled with Haraka. From your Haraka install
10
+ directory:
11
+
12
+ ```sh
13
+ npm install toobusy-js
14
+ ```
15
+
16
+ This plugin registers on the `connect` hook with priority `-100`, so it
17
+ runs ahead of other `connect`/`lookup_rdns` plugins. Listing it near the
18
+ top of `config/plugins` is still a good idea for clarity.
19
+
20
+ ## Configuration
21
+
22
+ If you wish to override the default maxLag value of 70ms then add the desired
23
+ value to config/toobusy.maxlag. This can be set and changed at runtime and
24
+ no restart is required.
25
+
26
+ Note that if you set the maxLag value to <10 then this will cause the toobusy
27
+ module to raise an exception which will cause Haraka to stop.
@@ -0,0 +1,10 @@
1
+ # xclient
2
+
3
+ Implements the [XCLIENT](http://www.postfix.org/XCLIENT_README.html) protocol.
4
+
5
+ ## configuration
6
+
7
+ - xclient.hosts
8
+
9
+ A list of IP addresses, one per line that should be allowed to use the
10
+ XCLIENT protocol. Localhost (127.0.0.1 or ::1) is allowed implicitly.