All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Adem" <for-gmane@alicewho.com>
To: netfilter@vger.kernel.org
Subject: Re: Allow client only 1 connect per 20 seconds
Date: Tue, 25 Nov 2008 21:07:13 +0100	[thread overview]
Message-ID: <gghm16$qal$1@ger.gmane.org> (raw)
In-Reply-To: gghgq9$33t$1@ger.gmane.org

"Adem" wrote:
>
> How would you code this rule in iptables:
> 
> If anybody tries to do more than 1 connection to port 8191
> within 20 seconds, regardless of the protocol, then DROP 
> it and ignore any further connect attempts on that port
> from that source for 20 seconds.

The following should work, but it somehow doesn't work in iptables v1.4.1.1:
 ...
  # if anybody from the list WATCHLIST, and in the last 20 sec, tries to do new connect attempts then DROP them!
  /sbin/iptables -A INPUT --match recent --name WATCHLIST --rcheck --seconds 20 -j DROP

  # accept client at port 8191 (all protocols) and register in WATCHLIST
  # BUG: if "-p XXX" is left out or if instead "-p all" is used then the rule gets eliminated!
  /sbin/iptables -A INPUT -p all --dport 8191 --match recent --name WATCHLIST --set -j DROP
 ...

It works only if "-p tcp" is specified.
Isn't that a bug in iptables?



  reply	other threads:[~2008-11-25 20:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-25 18:38 Allow client only 1 connect per 20 seconds Adem
2008-11-25 20:07 ` Adem [this message]
2008-11-25 20:20   ` Matt Zagrabelny
2008-11-26 10:55   ` Paul Evans
2008-11-25 20:21 ` Matt Zagrabelny

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='gghm16$qal$1@ger.gmane.org' \
    --to=for-gmane@alicewho.com \
    --cc=netfilter@vger.kernel.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.