Brian J. Murrell
2002-10-15 07:34:38 UTC
I am just trying out Shorewall for the first time and am impressed
with all of the scenarios it handles. I did find out one it does not
handle terribly gracefully (which is asked about over and over again
in the archives, but a definate succinct explanation is never given of
the problem and solution, so here goes). I have an IPSEC connection
between an IPSEC gateway + lan and a stand-alone host (here comes the
ascii art):
+---------+ +-------+
10.1.1.0/24 Lan | IPSEC | | IPSEC |
----------------------| Gateway |---- Internet ----| Host |
+---------+ +-------+
This setup is comprised of _two_ tunnels (not just the obvious one).
The obvious tunnel is between the 10.1.1.0 Lan and the IPSEC Host and
the other is between the IPSEC Gateway and the IPSEC Host. Once the
latter tunnel is set up, all subsequent traffic (including IPSEC
maintenance traffic) between the gateway and the host is carried over
the tunnel, not over the clear channel.
The Shorewall I am trying to configure is on the IPSEC Host. I have
configured a tunnels entry:
ipsec net 0.0.0.0/0
I also have the zones defined:
net Net Internet
vpn VPN VPN over FreeS/WAN interfaces (ipsecN)
and interfaces:
net ppp0 - norfc1918
vpn ipsec0 -
Given all of this, I get the following (relevant) netfilter rules:
INPUT:
2473 536K ppp0_in all -- ppp0 * 0.0.0.0/0 0.0.0.0/0
ppp0_in:
pkts bytes target prot opt in out source destination
2473 536K net2fw all -- * * 0.0.0.0/0 0.0.0.0/0
net2fw:
pkts bytes target prot opt in out source destination
0 0 ACCEPT esp -- * * 0.0.0.0/0 0.0.0.0/0 state NEW
0 0 ACCEPT ah -- * * 0.0.0.0/0 0.0.0.0/0 state NEW
0 0 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 udp spt:500 dpt:500 state NEW
OUTPUT:
pkts bytes target prot opt in out source destination
1563 498K fw2net all -- * ppp0 0.0.0.0/0 0.0.0.0/0
fw2net:
pkts bytes target prot opt in out source destination
0 0 ACCEPT esp -- * * 0.0.0.0/0 0.0.0.0/0 state NEW
0 0 ACCEPT ah -- * * 0.0.0.0/0 0.0.0.0/0 state NEW
0 0 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 udp spt:500 dpt:500 state NEW
Which is good for the initial (i.e. before any tunnels are set up) IPSEC
handshake and setup, but once the tunnels are up and running, any
further IPSEC traffic between the gateway and the host is transmitted
and arrives on the ipsec0 interface, not the ppp0 interface.
May I suggest a further set of (automatic) rules be added when ipsec
tunnels are defined:
ipsec0_in:
pkts bytes target prot opt in out source destination
0 0 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 udp spt:500 dpt:500 state NEW
ipsec0_out:
pkts bytes target prot opt in out source destination
0 0 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 udp spt:500 dpt:500 state NEW
In other words, always allow the IPSEC setup traffic (udp:500<->udp:500)
on ipsec tunnelling interfaces.
Perhaps the "interfaces" entry for ipsec interfaces could have a flag
added to specify that it is an ipsec tunnel and thus trigger the above
two new rules.
Or perhaps there is a way that this already works in Shorewall and I am
just missing it presently?
b.
with all of the scenarios it handles. I did find out one it does not
handle terribly gracefully (which is asked about over and over again
in the archives, but a definate succinct explanation is never given of
the problem and solution, so here goes). I have an IPSEC connection
between an IPSEC gateway + lan and a stand-alone host (here comes the
ascii art):
+---------+ +-------+
10.1.1.0/24 Lan | IPSEC | | IPSEC |
----------------------| Gateway |---- Internet ----| Host |
+---------+ +-------+
This setup is comprised of _two_ tunnels (not just the obvious one).
The obvious tunnel is between the 10.1.1.0 Lan and the IPSEC Host and
the other is between the IPSEC Gateway and the IPSEC Host. Once the
latter tunnel is set up, all subsequent traffic (including IPSEC
maintenance traffic) between the gateway and the host is carried over
the tunnel, not over the clear channel.
The Shorewall I am trying to configure is on the IPSEC Host. I have
configured a tunnels entry:
ipsec net 0.0.0.0/0
I also have the zones defined:
net Net Internet
vpn VPN VPN over FreeS/WAN interfaces (ipsecN)
and interfaces:
net ppp0 - norfc1918
vpn ipsec0 -
Given all of this, I get the following (relevant) netfilter rules:
INPUT:
2473 536K ppp0_in all -- ppp0 * 0.0.0.0/0 0.0.0.0/0
ppp0_in:
pkts bytes target prot opt in out source destination
2473 536K net2fw all -- * * 0.0.0.0/0 0.0.0.0/0
net2fw:
pkts bytes target prot opt in out source destination
0 0 ACCEPT esp -- * * 0.0.0.0/0 0.0.0.0/0 state NEW
0 0 ACCEPT ah -- * * 0.0.0.0/0 0.0.0.0/0 state NEW
0 0 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 udp spt:500 dpt:500 state NEW
OUTPUT:
pkts bytes target prot opt in out source destination
1563 498K fw2net all -- * ppp0 0.0.0.0/0 0.0.0.0/0
fw2net:
pkts bytes target prot opt in out source destination
0 0 ACCEPT esp -- * * 0.0.0.0/0 0.0.0.0/0 state NEW
0 0 ACCEPT ah -- * * 0.0.0.0/0 0.0.0.0/0 state NEW
0 0 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 udp spt:500 dpt:500 state NEW
Which is good for the initial (i.e. before any tunnels are set up) IPSEC
handshake and setup, but once the tunnels are up and running, any
further IPSEC traffic between the gateway and the host is transmitted
and arrives on the ipsec0 interface, not the ppp0 interface.
May I suggest a further set of (automatic) rules be added when ipsec
tunnels are defined:
ipsec0_in:
pkts bytes target prot opt in out source destination
0 0 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 udp spt:500 dpt:500 state NEW
ipsec0_out:
pkts bytes target prot opt in out source destination
0 0 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 udp spt:500 dpt:500 state NEW
In other words, always allow the IPSEC setup traffic (udp:500<->udp:500)
on ipsec tunnelling interfaces.
Perhaps the "interfaces" entry for ipsec interfaces could have a flag
added to specify that it is an ipsec tunnel and thus trigger the above
two new rules.
Or perhaps there is a way that this already works in Shorewall and I am
just missing it presently?
b.
--
Brian J. Murrell
Brian J. Murrell