Haraka 3.1.5 → 3.1.7

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 (79) hide show
  1. package/.prettierignore +1 -1
  2. package/{Changes.md → CHANGELOG.md} +54 -3
  3. package/CONTRIBUTORS.md +26 -26
  4. package/Plugins.md +99 -99
  5. package/README.md +68 -93
  6. package/SECURITY.md +178 -0
  7. package/bin/haraka +7 -14
  8. package/config/plugins +0 -3
  9. package/config/smtp_forward.ini +10 -0
  10. package/config/smtp_proxy.ini +10 -0
  11. package/connection.js +25 -8
  12. package/docs/Connection.md +126 -39
  13. package/docs/CoreConfig.md +92 -74
  14. package/docs/HAProxy.md +41 -25
  15. package/docs/Logging.md +68 -38
  16. package/docs/Outbound.md +124 -179
  17. package/docs/Plugins.md +38 -59
  18. package/docs/Transaction.md +78 -83
  19. package/docs/Tutorial.md +122 -209
  20. package/docs/plugins/aliases.md +1 -141
  21. package/docs/plugins/auth/auth_ldap.md +2 -39
  22. package/docs/plugins/max_unrecognized_commands.md +4 -18
  23. package/docs/plugins/process_title.md +3 -3
  24. package/docs/plugins/queue/smtp_forward.md +19 -3
  25. package/docs/plugins/queue/smtp_proxy.md +10 -2
  26. package/docs/plugins/reseed_rng.md +11 -13
  27. package/docs/plugins/tls.md +7 -7
  28. package/docs/plugins/toobusy.md +10 -4
  29. package/docs/tutorials/SettingUpOutbound.md +40 -48
  30. package/endpoint.js +32 -2
  31. package/haraka.js +1 -1
  32. package/outbound/hmail.js +42 -41
  33. package/outbound/index.js +7 -4
  34. package/outbound/tls.js +2 -43
  35. package/package.json +51 -61
  36. package/plugins/auth/auth_base.js +9 -3
  37. package/plugins/auth/auth_proxy.js +14 -11
  38. package/plugins/block_me.js +4 -2
  39. package/plugins/prevent_credential_leaks.js +3 -1
  40. package/plugins/process_title.js +6 -6
  41. package/plugins/queue/qmail-queue.js +15 -19
  42. package/plugins/queue/smtp_forward.js +12 -4
  43. package/plugins/queue/smtp_proxy.js +14 -3
  44. package/plugins/tls.js +13 -5
  45. package/plugins/xclient.js +3 -1
  46. package/server.js +22 -10
  47. package/smtp_client.js +20 -11
  48. package/test/config/block_me.recipient +1 -0
  49. package/test/config/block_me.senders +1 -0
  50. package/test/connection.js +258 -0
  51. package/test/endpoint.js +27 -0
  52. package/test/outbound/bounce_net_errors.js +3 -2
  53. package/test/outbound/hmail.js +19 -0
  54. package/test/outbound/index.js +189 -0
  55. package/test/outbound/queue.js +92 -0
  56. package/test/plugins/auth/auth_bridge.js +80 -0
  57. package/test/plugins/auth/flat_file.js +128 -0
  58. package/test/plugins/block_me.js +157 -0
  59. package/test/plugins/data.signatures.js +114 -0
  60. package/test/plugins/delay_deny.js +263 -0
  61. package/test/plugins/prevent_credential_leaks.js +178 -0
  62. package/test/plugins/process_title.js +135 -0
  63. package/test/plugins/queue/deliver.js +99 -0
  64. package/test/plugins/queue/discard.js +79 -0
  65. package/test/plugins/queue/lmtp.js +138 -0
  66. package/test/plugins/queue/qmail-queue.js +99 -0
  67. package/test/plugins/queue/quarantine.js +81 -0
  68. package/test/plugins/queue/smtp_bridge.js +154 -0
  69. package/test/plugins/queue/smtp_forward.js +42 -6
  70. package/test/plugins/queue/smtp_proxy.js +139 -0
  71. package/test/plugins/reseed_rng.js +34 -0
  72. package/test/plugins/tarpit.js +91 -0
  73. package/test/plugins/tls.js +25 -0
  74. package/test/plugins/toobusy.js +21 -0
  75. package/test/plugins/xclient.js +14 -0
  76. package/test/server.js +231 -0
  77. package/test/smtp_client.js +45 -12
  78. package/test/tls_socket.js +220 -0
  79. package/tls_socket.js +52 -2
package/Plugins.md CHANGED
@@ -19,123 +19,123 @@ A comprehensive list of known plugins. Create a PR to add yours to these lists.
19
19
 
20
20
  ### Auth Plugins
21
21
 
22
- | Name | Description |
23
- | -------------------------------- | ------------------------------------------------- |
24
- | [auth-enc-file][url-authencflat] | Auth against user/pass in an encrypted file |
25
- | [flat_file][url-authflat] | Auth against user/pass in a file |
26
- | [auth_bridge][url-authbridge] | Auth against remote MTA |
27
- | [auth-imap][url-auth-imap] | Auth against IMAP server |
28
- | [auth_ldap][url-auth-ldap] | Auth against LDAP |
29
- | [auth_proxy][url-authproxy] | Auth against remote MTA |
30
- | [auth_vpopmaild][url-authvpop] | Auth against vpopmaild |
31
- | [dkim][url-dkim] | DKIM sign & verify |
32
- | [dovecot][url-dovecot] | SMTP AUTH & recipient validation against dovecot |
33
- | [LDAP][url-ldap] | Aliases, Auth, and Recipient validation from LDAP |
34
- | [mailauth][url-mailauth] | Email Auth (SPF, DKIM, DMARC, ARC, & BIMI) |
35
- | [opendkim][url-opendkim] | DKIM sign and verify email messages |
36
- | [spf][url-spf] | Perform SPF checks |
22
+ | Name | Description | Published |
23
+ | -------------------------------- | ------------------------------------------------- | --------- |
24
+ | [auth-enc-file][url-authencflat] | Auth against user/pass in an encrypted file | 2018 |
25
+ | [flat_file][url-authflat] | Auth against user/pass in a file | 2026 |
26
+ | [auth_bridge][url-authbridge] | Auth against remote MTA | 2026 |
27
+ | [auth-imap][url-auth-imap] | Auth against IMAP server | 2022 |
28
+ | [auth_ldap][url-auth-ldap] | Auth against LDAP | 2023 |
29
+ | [auth_proxy][url-authproxy] | Auth against remote MTA | 2026 |
30
+ | [auth_vpopmaild][url-authvpop] | Auth against vpopmaild | 2026 |
31
+ | [dkim][url-dkim] | DKIM sign & verify | 2026 |
32
+ | [dovecot][url-dovecot] | SMTP AUTH & recipient validation against dovecot | 2025 |
33
+ | [LDAP][url-ldap] | Aliases, Auth, and Recipient validation from LDAP | 2024 |
34
+ | [mailauth][url-mailauth] | Email Auth (SPF, DKIM, DMARC, ARC, & BIMI) | 2024 |
35
+ | [opendkim][url-opendkim] | DKIM sign and verify email messages | 2018 |
36
+ | [spf][url-spf] | Perform SPF checks | 2026 |
37
37
 
38
38
  ### Enrichment Plugins
39
39
 
40
- | Name | Description |
41
- | ------------------------------ | ------------------------------------------ |
42
- | [ASN][url-asn] | Get ASN info for remote senders |
43
- | [fcrdns][url-fcrdns] | Forward Confirmed reverse DNS |
44
- | [geoip][url-geoip] | get geographic information about mail senders |
45
- | [p0f][url-p0f] | TCP Fingerprinting |
46
- | [karma][url-karma] | Dynamic scoring of incoming connections |
47
- | [known-senders][url-known-senders] | Reward emails from those you send mail to |
48
- | [record_envelope_addresses][url-recordenv] | Adds message headers with ENV recips |
40
+ | Name | Description | Published |
41
+ | ------------------------------------------ | --------------------------------------------- | --------- |
42
+ | [ASN][url-asn] | Get ASN info for remote senders | 2026 |
43
+ | [fcrdns][url-fcrdns] | Forward Confirmed reverse DNS | 2025 |
44
+ | [geoip][url-geoip] | get geographic information about mail senders | 2026 |
45
+ | [p0f][url-p0f] | TCP Fingerprinting | 2025 |
46
+ | [karma][url-karma] | Dynamic scoring of incoming connections | 2026 |
47
+ | [known-senders][url-known-senders] | Reward emails from those you send mail to | 2025 |
48
+ | [record_envelope_addresses][url-recordenv] | Adds message headers with ENV recips | 2026 |
49
49
 
50
50
  ### Filtering Plugins
51
51
 
52
- | Name | Description |
53
- | ------------------------------ | ------------------------------------------ |
54
- | [attachment][url-attach] | Restrict attachment types |
55
- | [block_me][url-blockme] | Populate block list via forwarded emails |
56
- | [avg][url-avg] | AVG antivirus scanner |
57
- | [clamd][url-clamd] | Anti-Virus scanning with ClamAV |
58
- | [data.signatures][url-sigs] | Block emails whose bodies match signatures |
59
- | [dcc][url-dcc] | Distributed Checksum Clearinghouse |
60
- | [dns-list][url-dns-list] | Check against DNS and reputation lists |
61
- | [early_talker][url-early] | Reject remotes that talk early |
62
- | [esets][url-esets] | Virus scanning with ESET Mail Security |
63
- | [greylist][url-greylist] | Greylisting |
64
- | [helo.checks][url-helo] | Validity checks of the HELO string |
65
- | [mail_from.is_resolvable][url-mfres] | Verifies the MAIL FROM domain resolves to a MX |
66
- | [messagesniffer][url-msgsniff] | Anti-spam via [MessageSniffer][url-ms] |
67
- | [milter][url-milter] | milter support |
68
- | [rspamd][url-rspamd] | Scan emails with rspamd |
69
- | [spamassassin][url-spamass] | Scan emails with SpamAssassin |
70
- | [uribl][url-uribl] | Block based on URI blacklists |
52
+ | Name | Description | Published |
53
+ | ------------------------------------ | ---------------------------------------------- | --------- |
54
+ | [attachment][url-attach] | Restrict attachment types | 2026 |
55
+ | [block_me][url-blockme] | Populate block list via forwarded emails | 2026 |
56
+ | [avg][url-avg] | AVG antivirus scanner | 2024 |
57
+ | [clamd][url-clamd] | Anti-Virus scanning with ClamAV | 2025 |
58
+ | [data.signatures][url-sigs] | Block emails whose bodies match signatures | 2026 |
59
+ | [dcc][url-dcc] | Distributed Checksum Clearinghouse | 2025 |
60
+ | [dns-list][url-dns-list] | Check against DNS and reputation lists | 2025 |
61
+ | [early_talker][url-early] | Reject remotes that talk early | 2026 |
62
+ | [esets][url-esets] | Virus scanning with ESET Mail Security | 2025 |
63
+ | [greylist][url-greylist] | Greylisting | 2026 |
64
+ | [helo.checks][url-helo] | Validity checks of the HELO string | 2026 |
65
+ | [mail_from.is_resolvable][url-mfres] | Verifies the MAIL FROM domain resolves to a MX | 2026 |
66
+ | [messagesniffer][url-msgsniff] | Anti-spam via [MessageSniffer][url-ms] | 2025 |
67
+ | [milter][url-milter] | milter support | 2017 |
68
+ | [rspamd][url-rspamd] | Scan emails with rspamd | 2026 |
69
+ | [spamassassin][url-spamass] | Scan emails with SpamAssassin | 2026 |
70
+ | [uribl][url-uribl] | Block based on URI blacklists | 2025 |
71
71
 
72
72
  ### Logging & Telemetry
73
73
 
74
- | Name | Description |
75
- | -------------------------------- | ------------------------------------------------------------------------ |
76
- | [accounting_files][url-acc-files] | Retrieve, Store and Archive custom information of outbound traffic |
77
- | [elasticsearch][url-elastic] | Store message metadata in Elasticsearch |
78
- | [log reader][url-logreader] | extract log entries from the haraka log file |
79
- | [outbound-logger][url-outbound-logger] | JSON logging of outbound email. Logs metadata about delivered/bounced emails |
80
- | [process_title][url-proctitle] | Populate `ps` output with activity counters |
81
- | [syslog][url-syslog] | Log to syslog |
82
- | [watch][url-watch] | Watch live SMTP traffic in a web interface |
74
+ | Name | Description | Published |
75
+ | -------------------------------------------- | ---------------------------------------------------------------------------- | --------- |
76
+ | [accounting_files][url-acc-files] | Retrieve, Store and Archive custom information of outbound traffic | 2017 |
77
+ | [elasticsearch][url-elastic] | Store message metadata in Elasticsearch | 2026 |
78
+ | [log reader][url-logreader] | extract log entries from the haraka log file | 2026 |
79
+ | [outbound-logger][url-outbound-logger] | JSON logging of outbound email. Logs metadata about delivered/bounced emails | — |
80
+ | [process_title][url-proctitle] | Populate `ps` output with activity counters | 2026 |
81
+ | [syslog][url-syslog] | Log to syslog | 2026 |
82
+ | [watch][url-watch] | Watch live SMTP traffic in a web interface | 2026 |
83
83
 
84
84
  ### Queue Plugins
85
85
 
86
- | Name | Description |
87
- | -------------------------------- | ------------------------------------------------------------------------ |
88
- | [discard][url-qdisc] | queues messages to /dev/null |
89
- | [kafka][url-kafka] | Queue inbound mail to a Kafka topic |
90
- | [lmtp][url-qlmtp] | deliver queued messages via LMTP |
91
- | [mongodb][mongo-url] | Queue emails to MongoDB |
92
- | [qmail-queue][url-qmail] | queue to qmail |
93
- | [quarantine][url-qquart] | queue to a quarantine directory |
94
- | [rabbitmq][url-qrabbit] | queue to RabbitMQ |
95
- | [rabbitmq_amqplib][url-qrabbita] | queue to RabbitMQ using amqplib |
96
- | [rails][url-qrails] | queue messages to a Rails app using [Action Mailbox][url-action-mailbox] |
97
- | [smtp_bridge][url-qbridge] | Bridge SMTP sessions to another MTA |
98
- | [smtp_forward][url-qforward] | Forward emails to another MTA |
99
- | [smtp_proxy][url-qproxy] | Proxy SMTP connections to another MTA |
100
- | [wildduck][url-wildduck] | queue messages to Wild Duck |
86
+ | Name | Description | Published |
87
+ | ---------------------------------- | ---------------------------------------------------------------------------- | --------- |
88
+ | [discard][url-qdisc] | queues messages to /dev/null | 2026 |
89
+ | [kafka][url-kafka] | Queue inbound mail to a Kafka topic | 2023 |
90
+ | [lmtp][url-qlmtp] | deliver queued messages via LMTP | 2026 |
91
+ | [mongodb][mongo-url] | Queue emails to MongoDB | 2024 |
92
+ | [qmail-queue][url-qmail] | queue to qmail | 2026 |
93
+ | [quarantine][url-qquart] | queue to a quarantine directory | 2026 |
94
+ | [rabbitmq][url-qrabbit] | queue to RabbitMQ | 2026 |
95
+ | [rabbitmq_amqplib][url-qrabbita] | queue to RabbitMQ using amqplib | — |
96
+ | [rails][url-qrails] | queue messages to a Rails app using [Action Mailbox][url-action-mailbox] | |
97
+ | [smtp_bridge][url-qbridge] | Bridge SMTP sessions to another MTA | 2026 |
98
+ | [smtp_forward][url-qforward] | Forward emails to another MTA | 2026 |
99
+ | [smtp_proxy][url-qproxy] | Proxy SMTP connections to another MTA | 2026 |
100
+ | [wildduck][url-wildduck] | queue messages to Wild Duck | 2026 |
101
101
 
102
102
  ### Recipient Validation
103
103
 
104
- | Name | Description |
105
- | -----------------------------------| ----------------------------------------------------- |
106
- | [dovecot][url-dovecot] | Recipient validation & SMTP AUTH against dovecot |
107
- | [LDAP][url-ldap] | Aliases, Auth, and Recipient validation from LDAP |
108
- | [recipient-routes][url-rroutes] | Route emails based on their recipient(s) |
109
- | [rcpt_to.in_host_list][url-rhost] | Define local email domains in a file |
110
- | [rcpt_to.ldap][url-rcpt-ldap] | Validate recipients against LDAP |
111
- | [rcpt-postgresql][url-postgres] | validate recipients against PostgreSQL |
112
- | [qmail-deliverable][url-rqmd] | Validate recipients against Qmail-Deliverable |
113
- | [vmta][url-vmta] | Virtual MTA management |
114
- | [wildduck][url-wildduck] | provides recipient checks against Wild Duck |
104
+ | Name | Description | Published |
105
+ | ---------------------------------- | ----------------------------------------------------- | --------- |
106
+ | [dovecot][url-dovecot] | Recipient validation & SMTP AUTH against dovecot | 2025 |
107
+ | [LDAP][url-ldap] | Aliases, Auth, and Recipient validation from LDAP | 2024 |
108
+ | [recipient-routes][url-rroutes] | Route emails based on their recipient(s) | 2025 |
109
+ | [rcpt_to.in_host_list][url-rhost] | Define local email domains in a file | 2026 |
110
+ | [rcpt_to.ldap][url-rcpt-ldap] | Validate recipients against LDAP | 2023 |
111
+ | [rcpt-postgresql][url-postgres] | validate recipients against PostgreSQL | 2016 |
112
+ | [qmail-deliverable][url-rqmd] | Validate recipients against Qmail-Deliverable | 2026 |
113
+ | [vmta][url-vmta] | Virtual MTA management | 2017 |
114
+ | [wildduck][url-wildduck] | provides recipient checks against Wild Duck | 2026 |
115
115
 
116
116
  ### Every other Plugin
117
117
 
118
- | Name | Description |
119
- | ------------------------------------------ | --------------------------------------------------------------- |
120
- | [access][url-access] | ACLs based on IPs, domains, email addrs, etc. |
121
- | [aliases][url-aliases] | Email aliases |
122
- | [bounce][url-bounce] | Many options for bounce processing |
123
- | [delay_deny][url-delay] | Delays all pre-DATA 'deny' results |
124
- | [dovecot][url-dovecot] | Recipient validation & SMTP AUTH against dovecot |
125
- | [headers][url-headers] | Inspect and verify various email headers |
126
- | [Limit][url-limit] | Apply many types of limits to SMTP connections |
127
- | [prevent_credential_leaks][url-creds] | Prevent users from emailing their credentials |
128
- | [redis][url-redis] | multi-purpose Redis db connection(s) |
129
- | [relay][url-relay] | Manage relay permissions |
130
- | [reseed_rng][url-rng] | Reseed the RNG |
131
- | [batv-srs][url-batv] | BATV & SRS |
132
- | [srs][url-srs] | Sender Rewriting Scheme |
133
- | [tarpit][url-tarpit] | Slow down connections |
134
- | [tls][url-tls] | Implements TLS |
135
- | [toobusy][url-toobusy] | Defers connections when too busy |
136
- | [xclient][url-xclient] | Implements XCLIENT |
137
- | [save-sent][url-save-sent] | Save sent emails on the serverside to a mailbox of the sender |
138
- | [dropbox][url-dropbox] | Forward incoming emails to configured Dropbox webhook URLs. |
118
+ | Name | Description | Published |
119
+ | ------------------------------------------ | --------------------------------------------------------------- | --------- |
120
+ | [access][url-access] | ACLs based on IPs, domains, email addrs, etc. | 2026 |
121
+ | [aliases][url-aliases] | Email aliases | 2026 |
122
+ | [bounce][url-bounce] | Many options for bounce processing | 2026 |
123
+ | [delay_deny][url-delay] | Delays all pre-DATA 'deny' results | 2026 |
124
+ | [dovecot][url-dovecot] | Recipient validation & SMTP AUTH against dovecot | 2025 |
125
+ | [headers][url-headers] | Inspect and verify various email headers | 2026 |
126
+ | [Limit][url-limit] | Apply many types of limits to SMTP connections | 2025 |
127
+ | [prevent_credential_leaks][url-creds] | Prevent users from emailing their credentials | 2026 |
128
+ | [redis][url-redis] | multi-purpose Redis db connection(s) | 2025 |
129
+ | [relay][url-relay] | Manage relay permissions | 2026 |
130
+ | [reseed_rng][url-rng] | Reseed the RNG | 2026 |
131
+ | [batv-srs][url-batv] | BATV & SRS | 2020 |
132
+ | [srs][url-srs] | Sender Rewriting Scheme | — |
133
+ | [tarpit][url-tarpit] | Slow down connections | 2026 |
134
+ | [tls][url-tls] | Implements TLS | 2026 |
135
+ | [toobusy][url-toobusy] | Defers connections when too busy | 2026 |
136
+ | [xclient][url-xclient] | Implements XCLIENT | 2026 |
137
+ | [save-sent][url-save-sent] | Save sent emails on the serverside to a mailbox of the sender | — |
138
+ | [dropbox][url-dropbox] | Forward incoming emails to configured Dropbox webhook URLs. | — |
139
139
 
140
140
  <!-- URLs tucked safely out of the way -->
141
141
 
package/README.md CHANGED
@@ -1,144 +1,119 @@
1
- ## Haraka - a Node.js Mail Server
1
+ # Haraka a Node.js Mail Server
2
2
 
3
3
  ![Tests](https://github.com/haraka/Haraka/actions/workflows/ci.yml/badge.svg)
4
4
  [![Coverage Status][cov-img]][cov-url]
5
5
 
6
- Haraka is a highly scalable [node.js][1] email server with a modular
7
- plugin architecture. Haraka can serve thousands of concurrent connections
8
- and deliver thousands of messages per second. Haraka and plugins are written
9
- in asynchronous JS and are very fast.
6
+ Haraka is a highly scalable [Node.js][1] SMTP server with a modular plugin architecture. It handles thousands of concurrent connections and delivers thousands of messages per second. Haraka and its plugins are written in asynchronous JavaScript, optimised for throughput and low latency.
10
7
 
11
- Haraka has very good spam protection (see [plugins][4]) and works
12
- well as a filtering [MTA][3]. It also works well as a [MSA][5] running on
13
- port 587 with auth and [dkim][6] plugins enabled.
8
+ Haraka offers strong spam protection (see [Plugins.md][plugins]) and is widely deployed as a filtering [MTA][3] or as a [MSA][5] on port 465 (and legacy 587) with the auth and [DKIM][6] plugins enabled.
14
9
 
15
- Haraka makes no attempt to be a mail store (like Exchange or Postfix/Exim/Qmail),
16
- a [LDA][7], nor an IMAP server (like Dovecot or Courier). Haraka is
17
- typically used **with** such systems.
10
+ Haraka is not a mail store, an [LDA][7], or an IMAP server. It is designed to work **alongside** those systems. A scalable outbound delivery engine is built in: mail flagged as `relaying` (for example, by an auth plugin) is queued for
11
+ outbound delivery automatically.
18
12
 
19
- Haraka has a scalable outbound mail delivery engine built in. Mail
20
- marked as `relaying` (such as via an `auth` plugin) is automatically
21
- queued for outbound delivery.
13
+ ## Plugin Architecture
22
14
 
23
- ### Getting Help
15
+ Haraka's defining feature is its plugin system. Every SMTP transaction is a sequence of well-defined hooks — `connect`, `helo`, `mail`, `rcpt`, `data`, `data_post`, `queue`, and more — and each hook can be extended with a few lines of JavaScript. Plugins are asynchronous by default, so a slow lookup against DNS, Redis, or an HTTP API never blocks the server.
24
16
 
25
- - [Join the mailing list][8] (implemented as a Haraka plugin)
26
- - [GitHub Issues][15]
17
+ The result is that behaviours which would require a custom MTA elsewhere are typically a small file in Haraka. For example, accepting qmail-style tagged addresses (`user-anything@domain.com`) and rewriting them to `user@domain.com` before forwarding to an Exchange or IMAP backend looks roughly like this:
27
18
 
28
- ### Screencast
19
+ ```js
20
+ exports.hook_rcpt = (next, connection, params) => {
21
+ const rcpt = params[0]
22
+ const [user] = rcpt.user.split('-')
23
+ rcpt.user = user
24
+ next()
25
+ }
26
+ ```
29
27
 
30
- [Getting started with Haraka][2]
28
+ A comprehensive registry of community and core plugins — auth, DNSBLs, DKIM, SpamAssassin, rspamd, Redis, ClamAV, queue backends, and many others — lives in [Plugins.md][plugins]. To write your own, see the [plugin tutorial][tutorial].
31
29
 
32
- ### Why Use Haraka?
30
+ ## Documentation
33
31
 
34
- Haraka's plugin architecture provides an easily extensible MTA that
35
- complements traditional MTAs that excel at managing mail stores but do
36
- not have sufficient filtering.
32
+ - [Plugins.md][plugins] plugin registry and configuration reference
33
+ - [docs/][docs] core documentation (Connection, Transaction, Outbound, …)
34
+ - [Tutorial][tutorial] step-by-step getting started guide
35
+ - [CHANGELOG.md][changelog] — release notes
36
+ - [SECURITY.md][security] — security policy and reporting
37
37
 
38
- The plugin system makes it easy to code new features. A typical example
39
- is providing qmail-like extended addresses to an Exchange system,
40
- whereby you could receive mail as `user-anyword@domain.com`, and yet
41
- still have it correctly routed to `user@domain.com`. This is a few lines of
42
- code in Haraka.
38
+ ## Getting Help
43
39
 
44
- Plugins are provided for running mail through [SpamAssassin][9], validating
45
- [HELO][10] names, checking [DNS Blocklists][11], and [many others][12].
40
+ - [GitHub Issues][issues]
41
+ - [Mailing list][mailing-list] (implemented as a Haraka plugin)
42
+ - [Screencast: Getting started with Haraka][screencast]
46
43
 
47
- ### Installing Haraka
44
+ ## Installation
48
45
 
49
- Haraka requires [node.js][1] to run. Install Haraka with [npm][2]:
46
+ Haraka requires [Node.js][1]. Install via [npm][npm]:
50
47
 
51
48
  ```sh
52
- # If the second command gives "nobody" errors, uncomment & run the next command
53
- # npm -g config set user root
54
49
  npm install -g Haraka
55
50
  ```
56
51
 
57
- After installation, use the `haraka` binary to set up the service.
58
-
59
- ### Running Haraka
60
-
61
- First, create the service:
52
+ Create a service directory:
62
53
 
63
54
  ```sh
64
55
  haraka -i /path/to/haraka_test
65
56
  ```
66
57
 
67
- That creates the directory `haraka_test` with `config` and `plugin`
68
- directories within. It also sets the host name used by Haraka
69
- to the output of `hostname`.
58
+ This creates `haraka_test` with `config/` and `plugins/` subdirectories and sets the host name from `hostname(1)`. Edit `config/host_list` to add the domains for which Haraka should accept mail.
70
59
 
71
- If `hostname` is not correct, edit `config/host_list`. For example,
72
- to receive mail addressed to `user@domain.com`, add `domain.com` to the
73
- `config/host_list` file.
74
-
75
- Finally, start Haraka using root permissions:
60
+ Start Haraka:
76
61
 
77
62
  ```sh
78
63
  haraka -c /path/to/haraka_test
79
64
  ```
80
65
 
81
- And it will run.
82
-
83
- ### Configure Haraka
66
+ ## Configuration
84
67
 
85
- To choose which plugins run, edit `config/plugins`. Plugins control the
86
- overall behaviour of Haraka. By default, only messages to domains listed
87
- in `config/host_list` will be accepted and then delivered via the
88
- `smtp-forward` plugin. Configure the destination in `config/smtp_forward.ini`.
68
+ Edit `config/plugins` to select active plugins. By default, mail addressed to domains in `config/host_list` is accepted and forwarded via the `smtp-forward` plugin (configured in `config/smtp_forward.ini`).
89
69
 
90
- ### Read the Fine Manual
70
+ Per-plugin documentation is available via:
91
71
 
92
72
  ```sh
93
- haraka -h plugins/$name
73
+ haraka -h plugins/<name>
94
74
  ```
95
75
 
96
- The docs detail how each plugin is configured. After editing
97
- `config/plugins`, restart Haraka and enjoy!
98
-
99
- ### Running from git
76
+ See [Plugins.md][plugins] for the full registry.
100
77
 
101
- If you are unable to use npm to install Haraka, you can run from git by
102
- following these steps:
78
+ ## Running from Source
103
79
 
104
- First clone the repository:
105
-
106
- $ git clone https://github.com/haraka/Haraka.git
107
- $ cd Haraka
108
-
109
- Install Haraka's node.js dependencies locally:
110
-
111
- $ npm install
112
-
113
- Edit `config/plugins` and `config/smtp.ini` to specify the plugins and
114
- config you want.
80
+ ```sh
81
+ git clone https://github.com/haraka/Haraka.git
82
+ cd Haraka
83
+ npm install
84
+ node haraka.js
85
+ ```
115
86
 
116
- Finally run Haraka:
87
+ ## Authorship and Maintenance
117
88
 
118
- $ node haraka.js
89
+ Haraka was created by [Matt Sergeant][matt-sergeant] (`baudehlo`), formerly project leader of [SpamAssassin][spamassassin] and a contributor to [Qpsmtpd][qpsmtpd]. The project is currently maintained by
90
+ [Matt Simerson][msimerson] (`msimerson`).
119
91
 
120
- ### License and Author
92
+ Haraka is the work of many hands. See [CONTRIBUTORS.md][contributors] for the full list of people who have contributed code, documentation, and plugins.
121
93
 
122
- Haraka is MIT licensed - see the [LICENSE][16] file for details.
94
+ ## License
123
95
 
124
- Haraka is a project started by [Matt Sergeant][17], a 10 year veteran of the email and anti-spam world. Previous projects have been the project leader for
125
- SpamAssassin and a hacker on [Qpsmtpd][13].
96
+ Haraka is released under the MIT License. See [LICENSE][license] for details.
126
97
 
127
- [1]: http://nodejs.org/
128
- [2]: http://youtu.be/6twKXMAsPsw
129
- [3]: http://en.wikipedia.org/wiki/Message_transfer_agent
130
- [4]: https://github.com/haraka/Haraka/blob/master/Plugins.md
131
- [5]: http://en.wikipedia.org/wiki/Mail_submission_agent
98
+ [1]: https://nodejs.org/
99
+ [3]: https://en.wikipedia.org/wiki/Message_transfer_agent
100
+ [5]: https://en.wikipedia.org/wiki/Message_submission_agent
132
101
  [6]: https://github.com/haraka/haraka-plugin-dkim
133
102
  [7]: https://en.wikipedia.org/wiki/Mail_delivery_agent
134
- [8]: mailto:haraka-sub@harakamail.com
135
- [9]: https://haraka.github.io/plugins/spamassassin
136
- [10]: https://haraka.github.io/plugins/helo.checks
137
- [11]: https://haraka.github.io/plugins/dnsbl
138
- [12]: https://github.com/haraka/Haraka/blob/master/Plugins.md
139
- [13]: https://github.com/smtpd/qpsmtpd/
140
- [15]: https://github.com/haraka/Haraka/issues
141
- [16]: https://github.com/haraka/Haraka/blob/master/LICENSE
142
- [17]: https://github.com/baudehlo
103
+ [npm]: https://www.npmjs.com/package/Haraka
104
+ [plugins]: https://github.com/haraka/Haraka/blob/master/Plugins.md
105
+ [docs]: https://github.com/haraka/Haraka/tree/master/docs
106
+ [tutorial]: https://github.com/haraka/Haraka/blob/master/docs/Tutorial.md
107
+ [changelog]: https://github.com/haraka/Haraka/blob/master/CHANGELOG.md
108
+ [security]: https://github.com/haraka/Haraka/blob/master/SECURITY.md
109
+ [contributors]: https://github.com/haraka/Haraka/blob/master/CONTRIBUTORS.md
110
+ [license]: https://github.com/haraka/Haraka/blob/master/LICENSE
111
+ [issues]: https://github.com/haraka/Haraka/issues
112
+ [mailing-list]: mailto:haraka-sub@harakamail.com
113
+ [screencast]: https://youtu.be/6twKXMAsPsw
114
+ [matt-sergeant]: https://github.com/baudehlo
115
+ [msimerson]: https://github.com/msimerson
116
+ [spamassassin]: https://spamassassin.apache.org/
117
+ [qpsmtpd]: https://github.com/smtpd/qpsmtpd/
143
118
  [cov-img]: https://codecov.io/github/haraka/Haraka/coverage.svg
144
119
  [cov-url]: https://codecov.io/github/haraka/Haraka?branch=master
package/SECURITY.md ADDED
@@ -0,0 +1,178 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ Security fixes are applied to the **current release** only. We encourage all users to run the latest version.
6
+
7
+ | Version | Supported |
8
+ | -------------- | --------- |
9
+ | 3.1.x (latest) | ✅ |
10
+ | < 3.1 | ❌ |
11
+
12
+ ## Reporting a Vulnerability
13
+
14
+ **Please do not report security vulnerabilities through public GitHub issues.**
15
+
16
+ Use [GitHub Private Vulnerability Reporting](https://github.com/haraka/Haraka/security/advisories/new) to disclose security issues confidentially. This allows the maintainers to assess and patch the issue before public disclosure.
17
+
18
+ Include as much of the following as possible:
19
+
20
+ - A description of the vulnerability and its potential impact
21
+ - Steps to reproduce or a proof-of-concept
22
+ - Affected version(s)
23
+ - Any suggested mitigations or patches
24
+
25
+ ## Response Process
26
+
27
+ 1. **Acknowledgement** — We aim to acknowledge reports within **72 hours**.
28
+ 2. **Assessment** — We will confirm the issue, determine severity, and identify affected versions.
29
+ 3. **Fix & Release** — A patch release will be prepared and coordinated with the reporter.
30
+ 4. **Disclosure** — A GitHub Security Advisory (and CVE if applicable) will be published after the fix is available.
31
+
32
+ We follow [coordinated vulnerability disclosure](https://vuls.cert.org/confluence/display/CVD). Reporters are credited in the advisory unless they prefer otherwise.
33
+
34
+ ## Security Advisories
35
+
36
+ Published advisories are listed at:
37
+ **https://github.com/haraka/Haraka/security/advisories**
38
+
39
+ ## Threat Model
40
+
41
+ Haraka is an SMTP server and plugin host. It accepts inbound network
42
+ connections, parses SMTP commands and message content, and can deliver mail
43
+ outbound when an operator enables relaying or outbound.
44
+
45
+ This threat model assumes the operator controls the host, configuration,
46
+ enabled plugins, credentials, TLS material, and any external services Haraka
47
+ is configured to use.
48
+
49
+ ### Data flow
50
+
51
+ ```mermaid
52
+ flowchart LR
53
+ client["SMTP client<br/>(untrusted)"]
54
+ dns["DNS resolver<br/>(untrusted)"]
55
+ peer["Outbound peer<br/>(untrusted)"]
56
+ operator(["Operator<br/>(trusted)"])
57
+ subgraph haraka["Haraka process — trust boundary"]
58
+ listener["Listener / TLS / Parser"] --> plugins["Plugin pipeline"]
59
+ plugins --> queue[("Queue · FS")]
60
+ queue --> delivery["Delivery"]
61
+ stores[("Config · TLS keys · Logs")]
62
+ end
63
+ client <--> listener
64
+ plugins <--> dns
65
+ delivery --> peer
66
+ operator -.-> stores
67
+ operator -.-> plugins
68
+ ```
69
+
70
+ The trust boundary is the Haraka process. External peers (SMTP clients, DNS
71
+ resolvers, outbound peers) are untrusted; data crossing the boundary inbound
72
+ must be validated before it affects delivery, state, or process behavior.
73
+ Inside the boundary, plugins, the queue, configuration, TLS material, and
74
+ logs share the Haraka process privilege and are the operator's
75
+ responsibility — they are not a security boundary against each other.
76
+
77
+ ### Assets
78
+
79
+ The assets Haraka aims to protect:
80
+
81
+ - **Message content** in transit and queued on disk
82
+ - **AUTH credentials** received via SMTP AUTH, and any upstream credentials
83
+ Haraka holds for outbound or backend services
84
+ - **TLS private keys** and certificates used by the listener and for
85
+ outbound delivery
86
+ - **Queue integrity** — no injection, alteration, or deletion of queued
87
+ messages from outside the trust boundary
88
+ - **Availability** of the SMTP service to legitimate clients
89
+ - **Sender reputation** of the operator's deployment — Haraka must not be
90
+ abusable as an open relay or spam amplifier under documented
91
+ configuration
92
+
93
+ ### Entry points and actors
94
+
95
+ Untrusted data enters Haraka through:
96
+
97
+ - **SMTP listeners** on the operator-configured ports (typically 25, 465,
98
+ 587, and any additional listeners enabled by plugins or configuration)
99
+ - **PROXY protocol or XCLIENT metadata** when the operator has enabled
100
+ trusted-relay forwarding
101
+ - **DNS responses** to lookups performed by Haraka core or plugins
102
+ (rDNS, SPF, DKIM, MX, DNSBL, etc.)
103
+ - **Outbound SMTP responses** received from peers during delivery
104
+
105
+ Haraka distinguishes these actors:
106
+
107
+ - **Anonymous SMTP client** — connecting from the network without
108
+ authentication; trusted only to issue SMTP commands subject to policy
109
+ - **Authenticated submission user** — passed SMTP AUTH; trusted with the
110
+ envelope and policy the operator's auth backend permits, nothing more
111
+ - **Trusted relay peer** — a network source the operator has configured to
112
+ bypass certain checks (e.g. permitted to relay, or whose PROXY/XCLIENT
113
+ metadata is honored)
114
+ - **Operator** — controls the host, configuration, and installed plugins;
115
+ fully trusted
116
+ - **Plugin code** — runs inside the trust boundary with full process
117
+ privilege; treated as trusted-as-installed, and not a security boundary
118
+
119
+ ### Haraka does not trust
120
+
121
+ - SMTP clients and other remote peers, including commands, envelopes, headers,
122
+ bodies, attachments, authentication attempts, HELO/EHLO names, and proxied
123
+ client metadata before validation
124
+ - Data returned by remote services Haraka communicates with, such as DNS
125
+ lookups and outbound SMTP peers
126
+ - Untrusted remote input must not be able to trigger behavior beyond
127
+ documented SMTP and plugin semantics, such as unauthorized relaying,
128
+ unintended command execution, protected-data disclosure, or service
129
+ unavailability
130
+
131
+ ### Haraka trusts
132
+
133
+ - The operating system, filesystem, Node.js runtime, local network, process
134
+ privileges, and local administrators operating the service
135
+ - Haraka configuration and deployment choices, including listener exposure,
136
+ relay and authentication policy, TLS certificates, proxy settings, and
137
+ enabled plugins
138
+ - Code loaded as plugins or dependencies. Plugins run with Haraka's process
139
+ privileges and are not a security boundary
140
+ - Upstream services and dependencies as separate projects; flaws in those
141
+ components are usually reported upstream unless Haraka's integration creates
142
+ a distinct vulnerability
143
+
144
+ ### STRIDE summary
145
+
146
+ In-scope threats are classified using [STRIDE][stride] applied at the
147
+ Haraka trust boundary shown above. A finding that lets a remote peer
148
+ cause any of the following under documented or default-safe configuration
149
+ is generally a vulnerability.
150
+
151
+ | Category | Example threats at the Haraka boundary |
152
+ | -------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
153
+ | **S**poofing | Forged HELO/EHLO or AUTH, identity bypass, unvalidated XCLIENT or proxy metadata accepted as authoritative |
154
+ | **T**ampering | SMTP smuggling, CRLF or header injection, parser inconsistencies that change how a message is delivered or interpreted |
155
+ | **R**epudiation | Remote input that erases or forges the Received: trail, or otherwise defeats logging under default configuration |
156
+ | **I**nformation disclosure | Leakage of message content, credentials, or internal state through SMTP responses, DSNs, error messages, or logs |
157
+ | **D**enial of service | Deterministic resource exhaustion or crashes triggered by remote input without operator misconfiguration |
158
+ | **E**levation of privilege | Remote code execution, or escape of documented SMTP/plugin semantics into arbitrary behavior inside the Haraka process |
159
+
160
+ Plugins execute inside the trust boundary by design, so a malicious or
161
+ vulnerable plugin can produce any STRIDE category above. Findings that
162
+ require installing such a plugin are not vulnerabilities in Haraka itself.
163
+
164
+ [stride]: https://en.wikipedia.org/wiki/STRIDE_model
165
+
166
+ ## Scope
167
+
168
+ Issues that require control of a trusted element are out of scope, including:
169
+
170
+ - Vulnerabilities requiring control of the host OS, filesystem, Node.js
171
+ runtime, local administrator account, or other trusted infrastructure
172
+ - Malicious or compromised plugins or dependencies intentionally installed or
173
+ enabled by the operator
174
+ - Pure misconfiguration of listeners, relay policy, TLS, proxying, or
175
+ outbound destinations unless Haraka's documented defaults create the
176
+ insecure state
177
+
178
+ Issues in third-party plugins maintained outside this repository should be reported to their respective maintainers.