All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Weber <jweber@amsuper.com>
To: netfilter@lists.netfilter.org
Subject: DNAT rule requires extra firewall pinhole
Date: Fri, 25 May 2007 17:17:27 -0500	[thread overview]
Message-ID: <200705251717.27252.jweber@amsuper.com> (raw)

I've setup DNAT on gateway such that external clients connecting to TCP port 
$SCADA_PORT on the gateway are actually connected to the node $MCB_IP on a 
private network.  Here's my rule:

 $IPTABLES -t nat -A PREROUTING -p tcp -d $DAS_SCADA_IP --dport $SCADA_PORT \
        -i $DAS_SCADA_IF -j DNAT --to $MCB_IP:$SCADA_PORT

The gateway knows how to forward packets between the internal and external 
interfaces.  The above rule works fine.

I've added a firewall rule to block external requests to forward through the 
gateway:

$IPTABLES -A FORWARD -p tcp -i $DAS_SCADA_IF --syn -j DROP

The trouble is, I just found out that the above firewall rule is not 
compatible with my DNAT rule.  That is, DNAT rewrites the destination IP [as 
it should] to the $MCB_IP, then forwards the packet, which then encounters 
the new firewall rule, and is dropped.

So I preceeded the above firewall rule with another rule:
$IPTABLES -A FORWARD -p tcp -i $DAS_SCADA_IF -s $SCADANET -d $MCB_IP \
    --dport $SCADA_PORT -j ACCEPT

which enables the DNAT to work again.  However, a side effect is that now 
external nodes on $SCADANET can forward port=$SCADA_PORT to IP=$MCB_IP 
directly through the firewall.  Granted this is a small pinhole, but I'd like 
to plug it if possible.  I would think that it should be possible to prevent 
all external nodes from forwarding through the firewall, and to prevent 
external hosts from directly "seeing" an internal node on the private net.

Any suggestions?

	TIA,
	Jeff


             reply	other threads:[~2007-05-25 22:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-25 22:17 Jeff Weber [this message]
2007-05-26 13:44 ` DNAT rule requires extra firewall pinhole Jan Engelhardt
2007-05-26 14:52 ` Pascal Hambourg

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=200705251717.27252.jweber@amsuper.com \
    --to=jweber@amsuper.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.