From: Michael Rash <mbr@cipherdyne.org>
To: netfilter@lists.netfilter.org
Subject: Re: about ipt_string
Date: Sun, 26 Aug 2007 17:02:27 -0400 [thread overview]
Message-ID: <20070826210227.GA11193@minastirith> (raw)
In-Reply-To: <46cce0f3.22bd720a.5b5c.ffffc703@mx.google.com>
On Aug 23, 2007, CrackyBlue wrote:
> Hi,
>
> I am just wondering why this script don't block
>
> iptables -A INPUT -p tcp -m string --string 'bittorent' --algo kmp -d 0/0
> --dport 80 -j REJECT
>
> I have iptables 1.3.8 and 2.6.17 kernel and ipt_string is already loaded
The Snort community has two rules that are designed to detect Bittorrent
communications in the 'p2p.rules' file, and you could use fwsnort to
recast these into iptables rules:
http://www.cipherdyne.org/fwsnort/
The Snort rule ID's are 2180 and 2181, and if you want fwsnort to use the
REJECT target against Bittorrent traffic, then use the --ipt-reject
argument like so:
# fwsnort --snort-sids 2180,2181 --ipt-reject
[+] Parsing Snort rules files...
[+] Found sid: 2180 in p2p.rules
Successful translation.
[+] Found sid: 2181 in p2p.rules
Successful translation.
[+] Logfile: /var/log/fwsnort.log
[+] iptables script: /etc/fwsnort/fwsnort.sh
Here is an example iptables command that fwsnort will execute to block
Bittorrent traffic (where 192.168.10.0/24 is an internal network
protected by iptables):
$IPTABLES -A FWSNORT_FORWARD_ESTAB -s 192.168.10.0/24 -p tcp --dport
6881:6889 -m string --hex-string "|13|BitTorrent protocol" --algo bm
--to 84 -j REJECT --reject-with tcp-reset
(If you want to try this, then please install fwsnort-1.0.2 since there
have been some bug fixes).
--
Michael Rash
http://www.cipherdyne.org/
Key fingerprint = 53EA 13EA 472E 3771 894F AC69 95D8 5D6B A742 839F
prev parent reply other threads:[~2007-08-26 21:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-23 1:19 about ipt_string CrackyBlue
2007-08-26 21:02 ` Michael Rash [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=20070826210227.GA11193@minastirith \
--to=mbr@cipherdyne.org \
--cc=netfilter@lists.netfilter.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox