From: Julien Vehent <julien@linuxwall.info>
To: netfilter@vger.kernel.org
Subject: Re: Firewall Configuration Help
Date: Wed, 05 Aug 2009 15:51:49 +0200 [thread overview]
Message-ID: <248de9c714c7f5a1b003ba7f31325955@localhost> (raw)
In-Reply-To: <4A798712.3040406@chello.at>
On Wed, 05 Aug 2009 15:20:18 +0200, Mart Frauenlob
<mart.frauenlob@chello.at> wrote:
> Julien Vehent wrote:
>> Hello Nicholas,
>>
>>
>> On Mon, 27 Jul 2009 13:56:59 -0400, NICHOLAS KLINE <nkline@kent.edu>
>> wrote:
>>
>>> Hi,
>>>
>>> I have a fresh install of Ubuntu 8.x desktop edition running on a
>>> laptop. Before I plug the laptop into a public network and proceed to
>>> patch it, I want to make sure I have a secure firewall in place.
>>>
>>> This particular system will not be running any server services such as
>>> HTTPD, SSH, FTP, etc. Inbound traffic should be denied unless an
>>> outbound connection was first established.
>>> I will mostly be using a wired internet connection but I might switch
>>> to wireless once in awhile.
>>>
>>> After reading a few Linux security books, I have a decent set of
>>> firewall rules almost ready to put into place. The only rule
>>> preventing me from putting the firewall in place is:
>>>
> ...
>
>>> # Set default-deny policies for all chains.
>>> # User-defined chains cannot be assigned default policies.
>>> $IPTABLES -P INPUT DROP
>>> $IPTABLES -P FORWARD DROP
>>> $IPTABLES -P OUTPUT DROP
>>>
>>> $IPTABLES -t nat -P PREROUTING DROP
>>> $IPTABLES -t nat -P OUTPUT DROP
>>> $IPTABLES -t nat -P POSTROUTING DROP
>>>
>>> $IPTABLES -t mangle -P PREROUTING DROP
>>> $IPTABLES -t mangle -P OUTPUT DROP
>>>
>>>
>>
>> I don't like the default policy because you can't log anything in these
>> rules.
>> I prefer to put at the end of the ruleset something like
>> --------
>> echo "Default log drop, at the end so we just drop what doesn't
match
>> the
>> previous rules"
>> $IPT -N LOGDROP
>> $IPT -A LOGDROP -j LOG --log-prefix "DROP => " --log-level debug
>> $IPT -A LOGDROP -j DROP
>>
>> $IPT -A INPUT -i $NETCARD -j LOGDROP
>> $IPT -A OUTPUT -o $NETCARD -j LOGDROP
>> --------
>> that allows you to log and then drop, instead of just dropping.
>>
>>
>>
> Why not just put a log rule as the final rule and let the policy drop
> the packet? That way there's less rules and traffic gets logged and
> dropped.
>
You would not log the firewall's decision then. Only the packet details.
> ...
>>> # Log & drop ALL incoming packets destined anywhere but here.
>>> # (We already set the default FORWARD policy to DROP. But this is
>>> # yet another free, reassuring redundancy, so why not throw it in?)
>>>
>>> $IPTABLES -A FORWARD -j LOG --log-prefix "Attempted FORWARD? Dropped
>>> by default:"
>>> $IPTABLES -A FORWARD -j DROP
>>>
>>
>>
>> FORWARD is processed after INPUT and OUTPUT. If you drop in those two
>> chains, you shouldn't need to do anything in FORWARD.
>>
>>
>>
> hm, I think this is not right.
> After the routing deciscion, packets either go to INPUT, OUTPUT or
> FORWARD chain.
> If the OP is not 'routing' traffic not originated from his box, the
> FORWARD chain will not be used at all, so a simple policy drop will do
> the job (log before if wanted).
> Correct me if I'm wrong please.
>
Uh.. Shame on me. You are actually right on this. It's PREROUTING or
POSTROUTING that are processed before FORWARD.
> greets
>
> Mart
> --
> To unsubscribe from this list: send the line "unsubscribe netfilter" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
julien
http://jve.linuxwall.info/blog
next prev parent reply other threads:[~2009-08-05 13:51 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-27 17:56 Firewall Configuration Help NICHOLAS KLINE
2009-07-28 9:09 ` Julien Vehent
2009-07-28 13:19 ` Billy Crook
2009-07-28 13:27 ` Julien Vehent
2009-07-28 22:08 ` /dev/rob0
2009-08-05 13:20 ` Mart Frauenlob
2009-08-05 13:51 ` Julien Vehent [this message]
2009-08-05 14:05 ` Mart Frauenlob
2009-08-05 13:35 ` Mart Frauenlob
2009-08-05 13:47 ` Julien Vehent
2009-08-05 18:21 ` Christoph A.
2009-08-05 12:56 ` Mart Frauenlob
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=248de9c714c7f5a1b003ba7f31325955@localhost \
--to=julien@linuxwall.info \
--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