From: Michele Petrazzo - Unipex <michele.petrazzo@unipex.it>
To: "Fredrik Strömberg" <stromberg@insto.org>
Cc: netfilter@vger.kernel.org
Subject: Re: Block outgoing spam from a network using iptables?
Date: Fri, 08 May 2009 17:52:32 +0200 [thread overview]
Message-ID: <4A045540.5080201@unipex.it> (raw)
In-Reply-To: <E83DD376-AB3F-472D-B8DF-18F37B27D788@insto.org>
Fredrik Strömberg wrote:
> Hello,
>
> I want to block spam that goes out through the gateway, namely, I
> want to block certain traffic to dport 25.
> I don´t expect a complete solution, just suggestions and hints.
> Although, a complete solution would be nice to study and learn from,
> if someone here is able to do it.
>
Like now I do the same job with iptables, some per user match rules and
a python parser that make the control of the "iptables -nvL && iptables
-Z" output and send an email to user if the limit are passed
> Maybe logging how many emails is impossible. If so, what is the best
> solution you can think of that doesn´t involve scanning the
> contents?
>
>
a simple iptables -A FORWARD -p tcp --dport 25 -m state --state NEW -j
log --log-prefix "NEW EMAIL" or something like this
> I found this but I don´t understand how it does what he says it does.
> - http://marti.dimerge.net/blog/tag/ipt_recent :
>
> modprobe ipt_recent ip_list_tot=32 #ip_list_tot - defines the size of
> ip_recent file iptables -A FORWARD -p tcp –dport 25 -m recent –name
> SMTP –seconds 30 –update -j DROP iptables -A FORWARD -p tcp –dport
> 25 -m limit –limit 1/second –limit-burst 5 -j LOG –log-level info
> –log-prefix “smtp-log ” iptables -A FORWARD -p tcp –dport 25 -m
> recent –name SMTP –set -j ACCEPT
>
what's to understand? if someone send more than one email into the next
30 seconds, the match extension will drop it
have you read the iptables -> recent man page?
Michele
prev parent reply other threads:[~2009-05-08 15:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-07 9:36 Block outgoing spam from a network using iptables? Fredrik Strömberg
2009-05-08 15:52 ` Michele Petrazzo - Unipex [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A045540.5080201@unipex.it \
--to=michele.petrazzo@unipex.it \
--cc=netfilter@vger.kernel.org \
--cc=stromberg@insto.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.