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
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);
@smfreegard
smfreegard / auth_mysql.js
Last active October 1, 2015 12:03 — forked from Dexus/auth_mysql.js
auth_mysql - not tested
// Authentication against a MySQL server
var net_utils = require('./net_utils');
var mysql = require('mysql');
var crypto = require('crypto');
exports.register = function() {
this.inherits('auth/auth_base');
}
exports.hook_capabilities = function(next, connection) {
// Proxy AUTH requests selectively by domain
var sock = require('./line_socket');
var utils = require('./utils');
var smtp_regexp = /^([0-9]{3})([ -])(.*)/;
exports.register = function () {
this.inherits('auth/auth_base');
};
exports.hook_capabilities = function (next, connection) {
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, {
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";
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
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')
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 logfmt = require('logfmt');
exports.remote = {
ip: '1.2.3.4',
host: 'a.b.foo.com',
}
exports.hello = {
host: 'FOO'
}
exports.relaying = false;
[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]