adjust should_check logic, extend to spamassassin#2564
adjust should_check logic, extend to spamassassin#2564KingNoosh merged 4 commits intoharaka:masterfrom
Conversation
- shows if a connection was skipped for more than one reason related to haraka#2551
7522970 to
716e9fe
Compare
|
@analogic , do you have an opinion on the switch to this "flow through" style of logic for exports.should_check = function (connection) {
const plugin = this;
let result = true; // default
if (plugin.cfg.check.authenticated == false && connection.notes.auth_user) {
connection.transaction.results.add(plugin, { skip: 'authed'});
result = false;
}
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'});
result = false;
}
if (plugin.cfg.check.private_ip == false && connection.remote.is_private) {
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 result;
} |
|
LGTM! To plugin.js abstraction - In future It would be nice to have some generic flag which would control skipping from outside. Like another plugin deciding by IP/RCPT/FROM/AUTH/user profile. (I like what https://github.com/creamfinance/haraka-plugin-plugin_manager can do but I don't like mixing yaml and js logic) |
Exactly. In briefly thinking about it, what I see is that there's already a half dozen implementations of varying degrees of skipping / whitelisting. Before assembling this PR I reviewed them but none of them are a one sized fits all. The conditions under which you might want to whitelist a connection from early_talker or greylisting are considerably different than for rspamd or clamd. But this should_check logic does cover the majority of cases for most plugins. In another evolution or two maybe we'll have something that's general purpose enough to work everywhere. |
I need a mechanism to skip spamassassin checks for IP based relaying clients. Haraka already has similar mechanisms for this in rspamd and clamd via their
checkconfig settings and theshould_check()function. This PR (and rspamd #13) extendsshould_check()to support relay clients.Aside: auth clients are relaying clients, but relay might also be set by other plugins, such as IP lists in the
relayplugin.Changes proposed in this pull request:
should_check()to spamassassinshould_check()related to #2551 (skip early_talker if +karma)
related to haraka/haraka-plugin-rspamd#13
related to #2533 (add clamd skip options)
It might be useful to abstract
should_check()into plugin.js and have a "standard" set of config settings that each plugin can skip processing for. At present, we have:The
early_talkerplugin also has karma as a criteria, which could be useful elsewhere as well.Checklist: