All of lore.kernel.org
 help / color / mirror / Atom feed
From: william fitzgerald <wfitzgerald@tssg.org>
To: Mail List - Netfilter <netfilter@vger.kernel.org>
Subject: Query: stateless versus statefull best practice choices
Date: Wed, 03 Jun 2009 17:31:42 +0100	[thread overview]
Message-ID: <4A26A56E.3080404@tssg.org> (raw)

Dear all,

What is *best practice* when it comes to choosing either stateless 
versus statefull rules (or perhaps combinations) to protect services.

For example:

Internet --> Firewall --> Web server

STATELESS
% allow anyone initiate access to web server

% Rule 1
iptables -A FORWARD -i eth1 -s 0/0 -d 192.168.1.2 -p tcp --dport 80 
--tcp-flags !SYN -j DROP

%Rule 2
iptables -A FORWARD -i eth1 -s 0/0 -d 192.168.1.2 -p tcp --dport 80 -j 
ACCEPT

% allow web server to reply back to internet

% Rule 3: filter for ACK flag, web server should not send a SYN
iptables -A FORWARD -o eth0 -s 192.168.1.2 -d 0/0 -p tcp --sport 80 
--tcp-flags !ACK -j DROP

% Rule 4: used after 3-way handshake established
iptables -A FORWARD -o eth0 -s 192.168.1.2 -d 0/0 -p tcp --sport 80 -j 
ACCEPT

(Note maybe rules 1 and 3 above are ineffective but I guess rules 2 and 
4 provide simplistic stateless access after the 3-way handshake)

STATEFULL
% allow anyone initiate access to web server

% Rule 1
iptables -A FORWARD -i eth1 -s 0/0 -d 192.168.1.2 -p tcp --dport 80 -m 
state --state NEW -j ACCEPT

% Rule 2: allow on going communication after 3 way handshake.
% note: sure if this rule is even needed given Rule 1 is part of the 
state match process
iptables -A FORWARD -i eth1 -s 0/0 -d 192.168.1.2 -p tcp --dport 80 -m 
state --state ESTABLISHED -j ACCEPT

% allow web server to reply back to internet
% Rule 3
iptables -A FORWARD -o eth0 -s 192.168.1.2 -d 0/0 -p tcp --sport 80 -m 
state --state ESTABLISHED -j ACCEPT


So why would I choose one over the other here?
regards,
Will.

                 reply	other threads:[~2009-06-03 16:31 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=4A26A56E.3080404@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 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.