mailauth 4.2.0 → 4.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.
- package/README.md +8 -6
- package/lib/mta-sts.js +23 -5
- package/licenses.txt +3 -3
- package/man/mailauth.1 +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -300,13 +300,13 @@ DMARC is verified as part of the authentication process and even as the `dmarc`
|
|
|
300
300
|
|
|
301
301
|
### Helpers
|
|
302
302
|
|
|
303
|
-
#### getDmarcRecord
|
|
303
|
+
#### getDmarcRecord(domain [,resolver])
|
|
304
304
|
|
|
305
|
-
Returns parsed DMARC DNS record for a domain
|
|
305
|
+
Returns parsed DMARC DNS record for a domain or a subdomain or `false` is no record exists.
|
|
306
306
|
|
|
307
307
|
```
|
|
308
308
|
const getDmarcRecord = require('mailauth/lib/dmarc/get-dmarc-record');
|
|
309
|
-
const dmarcRecord = getDmarcRecord("ethereal.email");
|
|
309
|
+
const dmarcRecord = await getDmarcRecord("ethereal.email");
|
|
310
310
|
console.log(dmarcRecord);
|
|
311
311
|
```
|
|
312
312
|
|
|
@@ -327,6 +327,8 @@ console.log(dmarcRecord);
|
|
|
327
327
|
|
|
328
328
|
`isOrgRecord` is `true` for sudomains, where organizational domain's DMARC policy applies, so use the `sp`, not `p` policy.
|
|
329
329
|
|
|
330
|
+
Optionally set `resolver` argument with custom resolver (uses `dns.resolve` by default).
|
|
331
|
+
|
|
330
332
|
## BIMI
|
|
331
333
|
|
|
332
334
|
Brand Indicators for Message Identification (BIMI) support is based on [draft-blank-ietf-bimi-01](https://tools.ietf.org/html/draft-blank-ietf-bimi-01).
|
|
@@ -382,7 +384,7 @@ if (policy.mode === 'enforce') {
|
|
|
382
384
|
// must use TLS
|
|
383
385
|
}
|
|
384
386
|
|
|
385
|
-
if (policy.mx && !policyMatch) {
|
|
387
|
+
if (policy.mx && !policyMatch.valid) {
|
|
386
388
|
// can't connect, unlisted MX
|
|
387
389
|
}
|
|
388
390
|
```
|
|
@@ -419,7 +421,7 @@ The function returns an object with the following properties:
|
|
|
419
421
|
Check if a resolved MX hostname is valid by MTA-STS policy or not.
|
|
420
422
|
|
|
421
423
|
```
|
|
422
|
-
validateMx(mx, policy) ->
|
|
424
|
+
validateMx(mx, policy) -> Object
|
|
423
425
|
```
|
|
424
426
|
|
|
425
427
|
Where
|
|
@@ -427,7 +429,7 @@ Where
|
|
|
427
429
|
- **mx** is the resolved MX hostname (eg. "gmail-smtp-in.l.google.com")
|
|
428
430
|
- **policy** is the policy object returned by `getPolicy()`
|
|
429
431
|
|
|
430
|
-
The function returns
|
|
432
|
+
The function returns an object. If `{valid}` is `true`, then MX hostname is allowed to be used.
|
|
431
433
|
|
|
432
434
|
## Testing
|
|
433
435
|
|
package/lib/mta-sts.js
CHANGED
|
@@ -139,9 +139,13 @@ const parsePolicy = file => {
|
|
|
139
139
|
*/
|
|
140
140
|
const validateMx = (mx, policy) => {
|
|
141
141
|
policy = policy || { mode: 'none' };
|
|
142
|
-
if (policy.mode === 'none' || policy.mode
|
|
142
|
+
if (policy.mode === 'none' || !policy.mode) {
|
|
143
143
|
// nothing to check for
|
|
144
|
-
return
|
|
144
|
+
return {
|
|
145
|
+
valid: true,
|
|
146
|
+
mode: policy.mode || 'none',
|
|
147
|
+
testing: policy.mode === 'testing'
|
|
148
|
+
};
|
|
145
149
|
}
|
|
146
150
|
|
|
147
151
|
mx = (mx || '').toString().trim().toLowerCase();
|
|
@@ -161,15 +165,29 @@ const validateMx = (mx, policy) => {
|
|
|
161
165
|
// remove wildcard
|
|
162
166
|
allowed = allowed.substr(1);
|
|
163
167
|
if (mx.substr(-allowed.length) === allowed) {
|
|
164
|
-
return
|
|
168
|
+
return {
|
|
169
|
+
valid: true,
|
|
170
|
+
mode: policy.mode || 'none',
|
|
171
|
+
match: allowed,
|
|
172
|
+
testing: policy.mode === 'testing'
|
|
173
|
+
};
|
|
165
174
|
}
|
|
166
175
|
} else if (allowed === mx) {
|
|
167
|
-
return
|
|
176
|
+
return {
|
|
177
|
+
valid: true,
|
|
178
|
+
mode: policy.mode || 'none',
|
|
179
|
+
match: allowed,
|
|
180
|
+
testing: policy.mode === 'testing'
|
|
181
|
+
};
|
|
168
182
|
}
|
|
169
183
|
}
|
|
170
184
|
|
|
171
185
|
// no match found
|
|
172
|
-
return
|
|
186
|
+
return {
|
|
187
|
+
valid: false,
|
|
188
|
+
mode: policy.mode || 'none',
|
|
189
|
+
testing: policy.mode === 'testing'
|
|
190
|
+
};
|
|
173
191
|
};
|
|
174
192
|
|
|
175
193
|
/**
|
package/licenses.txt
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
name license type link installed version author
|
|
2
2
|
---- ------------ ---- ----------------- ------
|
|
3
3
|
@postalsys/vmc MIT https://registry.npmjs.org/@postalsys/vmc/-/vmc-1.0.6.tgz 1.0.6 Postal Systems OÜ
|
|
4
|
-
fast-xml-parser MIT git+https://github.com/NaturalIntelligence/fast-xml-parser.git 4.
|
|
4
|
+
fast-xml-parser MIT git+https://github.com/NaturalIntelligence/fast-xml-parser.git 4.1.1 Amit Gupta (https://amitkumargupta.work/)
|
|
5
5
|
ipaddr.js MIT git://github.com/whitequark/ipaddr.js.git 2.0.1 whitequark <whitequark@whitequark.org>
|
|
6
6
|
joi BSD-3-Clause git://github.com/hapijs/joi.git 17.7.0 n/a
|
|
7
|
-
libmime MIT git://github.com/andris9/libmime.git 5.2.
|
|
8
|
-
nodemailer MIT git+https://github.com/nodemailer/nodemailer.git 6.9.
|
|
7
|
+
libmime MIT git://github.com/andris9/libmime.git 5.2.1 Andris Reinman <andris@kreata.ee>
|
|
8
|
+
nodemailer MIT git+https://github.com/nodemailer/nodemailer.git 6.9.1 Andris Reinman
|
|
9
9
|
psl MIT git+ssh://git@github.com/lupomontero/psl.git 1.9.0 Lupo Montero <lupomontero@gmail.com> (https://lupomontero.com/)
|
|
10
10
|
punycode MIT git+https://github.com/mathiasbynens/punycode.js.git 2.3.0 Mathias Bynens https://mathiasbynens.be/
|
|
11
11
|
yargs MIT git+https://github.com/yargs/yargs.git 17.6.2 n/a
|
package/man/mailauth.1
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mailauth",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"description": "Email authentication library for Node.js",
|
|
5
5
|
"main": "lib/mailauth.js",
|
|
6
6
|
"scripts": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"homepage": "https://github.com/postalsys/mailauth",
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"chai": "4.3.7",
|
|
36
|
-
"eslint": "8.
|
|
36
|
+
"eslint": "8.35.0",
|
|
37
37
|
"eslint-config-nodemailer": "1.2.0",
|
|
38
38
|
"eslint-config-prettier": "8.6.0",
|
|
39
39
|
"js-yaml": "4.1.0",
|
|
@@ -46,14 +46,14 @@
|
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@postalsys/vmc": "1.0.6",
|
|
49
|
-
"fast-xml-parser": "4.1.
|
|
49
|
+
"fast-xml-parser": "4.1.3",
|
|
50
50
|
"ipaddr.js": "2.0.1",
|
|
51
|
-
"joi": "17.
|
|
51
|
+
"joi": "17.8.3",
|
|
52
52
|
"libmime": "5.2.1",
|
|
53
53
|
"nodemailer": "6.9.1",
|
|
54
54
|
"psl": "1.9.0",
|
|
55
55
|
"punycode": "2.3.0",
|
|
56
|
-
"yargs": "17.
|
|
56
|
+
"yargs": "17.7.1"
|
|
57
57
|
},
|
|
58
58
|
"engines": {
|
|
59
59
|
"node": ">=16.0.0"
|