How to deal with joe-jobs and massive bounce storms
Wednesday, January 10th, 2007As I’ve noted before, we
still have a major problem with sites generating bounce/backscatter storms in
response to forged mail — spam, viruses, and so on. These sites have a broken
mail configuration, but there are still thousands out there — it’s very hard
to fix an old mail setup to avoid this issue. As a result, a single spam
run can concentrate the volume of response bounces in a Smurf-attack-style volume
multiplication, and this acts as a serious denial of service; I’ve
regularly had serious load problems and backlogs on my MX, due solely to
these bounces.
However, I think I’ve now solved it, with only a little loss of functionality.
Here’s how I did it, using Postfix and SpamAssassin.
Firstly, note that if you adopt this, you will lose functionality.
Third party sites will not be able to generate bounces which are sent
back to senders via your MX — except during the SMTP transaction.
However, if a message delivery attempt is run from your MX, and it is bounced
by the host during that SMTP transaction, this bounce message will still be
preserved. This is good, since this is basically the only bounce scenario that
can be recommended, or expected to work, in modern SMTP.
Also, a small subset of third-party bounce messages will still get past, and be
delivered — the ones that are not in the RFC-3464 bounce format generated
by modern MTAs, but that include your outbound relays in the quoted header.
The idea here is that “good bounces”, such as messages from mailing lists
warning that your mails were moderated, will still be safe.
OK, the details:
In Postfix
Ideally, we could do this entirely outside Postfix — but in my experience,
the volume (amplified by the Smurf attack effects) is such that these
need to be rejected as soon as possible, during the SMTP transaction.
In my Postfix configuration, on the machine that acts as MX for my domains –
edit ‘/etc/postfix/header_checks’ and add these lines:
/^Return-Path: <>/ REJECT no third-party DSNs /^From:.*MAILER-DAEMON/ REJECT no third-party DSNs /^Content-Type: multipart\/report; / REJECT no third-party DSNs /^Content-Type: message\/delivery-status; / REJECT no third-party DSNs
Edit ‘/etc/postfix/main.cf’, and ensure it contains this line:
header_checks = regexp:/etc/postfix/header_checks
Now restart Postfix.
In SpamAssassin
Install the
Virus-bounce ruleset. This will catch challenge-response mails, “out of
office” noise, “virus scanner detected blah” crap, and bounce mails generated
by really broken groupware MTAs — the stuff that gets past the Postfix
front-line.
Once you’ve done these two things, that deals with almost all the forged-bounce
load, at what I think is a reasonable cost. Comments welcome…
Tags:anti spam backscatter bounces email howto smtp spamassassin virus bounces viruses
This post was written by Justin, source: How to deal with joe-jobs and massive bounce storms
