haraka-net-utils
Advanced tools
Comparing version 1.0.2 to 1.0.3
23
index.js
@@ -12,4 +12,6 @@ 'use strict'; | ||
var tlds = require('haraka-tld'); | ||
var config = require('haraka-config'); | ||
// export config, so config base path can be overloaded by tests | ||
exports.config = require('haraka-config'); | ||
exports.long_to_ip = function (n) { | ||
@@ -205,3 +207,3 @@ var d = n%256; | ||
// manual config override, for the cases where we can't figure it out | ||
var smtpIni = config.get('smtp.ini').main; | ||
var smtpIni = exports.config.get('smtp.ini').main; | ||
if (smtpIni.public_ip) { | ||
@@ -364,1 +366,18 @@ nu.public_ip = smtpIni.public_ip; | ||
} | ||
exports.load_tls_ini = function (cb) { | ||
var cfg = exports.config.get('tls.ini', { | ||
booleans: [ | ||
'+main.requestCert', | ||
'-main.rejectUnauthorized', | ||
'-main.honorCipherOrder', | ||
'-redis.disable_for_failed_hosts', | ||
] | ||
}, cb); | ||
if (!cfg.no_tls_hosts) { | ||
cfg.no_tls_hosts = {}; | ||
} | ||
return cfg; | ||
} |
{ | ||
"name": "haraka-net-utils", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "haraka network utilities", | ||
@@ -9,3 +9,3 @@ "main": "index.js", | ||
"lint": "./node_modules/.bin/eslint *.js test", | ||
"coverage": "./node_modules/.bin/istanbul cover ./run_tests" | ||
"cover": "./node_modules/.bin/istanbul cover ./run_tests" | ||
}, | ||
@@ -35,3 +35,3 @@ "repository": { | ||
"haraka-config": "^1.0.3", | ||
"haraka-tld": "^1.0.9", | ||
"haraka-tld": "*", | ||
"ipaddr.js": "^1.2.0", | ||
@@ -38,0 +38,0 @@ "sprintf-js": "^1.0.3" |
var net = require('net'); | ||
var path = require('path'); | ||
@@ -956,1 +957,42 @@ require('haraka-config').watch_files = false; | ||
exports.load_tls_ini = { | ||
'loads a tls.ini config file (defaults)': function (test) { | ||
test.expect(1); | ||
test.deepEqual(net_utils.load_tls_ini(), | ||
{ main: | ||
{ requestCert: true, | ||
rejectUnauthorized: false, | ||
honorCipherOrder: false | ||
}, | ||
redis: { disable_for_failed_hosts: false }, | ||
no_tls_hosts: {} | ||
}); | ||
test.done(); | ||
}, | ||
'loads a tls.ini config file from test dir': function (test) { | ||
test.expect(1); | ||
net_utils.config = net_utils.config.module_config(path.resolve('test')); | ||
test.deepEqual(net_utils.load_tls_ini(), | ||
{ main: | ||
{ requestCert: true, | ||
rejectUnauthorized: true, | ||
honorCipherOrder: true, | ||
key: 'tls_key.pem', | ||
cert: 'tls_cert.pem', | ||
dhparam: 'dhparams.pem', | ||
ciphers: 'ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384' }, | ||
redis: { disable_for_failed_hosts: false }, | ||
no_tls_hosts: {}, | ||
outbound: | ||
{ key: 'tls_key.pem', | ||
cert: 'tls_cert.pem', | ||
dhparam: 'dhparams.pem', | ||
ciphers: 'ECDHE-RSA-AES256-GCM-SHA384', | ||
rejectUnauthorized: 'false', | ||
requestCert: 'false', | ||
honorCipherOrder: 'false' } | ||
} | ||
); | ||
test.done(); | ||
}, | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
56523
12
1315
1
Updatedharaka-tld@*