1

I've set up my server so that, in order to track down the source of spam (and block it), the email address that I use to sign up for stuff is [email protected] (e.g. for Facebook, it would be [email protected]).

Now, suppose that I get spam emails to [email protected] - (from, e.g., [email protected]). I'd like to block them, but continue to receive emails from the facebook.com domain - i.e. I would like to restrict email to a certain address to come from a certain domain.

Is this possible with Postfix? Or will I need something additional? (I'm already running Dovecot, although that doesn't seem like the right tool).

I'm not using a conventional spam filter because the above seems more elegant - however, if there is a spam filter that can implement the above, I'd be happy to use it.

1 Answer 1

1

Haraka can handle this case easily, and it's very easy to setup in front of Postfix so that your current Postfix setup continues to work as-is (or if you don't want to do that, it can deliver direct to Dovecot via LMTP).

You'd setup a Haraka plugin like the following:

var net_utils = require('./net_utils');

exports.hook_rcpt = function (next, connection, params) {
    var recip = params[0];
    if (connection.relaying) {
        // Already relaying (i.e. outbound) - skip.
        return next();
    }

    // Get who this is coming from and change a.b.example.com into just example.com
    var check_domain = net_utils.get_organizational_domain(connection.transaction.mail_from.host);

    // Turn 'example.com' into just 'example'
    check_domain = check_domain.replace(/\..*$/, '');

    if (check_domain.toLowerCase() != recip.user.toLowerCase()) {
        return next(DENY, "You dirty dirty spammer");
    }

    next();
}

Add that to your plugins directory, and add a line to config/plugins specifying what you called the file so that it is loaded into your configuration.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .