Skip to content

Commit

Permalink
Merge branch 'master' into npm-spamassassin
Browse files Browse the repository at this point in the history
  • Loading branch information
msimerson authored May 7, 2024
2 parents eed8928 + b9b4ede commit eb8501b
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 218 deletions.
1 change: 1 addition & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- .gitignore: add config/me and config/*.pem
- auth_base: enable disabling constrain_sender at runtime #3298
- auth_base: skip constrain_sender when auth user has no domain #3319
- avg: repackaged as NPM module #3347
- bounce: repackaged plugin as NPM module #3341
- connection: check remote is connected before queue #3338
- support IPv6 when setting remote.is_private #3295
Expand Down
5 changes: 0 additions & 5 deletions config/avg.ini

This file was deleted.

35 changes: 0 additions & 35 deletions docs/plugins/avg.md

This file was deleted.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"haraka-plugin-asn": "^2.0.2",
"haraka-plugin-attachment": "^1.1.2",
"haraka-plugin-auth-ldap": "^1.1.0",
"haraka-plugin-avg": "^1.1.0",
"haraka-plugin-bounce": "1.0.2",
"haraka-plugin-dcc": "^1.0.2",
"haraka-plugin-dkim": "^1.0.3",
Expand Down Expand Up @@ -97,4 +98,4 @@
"versions": "npx dependency-version-checker check",
"versions:fix": "npx dependency-version-checker update && npm run prettier:fix"
}
}
}
161 changes: 0 additions & 161 deletions plugins/avg.js

This file was deleted.

31 changes: 15 additions & 16 deletions plugins/greylist.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

// version 0.1.4

// node builtins
const net = require('net');
const util = require('util');
const net = require('node:net');
const util = require('node:util');

// Haraka modules
const DSN = require('haraka-dsn');
Expand All @@ -16,7 +15,7 @@ const { Address } = require('address-rfc2821');
const ipaddr = require('ipaddr.js');

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
exports.register = function (next) {
exports.register = function () {
this.inherits('haraka-plugin-redis');

this.load_config();
Expand Down Expand Up @@ -207,7 +206,7 @@ exports.hook_rcpt_ok = function (next, connection, rcpt) {
ctr.add(this, {
pass : 'whitelisted'
});
return this.invoke_outcome_cb(next, true);
this.invoke_outcome_cb(next, true);
}
})
})
Expand Down Expand Up @@ -267,7 +266,7 @@ exports.check_and_update_white = function (connection, cb) {
return this.update_white_record(key, record, cb);
}

return cb(null, false);
cb(null, false);
});
}

Expand All @@ -278,7 +277,7 @@ exports.invoke_outcome_cb = function (next, is_whitelisted) {

const text = this.cfg.main.text || '';

return next(DENYSOFT, DSN.sec_unauthorized(text, '451'));
next(DENYSOFT, DSN.sec_unauthorized(text, '451'));
}

// Should we skip greylisting invokation altogether?
Expand Down Expand Up @@ -446,8 +445,8 @@ exports.craft_hostid = function (connection) {
exports.retrieve_grey = function (rcpt_key, sender_key, cb) {
const multi = this.db.multi();

multi.hgetall(rcpt_key);
multi.hgetall(sender_key);
multi.hGetAll(rcpt_key);
multi.hGetAll(sender_key);

multi.exec((err, result) => {
if (err) {
Expand Down Expand Up @@ -475,12 +474,12 @@ exports.update_grey = function (key, create, cb) {
tried : 1
};

multi.hmset(key, new_record);
multi.hmSet(key, new_record);
multi.expire(key, lifetime);
}
else {
multi.hincrby(key, 'tried', 1);
multi.hmset(key, {
multi.hIncrBy(key, 'tried', 1);
multi.hmSet(key, {
updated : ts_now
});
}
Expand Down Expand Up @@ -514,7 +513,7 @@ exports.promote_to_white = function (connection, grey_rec, cb) {
const white_key = this.craft_white_key(connection);
if (!white_key) return;

return this.db.hmset(white_key, white_rec, (err, result) => {
return this.db.hmSet(white_key, white_rec, (err, result) => {
if (err) {
this.lognotice(`DB error: ${util.inspect(err)}`);
err.what = 'db_error';
Expand All @@ -536,8 +535,8 @@ exports.update_white_record = function (key, record, cb) {
const ts_now = Math.round(Date.now() / 1000);

// { first_connect: TS, whitelisted: TS, updated: TS, lifetime: TTL, tried: Integer, tried_when_greylisted: Integer }
multi.hincrby(key, 'tried', 1);
multi.hmset(key, {
multi.hIncrBy(key, 'tried', 1);
multi.hmSet(key, {
updated : ts_now
});
multi.expire(key, record.lifetime);
Expand All @@ -556,7 +555,7 @@ exports.update_white_record = function (key, record, cb) {

exports.db_lookup = function (key, cb) {

this.db.hgetall(key, (err, result) => {
this.db.hGetAll(key, (err, result) => {
if (err) {
this.lognotice(`DB error: ${util.inspect(err)}`, key);
}
Expand Down

0 comments on commit eb8501b

Please sign in to comment.