haraka-plugin-dcc
Advanced tools
Comparing version 1.0.0 to 1.0.1
# 1.0.0 - 201_-__-__ | ||
# 1.0.1 - 2018-08-25 | ||
- refactoring | ||
- add dcc.ini with ability to specify host:port for dccifd | ||
- save connect results | ||
# 1.0.0 - 2018-08-25 | ||
- initial release |
42
index.js
@@ -15,4 +15,2 @@ // dcc client | ||
}); | ||
plugin.connCfg = { path: plugin.cfg.main.path || '/var/dcc/dccifd' }; | ||
} | ||
@@ -38,2 +36,12 @@ | ||
exports.human_result = function (code) { | ||
switch (code) { | ||
case 'A': return 'Accept'; | ||
case 'G': return 'Greylist'; | ||
case 'R': return 'Reject'; | ||
case 'S': return 'Accept some'; | ||
case 'T': return 'Temp fail'; | ||
} | ||
} | ||
exports.get_result = function (c, result) { | ||
@@ -62,2 +70,10 @@ let plugin = this; | ||
exports.human_disposition = function (code) { | ||
switch (code) { | ||
case 'A': return 'Accept'; | ||
case 'G': return 'Greylist/Discard'; | ||
case 'R': return 'Reject'; | ||
} | ||
} | ||
exports.get_disposition = function (c, disposition) { | ||
@@ -130,4 +146,5 @@ let plugin = this; | ||
let response = ''; | ||
let client; | ||
let client = net.createConnection(plugin.connCfg, () => { | ||
function onConnect () { | ||
connection.logdebug(plugin, 'connected to dcc'); | ||
@@ -138,3 +155,13 @@ | ||
}); | ||
}) | ||
} | ||
let c = plugin.cfg.dccifd; | ||
if (c.path) { | ||
client = net.createConnection(c.path, onConnect); | ||
} | ||
else { | ||
client = net.createConnection(c.port, c.host, onConnect); | ||
} | ||
client | ||
.on('error', function (err) { | ||
@@ -159,2 +186,9 @@ connection.logerror(plugin, err.message); | ||
connection.transaction.results.add(plugin, { | ||
'training': (training ? true : false), | ||
'result': plugin.human_result(result), | ||
'disposition': plugin.human_disposition(disposition), | ||
headers, | ||
}); | ||
connection.loginfo(plugin, 'training=' + (training ? 'Y' : 'N') + | ||
@@ -161,0 +195,0 @@ ` result=${result} disposition=${disposition} headers=${headers.length}`); |
{ | ||
"name": "haraka-plugin-dcc", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Haraka plugin that scans messages with DCC", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -6,3 +6,2 @@ [![Build Status][ci-img]][ci-url] | ||
[![NPM][npm-img]][npm-url] | ||
<!-- doesn't work in haraka plugins... yet. [![Code Coverage][cov-img]][cov-url]--> | ||
@@ -17,8 +16,6 @@ # haraka-plugin-dcc | ||
It requires that you install the DCC client and configure and start-up the | ||
dccifd daemon as per the documentation and expects the dccifd socket to be | ||
/var/dcc/dccifd. | ||
It requires the dccifd daemon running and expects the dccifd socket to be at | ||
/var/dcc/dccifd. To connect to a TCP host:port, edit dcc.ini. | ||
Currently it only reports results to the logs, it does not reject, greylist | ||
or do anything with the results of any kind. | ||
Currently it only reports results. | ||
@@ -28,8 +25,3 @@ You can report spam to DCC during reception by setting: | ||
## Enable Travis-CI testing | ||
- [ ] visit your [Travis-CI profile page](https://travis-ci.org/profile) and enable Continuous Integration testing on the repo | ||
- [ ] enable Code Climate. Click the _code climate_ badge and import your repo. | ||
### Configuration | ||
@@ -44,5 +36,3 @@ | ||
## USAGE | ||
<!-- leave these buried at the bottom of the document --> | ||
@@ -49,0 +39,0 @@ [ci-img]: https://travis-ci.org/haraka/haraka-plugin-dcc.svg |
@@ -34,10 +34,5 @@ | ||
it('detects set path', (done) => { | ||
assert.equal(this.plugin.cfg.main.path, '/var/dcc/dccifd', this.plugin.cfg.main); | ||
assert.equal(this.plugin.cfg.dccifd.path, '/var/dcc/dccifd', this.plugin.cfg); | ||
done(); | ||
}); | ||
it('sets plugin.connCfg', (done) => { | ||
assert.deepEqual(this.plugin.connCfg, {"path": "/var/dcc/dccifd"}); | ||
done(); | ||
}) | ||
}); | ||
@@ -58,2 +53,2 @@ | ||
}); | ||
}); | ||
}); |
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
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
12792
246
49