All of lore.kernel.org
 help / color / mirror / Atom feed
From: /dev/rob0 <rob0@gmx.co.uk>
To: netfilter <netfilter@lists.netfilter.org>
Subject: Re: ESTABILISHED connections are not that estabilished
Date: Thu, 28 Jul 2005 05:41:44 -0500	[thread overview]
Message-ID: <42E8B668.3030201@gmx.co.uk> (raw)
In-Reply-To: <dca9si$kis$1@sea.gmane.org>

Gioele Barabucci wrote:
>>In my logs I often find reports of dropped input packets from my DNS:53 or
>>dropped output packets generated from localhost:25 to other mail servers.
>>Why are these packets dropped?

I have a theory and a suggestion.

>   iptables -P OUTPUT DROP

Bad idea (see below.)

>   iptables -P FORWARD DROP # just for fun, I don't do any routing

Good idea. Even if not routing it doesn't hurt to take these out at the 
firewall level.

>   iptables -A OUTPUT -p udp --dport nameserver -j ACCEPT
>   iptables -A OUTPUT -p tcp --dport nameserver -j ACCEPT

Theory:
# iptables -vA OUTPUT -p tcp --dport nameserver
   tcp opt -- in * out *  0.0.0.0/0  -> 0.0.0.0/0  tcp dpt:42
# iptables -vA OUTPUT -p tcp --dport domain
   tcp opt -- in * out *  0.0.0.0/0  -> 0.0.0.0/0  tcp dpt:53
I cannot see into your /etc/services, but mine resolves "nameserver" to 
"42". (R.I.P., D. Adams.)

>   echo "Logging"
>   iptables -A INPUT -m limit --limit 3/second --limit-burst 5 -i ! lo -j LOG
> --log-level "debug" --log-ip-options --log-tcp-options --log-prefix
> 'iptables INPUT DROP '
>   iptables -A INPUT -m limit --limit 3/second --limit-burst 5 -i ! lo -j
> ULOG --ulog-prefix 'iptables INPUT DROP '
>   iptables -A OUTPUT -m limit --limit 3/second --limit-burst 5 -o ! lo -j
> LOG --log-level "debug" --log-ip-options --log-tcp-options --log-prefix
> 'iptables OUTPUT DROP '

Whoa, that is a lot of logging! What do you expect to find in all that? 
Why LOG and ULOG both?

>   echo "REJECT for outgoing packets"
>   iptables -A OUTPUT -j REJECT # reject, don't DROP outgoing packets

It's cleaner to limit this to "-p tcp".


Suggestion: OUTPUT filtering is a bad idea. Carefully crafted rules to 
limit what your daemons can do with -m owner might slightly enhance 
security. General OUTPUT filtering only guarantees that things won't 
work well.

Why are you doing it? What is the benefit you think you are getting? 
This sounds like a single user machine, from the fact that there's no 
routing. Who are you limiting with OUTPUT rules? Yourself?

I would do OUTPUT -p ACCEPT and eliminate the OUTPUT rules. I'd also do 
away with the logging, or at least tightly curtail it. I usually only 
log for specific short-term reasons (troubleshooting a problem.) I'd 
include a "-m state --state INVALID -j DROP" rule for good measure. 
Finally, I'd move your --state rules to the top.

At that point everything would be working as you expect, and you would 
have a very tight firewall.
-- 
     mail to this address is discarded unless "/dev/rob0"
     or "not-spam" is in Subject: header


  reply	other threads:[~2005-07-28 10:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-27 16:10 ESTABILISHED connections are not that estabilished Gioele Barabucci
2005-07-27 18:52 ` Gioele Barabucci
2005-07-28  4:57   ` curby .
2005-07-28  9:52 ` Gioele Barabucci
2005-07-28 10:41   ` /dev/rob0 [this message]
2005-07-28 22:04     ` Gioele Barabucci
2005-07-31 18:20       ` /dev/rob0

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=42E8B668.3030201@gmx.co.uk \
    --to=rob0@gmx.co.uk \
    --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.