Skip to content

Instantly share code, notes, and snippets.

View smfreegard's full-sized avatar

Steve Freegard smfreegard

  • Fort Systems Ltd.
  • Chichester, UK
View GitHub Profile
exports.hook_rcpt = function (next, connection) {
var txn = connection.transaction;
if (txn.rcpt_to.length > 1) {
return next(DENY, 'Multiple recipients not allowed');
}
return next();
}
const Address = require('address-rfc2821').Address;
exports.hook_rcpt = function (next, conn, rcpt) {
const txn = conn.transaction;
const cfg = this.config.get('forwarder.ini');
conn.loginfo(this, JSON.stringify(cfg));
if (rcpt && rcpt[0] && rcpt[0].host) {
var domain = rcpt[0].host.toLowerCase();
if (cfg.main[domain]) {
conn.loginfo(this, 'Found domain ' + domain + ' forwarding to ' + cfg.main[domain]);
[root@mail1-ewh views]# rspamc < a.eml
Results for file: stdin (0.215 seconds)
[Metric: default]
Spam: true
Score: 14.10 / 15.00
Action: add header
Symbol: COMPROMISED_ACCT_BULK (3.00)
Symbol: DATE_IN_PAST (1.00)
Symbol: DCC_BULK (2.00)[bulk Body=1 Fuz1=many]
Symbol: DMARC_NA (0.00)[outlook.fr]
var logfmt = require('logfmt');
exports.remote = {
ip: '1.2.3.4',
host: 'a.b.foo.com',
}
exports.hello = {
host: 'FOO'
}
exports.relaying = false;
exports.remote = {
ip: '1.2.3.4',
host: 'a.b.foo.com',
}
exports.hello = {
host: 'FOO'
}
exports.relaying = false;
exports.early_talker = false;
exports.esmtp = true;
var lynx = require('lynx');
var metrics = new lynx('localhost', 8125);
var hostname = require('os').hostname();
// Connections per second
// Connections by source port (25, 80, ...)
exports.hook_lookup_rdns = function (next, conn) {
// Ignore connections from localhost
if (conn.remote_ip === '127.0.0.1' ||
conn.remote_ip === '::1')
rspamd_config.NO_MX_FOR_RETURN_ADDR = {
callback = function(task)
local return_addr
local hdr_from = task:get_header('From')
local hdr_replyto = task:get_header('Reply-To')
-- Work out the return address
if (hdr_replyto) then
return_addr = hdr_replyto
elseif (hdr_from) then
freemail_envfrom {
type = "from";
filter = "email:domain";
map = "https://raw.githubusercontent.com/willwhite/freemail/master/data/free.txt";
symbol = "FREEMAIL_ENVFROM";
}
freemail_envrcpt {
type = "rcpt";
filter = "email:domain";
var outbound = require('./outbound');
var constants = require('./constants');
exports.hook_queue = function (next, connection) {
var transaction = connection.transaction;
outbound.send_email(connection.transaction, function(retval, msg) {
switch(retval) {
case constants.ok:
return next(OK, msg);
exports.hook_data_post = function (next, connection) {
var txn = connection.transaction;
// Copy auth notes to transaction notes so they're available in hmail.todo.notes
txn.notes.auth_user = connection.notes.auth_user;
txn.notes.auth_passwd = connection.notes.auth_passwd;
return next();
}
exports.hook_get_mx = function (next, hmail, domain) {
return next(OK, {