netfilter.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: william fitzgerald <wfitzgerald@tssg.org>
To: Mail List - Netfilter <netfilter@vger.kernel.org>
Subject: Query: On the ordering of stateful rules over stateless rules best practice
Date: Fri, 05 Jun 2009 23:33:57 +0100	[thread overview]
Message-ID: <4A299D55.3080000@tssg.org> (raw)

Hi all,

I am just wondering is there a best practice when it comes to ordering your stateful rules?

Presumably you want to place stateful traffic filtering before your stateless traffic.

Rule 1: allow VPN access by stateful filtering
iptables -A INPUT -p tcp -s 0/0 -d vpnIP --dport 22 -m state --state NEW,ESTABLISHED -j ACCEPT
Rule 2: allow VPN access by statelessfiltering
iptables -A INPUT -p tcp -s 0/0 -d vpnIP --dport 22 -j ACCEPT
Rule 3: a crazy rule!
iptables -A INPUT -p tcp -s 0/0 -d 0/0 -j ACCEPT

 From the above 3 rules it is obvious that there is a requirement that stateful rules come 
before stateless rules to ensure they are matched and that stateless rules are only matched 
in the event of stateful fallover (crash).

But I guess there are times when you want stateless rules first, particularly stateless DROP 
rules. For example, port scanning (tcp flag matches) and spoofed reserved ip addresses.

Is there any particular guides/documentation that outline best practices when ordering 
statefull and stateless rules?

My guess is there isn't and abstract best practice compliance guides like PCI DSS, 
NIST-800-41 etc provide no insight as to how administrates maintain their own low-level best 
practice rule orderings.

What are your experiences in ordering rule-sets? Is it more drive by instinct rather than 
hard and fast rules.

regards,
Will.

                 reply	other threads:[~2009-06-05 22:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=4A299D55.3080000@tssg.org \
    --to=wfitzgerald@tssg.org \
    --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;
as well as URLs for NNTP newsgroup(s).