Haraka 3.0.5 → 3.1.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 (53) hide show
  1. package/CONTRIBUTORS.md +6 -5
  2. package/Changes.md +172 -27
  3. package/LICENSE +1 -1
  4. package/Plugins.md +3 -3
  5. package/bin/haraka +2 -1
  6. package/config/connection.ini +63 -0
  7. package/config/smtp.ini +0 -18
  8. package/connection.js +53 -63
  9. package/docs/CoreConfig.md +17 -78
  10. package/docs/HAProxy.md +10 -28
  11. package/docs/Outbound.md +8 -9
  12. package/docs/plugins/aliases.md +4 -6
  13. package/docs/plugins/block_me.md +2 -4
  14. package/docs/plugins/data.signatures.md +2 -4
  15. package/docs/plugins/max_unrecognized_commands.md +2 -4
  16. package/docs/plugins/prevent_credential_leaks.md +2 -5
  17. package/docs/plugins/process_title.md +1 -2
  18. package/docs/plugins/queue/test.md +9 -0
  19. package/docs/plugins/rcpt_to.in_host_list.md +1 -2
  20. package/docs/plugins/rcpt_to.max_count.md +2 -10
  21. package/docs/plugins/record_envelope_addresses.md +3 -6
  22. package/docs/plugins/relay.md +1 -155
  23. package/docs/plugins/reseed_rng.md +1 -2
  24. package/docs/plugins/tarpit.md +7 -10
  25. package/docs/plugins/toobusy.md +2 -4
  26. package/docs/plugins/xclient.md +1 -2
  27. package/eslint.config.mjs +27 -0
  28. package/logger.js +1 -8
  29. package/outbound/hmail.js +8 -1
  30. package/package.json +56 -53
  31. package/plugins/auth/auth_base.js +0 -1
  32. package/plugins/queue/test.js +5 -3
  33. package/server.js +0 -14
  34. package/test/connection.js +18 -7
  35. package/.eslintrc.yaml +0 -11
  36. package/config/connection_close_message +0 -1
  37. package/config/databytes +0 -1
  38. package/config/dhparams.pem +0 -8
  39. package/config/early_talker.ini +0 -11
  40. package/config/mail_from.is_resolvable.ini +0 -6
  41. package/config/max_unrecognized_commands +0 -1
  42. package/config/smtp.json +0 -17
  43. package/docs/plugins/early_talker.md +0 -22
  44. package/docs/plugins/mail_from.is_resolvable.md +0 -29
  45. package/plugins/early_talker.js +0 -155
  46. package/plugins/mail_from.is_resolvable.js +0 -132
  47. package/plugins/relay.js +0 -207
  48. package/test/plugins/early_talker.js +0 -104
  49. package/test/plugins/mail_from.is_resolvable.js +0 -35
  50. package/test/plugins/relay.js +0 -303
  51. /package/docs/{plugins → deprecated}/access.md +0 -0
  52. /package/docs/{plugins → deprecated}/backscatterer.md +0 -0
  53. /package/docs/{plugins → deprecated}/data.headers.md +0 -0
@@ -1,5 +1,4 @@
1
- record\_envelope\_addresses
2
- =========================
1
+ # record\_envelope\_addresses
3
2
 
4
3
  This plugin adds two new header lines.
5
4
 
@@ -10,14 +9,12 @@ It is useful if you need to know the exact addresses used to send an email, e.g.
10
9
  the email was sent to you as BCC or if it is a newsletter. In both cases the recipient
11
10
  address is normally not recorded in the headers.
12
11
 
13
- Caveats
14
- -------
12
+ ## Caveats
15
13
 
16
14
  If you enable this plugin you may introduce a possible information leak, i.e. disclosure
17
15
  of BCC recipients. So you never want to use this on an outgoing mail server and maybe also
18
16
  not if this server is used as a relay.
19
17
 
20
- Configuration
21
- -------------
18
+ ## Configuration
22
19
 
23
20
  This plugin has no configuration.
@@ -1,157 +1,3 @@
1
1
  # relay
2
2
 
3
- [MTAs](http://en.wikipedia.org/wiki/Mail_transfer_agent) generally only accept mail for _local_ domains they can deliver to. In Haraka, the `rcpt_to.*` plugins usually decide which domains and/or email addresses are deliverable. By default, everything else is rejected.
4
-
5
- **Relaying** is when a MTA accepts mail that is destined elsewhere. Back in the day (1980s), most MTAs permitted open relaying. Soon spammers abused our open relays (1990s) and left us with soiled mail queues. Now nearly all MTAs have relaying disabled and [MUAs](http://en.wikipedia.org/wiki/Mail_user_agent) are required to use a [MSA](http://en.wikipedia.org/wiki/Message_submission_agent) to relay. Most MTAs (including Haraka) have MSA features and can serve both purposes.
6
-
7
- This **relay** plugin provides Haraka with options for managing relay permissions.
8
-
9
- ## Authentication
10
-
11
- One way to enable relaying is authentication via the [auth plugins](http://haraka.github.io/plugins). Successful authentication enables relaying during _that_ SMTP connection. To securely offer SMTP AUTH, the [tls](http://haraka.github.io/plugins/tls) plugin and at least one auth plugin must be enabled and properly configured. When that requirement is met, the AUTH SMTP extension will be advertised to SMTP clients.
12
-
13
- % nc mail.example.com 587
14
- 220 mail.example.com ESMTP Haraka 2.4.0 ready
15
- ehlo client.example.com
16
- 250-mail.example.com Hello client.example.com [192.168.0.1], Haraka is at your service.
17
- 250-PIPELINING
18
- 250-8BITMIME
19
- 250-SIZE 10000000
20
- 250 STARTTLS
21
- quit
22
- 221 mail.example.com closing connection. Have a jolly good day.
23
-
24
- Notice that there's no AUTH advertised. We only permit authentication when the
25
- connection is secured with TLS:
26
-
27
- % openssl s_client -connect mail.example.com:587 -starttls smtp
28
- CONNECTED(00000003)
29
- <snip long SSL certificate details>
30
- ---
31
- 250 STARTTLS
32
- ehlo client.example.com
33
- 250-mail.example.com Hello client.example.com [192.168.1.1], Haraka is at your service.
34
- 250-PIPELINING
35
- 250-8BITMIME
36
- 250-SIZE 10000000
37
- 250 AUTH PLAIN LOGIN
38
- quit
39
- 221 mail.example.com closing connection. Have a jolly good day.
40
- closed
41
-
42
- To avoid port 25 restrictions, in 1998 we developed [SMTP submission](http://tools.ietf.org/html/rfc2476) on port 587. As of January 2018, [RFC 8314](https://tools.ietf.org/html/rfc8314) resurrects [SMTPS](https://en.wikipedia.org/wiki/SMTPS) on port 465 in favor of port 587 with STARTTLS. For optimal security and reliability, [MUAs](http://en.wikipedia.org/wiki/Mail_user_agent) should be configured to send mail to port 465 with TLS.
43
-
44
- ## ACL (Access Control List)
45
-
46
- ACL processing is enabled by setting acl=true in the [relay] section of
47
- relay.ini:
48
-
49
- [relay]
50
- acl=true
51
-
52
- With the Access Control List feature, relaying can be enabled for IPv4 and
53
- IPv6 networks. IP ranges listed in the ACL file are allowed to send mails
54
- without furthur checks.
55
-
56
- * `config/relay_acl_allow`
57
-
58
- Allowed IP ranges in CIDR notation, one per line.
59
-
60
- Back in the day, ISPs enabled all of their IP space to relay. That proved
61
- problematic for users who took their laptops and mobile phones elsewhere and
62
- then couldn't send mail. For end users therefore, use SMTP AUTH described
63
- above. If you reside somewhere technology evolves more slowly, you can still
64
- add IP allocations to `relay_acl_allow` like so:
65
-
66
- echo 'N.N.N.N/24' >> /path/to/haraka/config/relay_acl_allow
67
-
68
- A common use case for IP based relaying is to relay messages on behalf of
69
- another mail server. If your organization has an Exchange server, using Haraka
70
- to filter inbound messages is a great choice. You might also want to relay
71
- outbound messages via Haraka as well, so they can be DKIM signed on their way
72
- to the internet. For such a use case, you would set 'acl=true' (the default)
73
- in the [relay] section of `relay.ini` and then add the external IP address
74
- of the corporate firewall to `config/relay_acl_allow`:
75
-
76
- echo 'N.N.N.N/32' >> /path/to/haraka/config/relay_acl_allow
77
-
78
-
79
- ## Force Route / Dest[ination] Domains
80
-
81
- Force routes and Destination Domains are enabled by setting in the [relay]
82
- section of relay.ini:
83
-
84
- [relay]
85
- force_routing=false (default: false)
86
- dest_domains=false (default: false)
87
-
88
- These two features share another common config file:
89
-
90
- * `config/relay_dest_domains.ini`
91
-
92
- The format is ini and entries are within the [domains] section. The key for each entry is the domain and the value is a JSON string. Within the JSON string, the currently supported keys are:
93
-
94
- * action (Dest Domains)
95
- * nexthop (Force Route)
96
-
97
- ### Force Route
98
-
99
- Think of force route as the equivalent of the transport map in Postfix or the smtproutes file in Qmail. Rather than looking up the MX for a host, the *nexthop* value from the entry in the config file is used.
100
-
101
- The value of "nexthop": can be a hostname or an IP, optionally follow by :port.
102
-
103
- Example:
104
-
105
- [domains]
106
- test.com = { "action": "continue", "nexthop": "127.0.0.1:2525" }
107
-
108
- ### Destination Domains
109
-
110
- Allowed destination/recipient domains. The field within the JSON value used
111
- by Dest Domains is "action": and the possible values are accept, continue, or
112
- deny.
113
-
114
- * accept (accept the mail without further checks)
115
-
116
- Example:
117
-
118
- [domains]
119
- test.com = { "action": "accept" }
120
-
121
- Think of *accept* as the equivalent of qmail's *rcpthosts*, or a misplaced Haraka `rcpt_to.*` plugin. The *accept* mechanism is another way to tell Haraka that a particular domain is one we accept mail for. The difference between this and the [rcpt_to.in_host_list](http://haraka.github.io/plugins/rcpt_to.in_host_list) plugin is that this one also enables relaying.
122
-
123
- * continue (mails are subject to further checks)
124
-
125
- Example:
126
-
127
- [domains]
128
- test.com = { "action": "continue" }
129
-
130
- Because the default behavior of Dest Routes is to deny, the *continue* option provides an escape, permitting another Haraka plugin to validate the recipient. Like the *accept* option, it too enables relaying.
131
-
132
- * deny (mails are rejected)
133
-
134
- This deny option baffles me. The default behavior of Haraka is to reject emails for
135
- which a recipient validation plugin hasn't vouched. Adding it here prevents
136
- any subsequent recipient validation plugin from getting a chance. It also
137
- necessitates the continue option.
138
-
139
-
140
- ## all
141
-
142
- Relay all is enabled by setting all=true in the [relay] section of
143
- relay.ini:
144
-
145
- [relay]
146
- all=true (default: false)
147
-
148
- Relay all is useful for spamtraps to accept all mail.
149
-
150
- Do NOT use this on a real mail server, unless you really know what you are
151
- doing. If you use the all feature with anything that relays mail (such
152
- as forwarding to a real mail server, or the `deliver` plugin), your mail
153
- server is now an open relay.
154
-
155
- This is BAD. Hence the big letters. In short: DO NOT USE THIS FEATURE.
156
-
157
- It is useful for testing and spamtraps, hence its presence.
3
+ Repackaged as [haraka-plugin-relay](https://github.com/haraka/haraka-plugin-relay).
@@ -1,5 +1,4 @@
1
- reseed\_rng
2
- ==========
1
+ # reseed\_rng
3
2
 
4
3
  The V8 that ships with node 0.4.x uses an unsophisticated method of
5
4
  seeding its random number generator- it simply uses the current time
@@ -1,5 +1,4 @@
1
- tarpit
2
- ======
1
+ # tarpit
3
2
 
4
3
  This plugin is designed to introduce deliberate delays on the response
5
4
  of every hook in order to slow down a connection. It has no
@@ -10,8 +9,8 @@ that accept recipients or that return OK) but must be loaded *after*
10
9
  any plugins that wish to use it.
11
10
 
12
11
 
13
- Usage
14
- --------------
12
+ ## Usage
13
+
15
14
  To use this plugin in another plugin set:
16
15
 
17
16
  connection.notes.tarpit = <seconds to delay>;
@@ -21,8 +20,7 @@ or
21
20
  connection.transaction.notes.tarpit = <seconds to delay>;
22
21
 
23
22
 
24
- Configuration
25
- --------------
23
+ ## Configuration
26
24
 
27
25
  The configuration file for tarpit is config/tarpit.ini.
28
26
 
@@ -34,8 +32,7 @@ The configuration file for tarpit is config/tarpit.ini.
34
32
  hooks\_to\_delay=connect,helo,ehlo,mail,rcpt,data,data\_post,queue,unrecognized\_command,vrfy,noop,rset,quit
35
33
 
36
34
 
37
- Plugin Timeout
38
- --------------
35
+ ## Plugin Timeout
39
36
 
40
37
  config/tarpit.timeout (Default: 0)
41
38
 
@@ -51,7 +48,7 @@ The solution is to set the contents of config/tarpit.timeout to zero or
51
48
  **seconds to delay** + 1.
52
49
 
53
50
 
54
- Logging
55
- --------------
51
+ ## Logging
52
+
56
53
  When tarpitting a command it will log 'tarpitting response for Ns' to
57
54
  the INFO facility where N is the number of seconds.
@@ -1,5 +1,4 @@
1
- toobusy
2
- =======
1
+ # toobusy
3
2
 
4
3
  This plugin will stop Haraka accepting new connections when the event loop
5
4
  latency is too high.
@@ -12,8 +11,7 @@ To use this plugin you have to install the 'toobusy-js' module by running
12
11
  This plugin should be listed at the top of your config/plugins file so that
13
12
  it runs before any other plugin that hooks lookup\_rdns.
14
13
 
15
- Configuration
16
- -------------
14
+ ## Configuration
17
15
 
18
16
  If you wish to override the default maxLag value of 70ms then add the desired
19
17
  value to config/toobusy.maxlag. This can be set and changed at runtime and
@@ -1,5 +1,4 @@
1
- xclient
2
- =======
1
+ # xclient
3
2
 
4
3
  Implements the [XCLIENT](http://www.postfix.org/XCLIENT_README.html) protocol.
5
4
 
@@ -0,0 +1,27 @@
1
+ import globals from "globals";
2
+ import path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import js from "@eslint/js";
5
+ import { FlatCompat } from "@eslint/eslintrc";
6
+
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = path.dirname(__filename);
9
+ const compat = new FlatCompat({
10
+ baseDirectory: __dirname,
11
+ recommendedConfig: js.configs.recommended,
12
+ allConfig: js.configs.all
13
+ });
14
+
15
+ export default [...compat.extends("@haraka"), {
16
+ languageOptions: {
17
+ globals: {
18
+ ...globals.node,
19
+ },
20
+ },
21
+
22
+ rules: {
23
+ "prefer-template": "warn",
24
+ "no-unneeded-ternary": 1,
25
+ "no-unused-vars": 0,
26
+ },
27
+ }];
package/logger.js CHANGED
@@ -116,16 +116,9 @@ logger.dump_logs = cb => {
116
116
  return true;
117
117
  }
118
118
 
119
- if (!util.isFunction) {
120
- util.isFunction = functionToCheck => {
121
- const getType = {};
122
- return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
123
- };
124
- }
125
-
126
119
  logger.dump_and_exit = function (code) {
127
120
  this.dump_logs(() => {
128
- if (util.isFunction(code)) return code();
121
+ if (typeof code === 'function') return code();
129
122
  process.exit(code);
130
123
  });
131
124
  }
package/outbound/hmail.js CHANGED
@@ -3,6 +3,7 @@
3
3
  const events = require('node:events');
4
4
  const fs = require('node:fs');
5
5
  const dns = require('node:dns');
6
+ const net = require('node:net');
6
7
  const path = require('node:path');
7
8
 
8
9
  const { Address } = require('address-rfc2821');
@@ -596,7 +597,13 @@ class HMailItem extends events.EventEmitter {
596
597
  processing_mail = false;
597
598
  if (success) {
598
599
  const reason = response.join(' ');
599
- self.delivered(host, port, (mx.using_lmtp ? 'LMTP' : 'SMTP'), mx.exchange,
600
+
601
+ let hostname = mx.exchange
602
+ if (net.isIP(hostname) && mx.from_dns && !net.isIP(mx.from_dns)) {
603
+ hostname = mx.from_dns
604
+ }
605
+
606
+ self.delivered(host, port, (mx.using_lmtp ? 'LMTP' : 'SMTP'), hostname,
600
607
  reason, ok_recips, fail_recips, bounce_recips, secured, authenticated);
601
608
  }
602
609
  else {
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "server",
10
10
  "email"
11
11
  ],
12
- "version": "3.0.5",
12
+ "version": "3.1.0",
13
13
  "homepage": "http://haraka.github.io",
14
14
  "repository": {
15
15
  "type": "git",
@@ -20,71 +20,74 @@
20
20
  "node": ">=18"
21
21
  },
22
22
  "dependencies": {
23
- "address-rfc2821": "^2.1.2",
24
- "address-rfc2822": "^2.2.2",
23
+ "address-rfc2821": "^2.1.3",
24
+ "address-rfc2822": "^2.2.3",
25
25
  "async": "^3.2.6",
26
26
  "daemon": "~1.1.0",
27
- "haraka-config": "^1.4.0",
27
+ "haraka-config": "^1.4.2",
28
28
  "haraka-constants": "^1.0.7",
29
29
  "haraka-dsn": "^1.1.0",
30
- "haraka-email-message": "^1.2.4",
31
- "haraka-message-stream": "^1.2.2",
32
- "haraka-net-utils": "^1.7.0",
33
- "haraka-notes": "^1.1.0",
34
- "haraka-plugin-redis": "^2.0.7",
35
- "haraka-results": "^2.2.4",
36
- "haraka-tld": "^1.2.2",
37
- "haraka-utils": "^1.1.3",
30
+ "haraka-email-message": "^1.2.5",
31
+ "haraka-message-stream": "^1.2.3",
32
+ "haraka-net-utils": "^1.7.2",
33
+ "haraka-notes": "^1.1.1",
34
+ "haraka-plugin-redis": "^2.0.9",
35
+ "haraka-results": "^2.2.5",
36
+ "haraka-tld": "^1.2.3",
37
+ "haraka-utils": "^1.1.4",
38
38
  "ipaddr.js": "~2.2.0",
39
- "node-gyp": "^10.2.0",
40
- "nopt": "^8.0.0",
39
+ "node-gyp": "^11.1.0",
40
+ "nopt": "^8.1.0",
41
41
  "npid": "~0.4.0",
42
42
  "redis": "~4.7.0",
43
- "semver": "^7.6.3",
43
+ "semver": "^7.7.1",
44
44
  "sockaddr": "^1.0.1",
45
45
  "sprintf-js": "~1.1.3"
46
46
  },
47
47
  "optionalDependencies": {
48
- "haraka-plugin-access": "^1.1.6",
49
- "haraka-plugin-aliases": "^1.0.2",
50
- "haraka-plugin-asn": "^2.0.3",
51
- "haraka-plugin-attachment": "^1.1.2",
48
+ "haraka-plugin-access": "^1.1.10",
49
+ "haraka-plugin-aliases": "^1.0.3",
50
+ "haraka-plugin-asn": "^2.0.5",
51
+ "haraka-plugin-attachment": "^1.1.4",
52
52
  "haraka-plugin-avg": "^1.1.0",
53
- "haraka-plugin-bounce": "1.0.2",
54
- "haraka-plugin-clamd": "1.0.1",
55
- "haraka-plugin-dcc": "^1.0.2",
56
- "haraka-plugin-dkim": "^1.0.7",
57
- "haraka-plugin-dns-list": "^1.2.1",
58
- "haraka-plugin-elasticsearch": "^8.0.3",
59
- "haraka-plugin-esets": "^1.0.0",
60
- "haraka-plugin-fcrdns": "^1.1.0",
61
- "haraka-plugin-geoip": "^1.1.0",
53
+ "haraka-plugin-bounce": "1.0.4",
54
+ "haraka-plugin-clamd": "1.0.2",
55
+ "haraka-plugin-dcc": "^1.0.3",
56
+ "haraka-plugin-dkim": "^1.0.11",
57
+ "haraka-plugin-dns-list": "^1.2.3",
58
+ "haraka-plugin-early_talker": "^1.0.2",
59
+ "haraka-plugin-elasticsearch": "^8.1.2",
60
+ "haraka-plugin-esets": "^1.0.1",
61
+ "haraka-plugin-fcrdns": "^1.1.1",
62
+ "haraka-plugin-geoip": "^1.1.1",
62
63
  "haraka-plugin-graph": "^1.0.5",
63
- "haraka-plugin-greylist": "^1.0.0",
64
- "haraka-plugin-headers": "^1.0.4",
65
- "haraka-plugin-helo.checks": "^1.0.0",
66
- "haraka-plugin-karma": "^2.1.5",
67
- "haraka-plugin-known-senders": "^1.1.0",
68
- "haraka-plugin-limit": "^1.2.5",
69
- "haraka-plugin-messagesniffer": "^1.0.0",
70
- "haraka-plugin-p0f": "^1.0.9",
71
- "haraka-plugin-qmail-deliverable": "^1.2.3",
72
- "haraka-plugin-recipient-routes": "^1.2.0",
73
- "haraka-plugin-rspamd": "^1.3.1",
74
- "haraka-plugin-spamassassin": "^1.0.0",
75
- "haraka-plugin-spf": "1.2.7",
76
- "haraka-plugin-syslog": "^1.0.6",
77
- "haraka-plugin-uribl": "^1.0.8",
78
- "haraka-plugin-watch": "^2.0.4",
79
- "ocsp": "~1.2.0",
64
+ "haraka-plugin-greylist": "^1.0.1",
65
+ "haraka-plugin-headers": "^1.0.6",
66
+ "haraka-plugin-helo.checks": "^1.0.3",
67
+ "haraka-plugin-karma": "^2.1.7",
68
+ "haraka-plugin-known-senders": "^1.1.2",
69
+ "haraka-plugin-limit": "^1.2.6",
70
+ "haraka-plugin-mail_from.is_resolvable": "^1.0.3",
71
+ "haraka-plugin-messagesniffer": "^1.0.1",
72
+ "haraka-plugin-p0f": "^1.0.11",
73
+ "haraka-plugin-qmail-deliverable": "^1.2.5",
74
+ "haraka-plugin-recipient-routes": "^1.2.2",
75
+ "haraka-plugin-relay": "^1.0.1",
76
+ "haraka-plugin-rspamd": "^1.3.2",
77
+ "haraka-plugin-spamassassin": "^1.0.3",
78
+ "haraka-plugin-spf": "1.2.9",
79
+ "haraka-plugin-syslog": "^1.0.7",
80
+ "haraka-plugin-uribl": "^1.0.10",
81
+ "haraka-plugin-watch": "^2.0.8",
82
+ "@techteamer/ocsp": "^1.0.1",
80
83
  "tmp": "~0.2.3"
81
84
  },
82
85
  "devDependencies": {
83
- "@haraka/eslint-config": "^1.1.5",
84
- "haraka-test-fixtures": "^1.3.8",
85
- "mocha": "^10.7.3",
86
+ "@haraka/eslint-config": "^2.0.2",
87
+ "haraka-test-fixtures": "^1.3.9",
88
+ "mocha": "^11.1.0",
86
89
  "mock-require": "^3.0.3",
87
- "nodemailer": "^6.9.15"
90
+ "nodemailer": "^6.10.0"
88
91
  },
89
92
  "bugs": {
90
93
  "mail": "haraka.mail@gmail.com",
@@ -96,12 +99,12 @@
96
99
  },
97
100
  "scripts": {
98
101
  "format:NYET": "npm run prettier:fix && npm run lint:fix",
99
- "lint": "npx eslint@^8 *.js outbound plugins plugins/*/*.js test test/*/*.js test/*/*/*.js bin/haraka",
100
- "lint:fix": "npx eslint@^8 --fix *.js outbound plugins plugins/*/*.js test test/*/*.js test/*/*/*.js bin/haraka",
102
+ "lint": "npx eslint *.js outbound plugins plugins/*/*.js test test/*/*.js test/*/*/*.js bin/haraka",
103
+ "lint:fix": "npx eslint --fix *.js outbound plugins plugins/*/*.js test test/*/*.js test/*/*/*.js bin/haraka",
101
104
  "prettier": "npx prettier . --check",
102
105
  "prettier:fix": "npx prettier . --write --log-level=warn",
103
106
  "test": "npx mocha --exit --timeout=4000 test test/outbound test/plugins/auth test/plugins/queue test/plugins",
104
107
  "versions": "npx dependency-version-checker check",
105
- "versions:fix": "npx dependency-version-checker update && npm run prettier:fix"
108
+ "versions:fix": "npx dependency-version-checker update"
106
109
  }
107
- }
110
+ }
@@ -105,7 +105,6 @@ exports.check_user = function (next, connection, credentials, method) {
105
105
  if (valid) {
106
106
  connection.relaying = true;
107
107
  connection.results.add({name:'relay'}, {pass: plugin.name});
108
- connection.results.add(plugin, {pass: method});
109
108
 
110
109
  connection.results.add({name:'auth'}, {
111
110
  pass: plugin.name,
@@ -4,10 +4,12 @@ const os = require('node:os');
4
4
  const tempDir = os.tmpdir();
5
5
 
6
6
  exports.hook_queue = function (next, connection) {
7
- if (!connection?.transaction) return next();
7
+ const txn = connection?.transaction;
8
+ if (!txn) return next();
8
9
 
9
- const ws = fs.createWriteStream(`${tempDir}/mail.eml`);
10
- connection.logdebug(this, `Saving to ${tempDir}/mail.eml`);
10
+ const file_path = `${tempDir}/mail_${txn.uuid}.eml`
11
+ const ws = fs.createWriteStream(file_path);
12
+ connection.logdebug(this, `Saving to ${file_path}`);
11
13
  ws.once('close', () => next(OK));
12
14
  connection.transaction.message_stream.pipe(ws);
13
15
  }
package/server.js CHANGED
@@ -32,12 +32,7 @@ Server.load_smtp_ini = () => {
32
32
  Server.cfg = Server.config.get('smtp.ini', {
33
33
  booleans: [
34
34
  '-main.daemonize',
35
- '-main.strict_rfc1869',
36
- '+main.smtputf8',
37
35
  '-main.graceful_shutdown',
38
- '+headers.add_received',
39
- '+headers.show_version',
40
- '+headers.clean_auth_results',
41
36
  ],
42
37
  }, () => {
43
38
  Server.load_smtp_ini();
@@ -56,15 +51,6 @@ Server.load_smtp_ini = () => {
56
51
  nodes: 1,
57
52
  };
58
53
 
59
- Server.cfg.headers.max_received = parseInt(Server.cfg.headers.max_received) || parseInt(Server.config.get('max_received_count')) || 100;
60
- Server.cfg.headers.max_lines = parseInt(Server.cfg.headers.max_lines) || parseInt(Server.config.get('max_header_lines')) || 1000;
61
-
62
- const strict_ext = Server.config.get('strict_rfc1869');
63
- if (Server.cfg.main.strict_rfc1869 === false && strict_ext) {
64
- Server.logwarn(`legacy config config/strict_rfc1869 is overriding smtp.ini`)
65
- Server.cfg.main.strict_rfc1869 = strict_ext;
66
- }
67
-
68
54
  for (const key in defaults) {
69
55
  if (Server.cfg.main[key] !== undefined) continue;
70
56
  Server.cfg.main[key] = defaults[key];
@@ -1,5 +1,5 @@
1
1
 
2
- const assert = require('node:assert')
2
+ const assert = require('node:assert/strict')
3
3
 
4
4
  const constants = require('haraka-constants');
5
5
  const DSN = require('haraka-dsn')
@@ -7,7 +7,7 @@ const DSN = require('haraka-dsn')
7
7
  const connection = require('../connection');
8
8
  const Server = require('../server');
9
9
 
10
- // huge hack here, but plugin tests need constants
10
+ // hack alert, but plugin tests need constants
11
11
  constants.import(global);
12
12
 
13
13
  const _set_up = (done) => {
@@ -229,16 +229,27 @@ describe('connection', () => {
229
229
 
230
230
  it('sets and gets', () => {
231
231
  assert.equal(this.connection.relaying, false);
232
- assert.ok(this.connection.relaying = 'alligators');
232
+
233
+ this.connection.set('relaying', 'crocodiles');
234
+ assert.equal(this.connection.get('relaying'), 'crocodiles');
235
+ assert.equal(this.connection.relaying, 'crocodiles');
236
+ assert.equal(this.connection._relaying, 'crocodiles');
237
+
238
+ this.connection.relaying = 'alligators';
239
+ assert.equal(this.connection.get('relaying'), 'alligators');
233
240
  assert.equal(this.connection.relaying, 'alligators');
241
+ assert.equal(this.connection._relaying, 'alligators');
234
242
  })
235
243
 
236
244
  it('sets and gets in a transaction', () => {
237
245
  assert.equal(this.connection.relaying, false);
238
- this.connection.transaction = {};
239
- assert.ok(this.connection.relaying = 'crocodiles');
240
- assert.equal(this.connection.transaction._relaying, 'crocodiles');
241
- assert.equal(this.connection.relaying, 'crocodiles');
246
+
247
+ this.connection.transaction = {}
248
+ this.connection.set('relaying', 'txn-only'); // sets txn.relaying
249
+
250
+ assert.equal(this.connection.get('relaying'), 'txn-only')
251
+ assert.equal(this.connection._relaying, false);
252
+ assert.equal(this.connection.transaction._relaying, 'txn-only');
242
253
  })
243
254
  })
244
255
 
package/.eslintrc.yaml DELETED
@@ -1,11 +0,0 @@
1
- env:
2
- es6: true
3
- node: true
4
- es2022: true
5
-
6
- extends: ['@haraka']
7
-
8
- rules:
9
- prefer-template: 'warn'
10
- no-unneeded-ternary: 1
11
- no-unused-vars: 0
@@ -1 +0,0 @@
1
- closing connection. Have a jolly good day.
package/config/databytes DELETED
@@ -1 +0,0 @@
1
- 26214400
@@ -1,8 +0,0 @@
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,11 +0,0 @@
1
-
2
- ; delay in seconds
3
- pause=5
4
-
5
- ; terminate the connection? (default: true)
6
- ; reject=false
7
-
8
- ; Whitelist of client IP ranges to skip delay on
9
- [ip_whitelist]
10
- ::1
11
- 127.0.0.1
@@ -1,6 +0,0 @@
1
- timeout=29
2
- allow_mx_ip=false
3
- re_bogus_ip=^(?:0\.0\.0\.0|255\.255\.255\.255|127\.)
4
-
5
- [reject]
6
- no_mx=true
@@ -1 +0,0 @@
1
- 10
package/config/smtp.json DELETED
@@ -1,17 +0,0 @@
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
- }