From: Joel Newkirk <netfilter@newkirk.us>
To: David Collodel <dave@crawlspaceradio.com>, netfilter@lists.netfilter.org
Subject: Re: DMZ trouble!
Date: Thu, 9 Jan 2003 02:58:04 -0500 [thread overview]
Message-ID: <200301090258.04071.netfilter@newkirk.us> (raw)
In-Reply-To: <1042090495.2320.216.camel@jimmy>
On Thursday 09 January 2003 12:34 am, David Collodel wrote:
{Very heavily snipped}
> Perhaps it would help if I included my entire script? Or at least the
> relevant parts of it.
It seems you included it entire. :^)
> Thanks for any help you can offer.
[snipped lengthy but self-explanatory IP & interface aliases]
> $IPTABLES -P INPUT DROP
> $IPTABLES -P OUTPUT DROP
> $IPTABLES -P FORWARD DROP
>
> $IPTABLES -F
>
> $IPTABLES -F INPUT
> $IPTABLES -F OUTPUT
> $IPTABLES -F FORWARD
>
> $IPTABLES -F -t mangle
> $IPTABLES -t mangle -X
Why are you not flushing nat table as well? BTW, the "$IPTABLES -F"
encompasses all the filter table chains, so the following three flushes
are redundant.
Why do you have so many (snipped) rules for INPUT to the firewall box
itself? Do you really need to allow all ports and all protocols from
the DMZ and the LAN?? Unless you are running some services on the box
(which should probably be run on a server on the LAN or in the DMZ) you
really shouldn't allow ANY access, except SSH if you must. Other than
SSH I can't conceive of why you need ANY access to this box from the
Internet. Even the EST/REL shouldn't be necessary.
> $IPTABLES -A FORWARD -i $DMZ_IFACE -o $EXT_IFACE -j ACCEPT
This should probably be dropped in favor of individual rules to allow
each (if any other than DNS) connection that the DMZ machines would need
to initiate.
> $IPTABLES -A FORWARD -i $LAN_IFACE -j ACCEPT
Do you trust the LAN machines and users this much? You'd probably be
much better off if you just have a handful of rules to ACCEPT the
services they really require. If someone needs something that doesn't
get through the firewall, you'll certainly get a call. :^) You can then
decide if you want to allow it, and if so then add an appropriate rule.
On my home network, where I control all machines, I STILL only allow
four ports through FORWARD, and log everything else. And my INPUT rules
are tighter than this, and my firewall IS my desktop machine, web
server, and an Unreal Tournament server, and runs P2P sometimes. (Both
those are toggled through a script, so I open the ports manually with
"fw ut" for example then close with "fw utx")
> $IPTABLES -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
This one makes all your other FORWARD state rules rather unnecessary,
since they are all tighter than this, and this accepts any interface.
> $IPTABLES -A OUTPUT -p ALL -s $EXT_IP -j ACCEPT
Again, what need do you have for this box to communicate directly with
anything on the internet? I would lock this sucker down TIGHT. Set up
a script owned by root that you can execute to temporarily open INPUT
and OUTPUT only as far as absolutely necessary if there's anything you
need to do from the box. Other than that leave OUTPUT and INPUT at just
DROP, with SSH allowed in and responded only if you have to. If
somebody gets this box, they own your network. Don't invite trouble.
(especially now that your complete firewall is part of a publicly
accessibly archive...)
I'm not sure why you bothered with a DROP policy on OUTPUT with the four
OUTPUT rules you use. The ONLY thing you prevent from going out is an
incorrect IP.
> $IPTABLES -F -t nat
Ah, here's the nat table flush, 2/3 of the way through the script... :^)
Not a big deal, just that everything else is organized fairly clearly.
> # 3.2 PREROUTING chain
> # 3.2.3 DMZ DNAT
> #
>
> $IPTABLES -t nat -A PREROUTING -p TCP -i $EXT_IFACE -d $HTTP_IP
> --dport 80 -j DNAT --to-destination $DMZ_HTTP_IP
> $IPTABLES -t nat -A PREROUTING -p TCP -i $EXT_IFACE -d $HTTP_IP
> --dport 22 -j DNAT --to-destination $DMZ_HTTP_IP
> $IPTABLES -t nat -A PREROUTING -p TCP -i $EXT_IFACE -d $HTTP_IP
> --dport 443 -j DNAT --to-destination $DMZ_HTTP_IP
> $IPTABLES -t nat -A PREROUTING -p TCP -i $EXT_IFACE -d $HTTP_IP
> --dport 8000 -j DNAT --to-destination $DMZ_HTTP_IP
> $IPTABLES -t nat -A PREROUTING -p TCP -i $EXT_IFACE -d $HTTP_IP
> --dport 8001 -j DNAT --to-destination $DMZ_HTTP_IP
>
> $IPTABLES -t nat -A PREROUTING -p TCP -i $EXT_IFACE -d $DNS_IP --dport
> 53 -j DNAT --to-destination $DMZ_DNS_IP
> $IPTABLES -t nat -A PREROUTING -p UDP -i $EXT_IFACE -d $DNS_IP --dport
> 53 -j DNAT --to-destination $DMZ_DNS_IP
> $IPTABLES -t nat -A PREROUTING -p TCP -i $EXT_IFACE -d $DNS_IP --dport
> 443 -j DNAT --to-destination $DMZ_DNS_IP
> $IPTABLES -t nat -A PREROUTING -p TCP -i $EXT_IFACE -d $DNS_IP --dport
> 22 -j DNAT --to-destination $DMZ_DNS_IP
> $IPTABLES -t nat -A PREROUTING -p TCP -i $EXT_IFACE -d $DNS_IP --dport
> 25 -j DNAT --to-destination $DMZ_DNS_IP
> $IPTABLES -t nat -A PREROUTING -p TCP -i $EXT_IFACE -d $DNS_IP --dport
> 995 -j DNAT --to-destination $DMZ_DNS_IP
Hmmm. Well, this is the answer to your 'real' question. I don't see ANY
rules in PREROUTING to DNAT connections from the LAN. Those would be
addressed -d $DNS_IP, but would be -i $LAN_IFACE.
You should seriously reconsider what communications the firewall box
itself requires, and what traffic the LAN is allowed to conduct.
j
next prev parent reply other threads:[~2003-01-09 7:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-09 5:34 DMZ trouble! David Collodel
2003-01-09 7:58 ` Joel Newkirk [this message]
2003-01-10 0:11 ` Configuration Questions Brad Morgan
-- strict thread matches above, loose matches on Subject: below --
2003-01-09 4:22 DMZ trouble! John A. Novak
2003-01-09 4:59 ` David Collodel
2003-01-09 3:42 David Collodel
2003-01-09 5:07 ` Dharmendra.T
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=200301090258.04071.netfilter@newkirk.us \
--to=netfilter@newkirk.us \
--cc=dave@crawlspaceradio.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.