Linux Netfilter discussions
 help / color / mirror / Atom feed
From: "Adem" <for-gmane@alicewho.com>
To: netfilter@vger.kernel.org
Subject: Re: SYN flooding
Date: Mon, 24 Nov 2008 23:46:55 +0100	[thread overview]
Message-ID: <ggfavo$h8l$1@ger.gmane.org> (raw)
In-Reply-To: 98f5d92c0811090859n1df8231fy750b5930f565fdc6@mail.gmail.com

"Servers 4you" wrote:
>
> Im having this notice on my messages logs:
> 
> Nov  5 06:40:46 workstation kernel: possible SYN flooding on port
> 38211. Sending cookies.
> 
> (i have and app running on port 38211).
> Is an way to block it with iptables?

If it is tcp protocol then you could try the following method as root.
It allows only 1 connection from the same source IP within the last 20 seconds:

#! /bin/sh
...
if cat /proc/net/ip_tables_matches | grep "recent" &>/dev/null ; then
  # 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 tcp:38211 and register in WATCHLIST
  /sbin/iptables -A INPUT -p tcp --dport 38211 --match recent --name WATCHLIST --set -j ACCEPT
else
  echo "# ipt_recent module is not loaded. Cannot use WATCHLIST feature. Ask your HN admin."

  /sbin/iptables -A INPUT -p tcp --dport 38211  -j ACCEPT
fi
...



      reply	other threads:[~2008-11-24 22:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-09 16:59 SYN flooding Servers 4you
2008-11-24 22:46 ` Adem [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='ggfavo$h8l$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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox