All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hose <subscriptions@bluemaggottowel.com>
To: netfilter@lists.netfilter.org
Subject: difference between --rcheck and --update in recent
Date: Tue, 30 Aug 2005 20:33:33 -0500	[thread overview]
Message-ID: <20050831013333.GA9794@bluemaggottowel.com> (raw)

Hi,

I've set up a few simple rules to kill off annoying ssh brute force
attacks, however, I'm confued between the differences among "rcheck" and
"update".

From what I gather, they both do the same thing EXCEPT update also
updates an existing record, not just checking for its existence.  The
question is... what does it update?  Take the following two examples
(simplified for example purposes only).

Example 1:
-A INPUT -p tcp --dport 22 -m recent --rcheck \
--hitcount 3 --seconds 600 -j LOG --log-prefix "SSH attack: "

-A INPUT -p tcp --dport 22 -m recent --rcheck \
--hitcount 3 --seconds 600 -j DROP

-A INPUT -p tcp --dport 22 -m recent --set -j ACCEPT


Example 2:
-A INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m \
recent --set

-A INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m recent \
  --update --seconds 60 --hitcount 4 -j DROP

-A INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -j ACCEPT 


The first one allows up to 3 SSH attempts within 600 seconds.  That's
pretty straightforward.  

The second one checks for new connections to sshd, inserts it into the
recents list (default) in the first line.  The second line drops the
packet if it's been seen more than 4 times in the last 60.  But since
it's an update, does it actually update the record in the list, ie
incrementing the hitcount? IOW, everytime a new connection comes in does
it actually climb TWO hitcounts instead of just one?

It doesn't seem to increment the hitcount two times, but I could be
readint /proc/net/ipt_recent wrong.

The crux of the matter is what exactly is the difference between update
and rcheck?

hose


             reply	other threads:[~2005-08-31  1:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-31  1:33 Hose [this message]
2005-08-31  7:26 ` difference between --rcheck and --update in recent Grant Taylor

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=20050831013333.GA9794@bluemaggottowel.com \
    --to=subscriptions@bluemaggottowel.com \
    --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 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.