haraka-plugin-rspamd
Advanced tools
Comparing version 1.1.2 to 1.1.3
@@ -0,1 +1,6 @@ | ||
## 1.1.3 - 2018-12-NN | ||
- add check.relay option | ||
## 1.1.2 - 2018-11-03 | ||
@@ -2,0 +7,0 @@ |
24
index.js
@@ -22,2 +22,3 @@ 'use strict'; | ||
'-check.local_ip', | ||
'-check.relay', | ||
'+reject.spam', | ||
@@ -263,21 +264,30 @@ '-reject.authenticated', | ||
let result = true; // default | ||
if (plugin.cfg.check.authenticated == false && connection.notes.auth_user) { | ||
connection.transaction.results.add(plugin, { skip: 'authed'}); | ||
return false; | ||
result = false; | ||
} | ||
// necessary because local IPs are included in private IPs | ||
if (plugin.cfg.check.local_ip == true && connection.remote.is_local) return true; | ||
if (plugin.cfg.check.relay == false && connection.relaying) { | ||
connection.transaction.results.add(plugin, { skip: 'relay'}); | ||
result = false; | ||
} | ||
if (plugin.cfg.check.local_ip == false && connection.remote.is_local) { | ||
connection.transaction.results.add(plugin, { skip: 'local_ip'}); | ||
return false; | ||
result = false; | ||
} | ||
if (plugin.cfg.check.private_ip == false && connection.remote.is_private) { | ||
connection.transaction.results.add(plugin, { skip: 'private_ip'}); | ||
return false; | ||
if (plugin.cfg.check.local_ip == true && connection.remote.is_local) { | ||
// local IPs are included in private IPs | ||
} | ||
else { | ||
connection.transaction.results.add(plugin, { skip: 'private_ip'}); | ||
result = false; | ||
} | ||
} | ||
return true; | ||
return result; | ||
} | ||
@@ -284,0 +294,0 @@ |
{ | ||
"name": "haraka-plugin-rspamd", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "Haraka plugin for rspamd", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -64,2 +64,8 @@ [![Build Status][ci-img]][ci-url] | ||
- check.relay | ||
Default: false | ||
If true, messages from relay clients will be scanned by Rspamd. | ||
- check.private\_ip | ||
@@ -66,0 +72,0 @@ |
@@ -185,2 +185,26 @@ 'use strict'; | ||
}, | ||
'skips relaying': function (test) { | ||
this.connection.relaying = true; | ||
this.plugin.cfg.check.relay = false; | ||
test.expect(1); | ||
test.equal(this.plugin.should_check(this.connection), false); | ||
test.done(); | ||
}, | ||
'checks not relaying': function (test) { | ||
this.connection.relaying = false; | ||
this.plugin.cfg.check.relay = false; | ||
test.expect(1); | ||
test.equal(this.plugin.should_check(this.connection), true); | ||
test.done(); | ||
}, | ||
'checks relaying when enabled': function (test) { | ||
this.connection.relaying = true; | ||
this.plugin.cfg.check.relay = true; | ||
test.expect(1); | ||
test.equal(this.plugin.should_check(this.connection), true); | ||
test.done(); | ||
}, | ||
'checks local IP': function (test) { | ||
@@ -187,0 +211,0 @@ this.connection.remote.is_local = true; |
Sorry, the diff of this file is not supported yet
30940
633
183