Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
haraka-plugin-redis
Advanced tools
Connects to a redis instance. By default it stores a redis
connection handle at server.notes.redis
. See below to get a custom DB handle
attached to another database.
The redis.ini
file has the following sections (defaults shown):
; host=127.0.0.1
; port=6379
; db=0
; host=127.0.0.1
; port=6379
Publish & Subscribe are DB agnostic and thus have no db setting. If host and port and not defined, they default to the same as [server] settings.
; see https://www.npmjs.com/package/redis#overloading
Use redis in your plugin like so:
if (server.notes.redis) {
server.notes.redis.hgetall(...);
// or any other redis command
}
In your plugin:
exports.results_init = function (next, connection) {
var plugin = this;
plugin.redis_subscribe(connection, function () {
connection.notes.redis.on('pmessage', function (pattern, channel, message) {
plugin.do_something_with_message(message, ...);
});
next();
});
}
// be nice to redis and disconnect
exports.hook_disconnect = function (next, connection) {
this.redis_unsubscribe(connection);
}
This variation lets your plugin establish its own Redis connection, optionally with a redis db ID.
exports.register = function () {
var plugin = this;
plugin.inherits('redis');
plugin.cfg = plugin.config.get('my-plugin.ini');
// populate plugin.cfg.redis with defaults from redis.ini
plugin.merge_redis_ini();
// cluster aware redis connection(s)
plugin.register_hook('init_master', 'init_redis_plugin');
plugin.register_hook('init_child', 'init_redis_plugin');
}
When a db ID is specified in the [redis] section of a redis inheriting plugin, log messages like these will be emitted when Haraka starts:
[INFO] [-] [redis] connected to redis://172.16.15.16:6379 v3.2.6
[INFO] [-] [karma] connected to redis://172.16.15.16:6379/2 v3.2.6
[INFO] [-] [known-senders] connected to redis://172.16.15.16:6379/3 v3.2.6
Notice the database ID numbers appended to each plugins redis connection message.
FAQs
Redis plugin for Haraka & other plugins to inherit from
The npm package haraka-plugin-redis receives a total of 1,866 weekly downloads. As such, haraka-plugin-redis popularity was classified as popular.
We found that haraka-plugin-redis demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.