LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 06-20-2008, 03:22 PM   #1
perlchun
LQ Newbie
 
Registered: Sep 2007
Posts: 4

Rep: Reputation: 0
Trying to configure shorewall to allow bridged vpn traffic to the local subnet


Hello,

I'm having a really hard time trying to configure shorewall to allow bridged vpn traffic in the local subnet. I'm using openvpn v2.0.9 , Shorewall v4.0.10 with the Shorewall-Perl compiler on a dedicated Debian 2.6.18 system.

The firewall is a three interface setup with:
eth0 = loc
eth1 = dmz
eth2 = net

My Openvpn client (XP) seems to connect ok, the tap interface gets assigned an ip, but I am unable to ping anything in the subnet.
If you can shed some light on this for me I would be very grateful. Please let me know if you need to see anything else.


The output of "brctl show" is:
bridge name bridge id STP enabled interfaces
br0 8000.00010287046a no eth0
tap0
--------------------------------------------------------------------------------------

Here's a look at my shorewall setup:
shorewall/zones:
#ZONE TYPE OPTIONS IN OUT
# OPTIONS OPTIONS
fw firewall
road ipv4
net ipv4
loc ipv4
dmz ipv4
-----------------------------------
shorewall/interfaces:
#ZONE INTERFACE BROADCAST OPTIONS

net eth2 detect tcpflags,dhcp,routefilter,nosmurfs,logmartians,routeback
loc br0 detect dhcp,bridge,routeback,routefilter
dmz eth1 detect routeback
----------------------------------
shorewall/masq:
#INTERFACE SOURCE ADDRESS PROTO PORT(S) IPSEC MARK
eth2 br0
eth2 eth1
---------------------------------



Thank You,
 
Old 06-23-2008, 04:49 AM   #2
San-Raal
LQ Newbie
 
Registered: Apr 2008
Distribution: debian, redhat el4
Posts: 18

Rep: Reputation: 0
I think, you don't have shorewall configured properly, because you have a zone assigned to "road" (from your /etc/shorewall/zones), but no interface assigned to that zone (/etc/shorewall/interfaces).

Please post your /etc/shorewall/policy file.
 
Old 06-24-2008, 10:51 AM   #3
perlchun
LQ Newbie
 
Registered: Sep 2007
Posts: 4

Original Poster
Rep: Reputation: 0
Openvpn /Shorewall issue

Hi,

I've since updated my shorewall configuration as follows:

fyi, the .200 ip address below is for our loc interface on the firewall. I'm not sure if I should be putting that or if I should use .100 as per my openvpn server-bridge configuration below.

-----------------------
rules:
-----------------------
ACCEPT loc net
DNAT road loc:10.100.100.200 udp 1194


# Accept SSH/FTP connection to systems in the DMZ
SSH/ACCEPT net dmz:10.100.222.81 - - - 206.165.217.81
SSH/ACCEPT net dmz:10.100.222.82 - - - 206.165.217.82
HTTP/ACCEPT net dmz:10.100.222.82 - - - 206.165.217.82
HTTPS/ACCEPT net dmz:10.100.222.82 - - - 206.165.217.82
FTP/ACCEPT net dmz:10.100.222.91 - - - 206.165.217.91

# Accept http and email connection to system in the LOC
HTTP/ACCEPT net road:10.100.100.10 - - - 206.165.217.69
ACCEPT net road:10.100.100.4 tcp 25 - 206.165.217.68
HTTP/ACCEPT net road:10.100.100.4 - - - 206.165.217.68
HTTPS/ACCEPT net road:10.100.100.4 - - - 206.165.217.68
IMAP/ACCEPT net road:10.100.100.4 - - - 206.165.217.68
POP3/ACCEPT net road:10.100.100.4 - - - 206.165.217.68
ACCEPT net road:10.100.100.4 tcp 25 - 206.165.217.66

# Accept DNS connections from the firewall to the Internet
#
DNS/ACCEPT $FW net
#
#
# Accept SSH connections from the local network to the firewall and DMZ
#
SSH/ACCEPT loc $FW
SSH/ACCEPT loc dmz
#
# DMZ DNS access to the Internet
#
DNS/ACCEPT dmz net
ACCEPT dmz net


# Reject Ping from the "bad" net zone.

Ping/REJECT net $FW

#
# Make ping work bi-directionally between the dmz, net, Firewall and local zone
# (assumes that the loc-> net policy is ACCEPT).
#

Ping/ACCEPT loc $FW
Ping/ACCEPT dmz $FW
Ping/ACCEPT loc dmz
Ping/ACCEPT dmz road
Ping/ACCEPT dmz net

ACCEPT $FW net icmp
ACCEPT $FW road icmp
ACCEPT $FW dmz icmp
ACCEPT loc net
# Uncomment this if using Proxy ARP and static NAT and you want to allow ping from
# the net zone to the dmz and loc

#Ping/ACCEPT net dmz
#Ping/ACCEPT net loc
#LAST LINE -- ADD YOUR ENTRIES BEFORE THIS ONE -- DO NOT REMOVE



-----------------------
policy:
-----------------------
loc dmz ACCEPT info
loc $FW ACCEPT info
loc all ACCEPT info

#Allow VPN traffic
road loc ACCEPT info
loc road ACCEPT info
#
# Policies for traffic originating from the firewall ($FW)
#
# If you want open access to the Internet from your firewall, change the
# $FW to net policy to ACCEPT and remove the 'info' LOG LEVEL.
$FW net ACCEPT info
$FW dmz ACCEPT info
$FW road ACCEPT info
$FW all REJECT info

#
# Policies for traffic originating from the De-Militarized Zone (dmz)
#
# If you want open access from DMZ to the Internet change the following
# policy to ACCEPT. This may be useful if you run a proxy server in
# your DMZ.
dmz net ACCEPT info
dmz $FW ACCEPT info
dmz road ACCEPT info
dmz all ACCEPT info

#
# Policies for traffic originating from the Internet zone (net)
#
net dmz DROP info
net $FW DROP info
net road DROP info
net all DROP info

# THE FOLLOWING POLICY MUST BE LAST
all all REJECT info


---------------------
zones:
---------------------
#ZONE TYPE OPTIONS IN OUT
# OPTIONS OPTIONS
fw firewall
road ipv4
net ipv4
loc:road bport
dmz ipv4
vpn:road bport #tap interface


--------------------
interfaces:
-------------------
#ZONE INTERFACE BROADCAST OPTIONS
#pub br0 detect routefilter,bridge
road br0 detect routefilter,bridge
net eth2 detect tcpflags,dhcp,routefilter,nosmurfs,logmartians,routeback
loc br0:eth0 # detect routeback,routefilter,dhcp,bridge
dmz eth1 detect routeback
vpn br0:tap0

--------------------
tunnels:
--------------------
#TYPE ZONE GATEWAY GATEWAY
# ZONE

openvpnserver:1194 net 0.0.0.0/0

-------------------
masq:
------------------
#INTERFACE SOURCE ADDRESS PROTO PORT(S) IPSEC MARK
eth2 br0
eth2 eth1

----------------------
I even created an action
----------------------
#TARGET SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/
# PORT PORT(S) DEST LIMIT GROUP
ACCEPT tap0 br0
ACCEPT br0 tap0


---------------------------------
My OpenVPN server.conf files is as follows:
---------------------------------
port 1194
proto udp
dev tap0
ca /etc/openvpn/easy-rsa/keys/ca.crt
cert /etc/openvpn/easy-rsa/keys/server.crt
key /etc/openvpn/easy-rsa/keys/server.key # This file should be kept secret
dh /etc/openvpn/easy-rsa/keys/dh1024.pem
ifconfig-pool-persist ipp.txt
server-bridge 10.100.100.100 255.255.255.0 10.100.100.117 10.100.100.125
push "route 10.100.100.0 255.255.255.0"
client-to-client
keepalive 10 120
comp-lzo
persist-key
persist-tun
status openvpn-status.log
log openvpn.log
verb 6

-------------------------------------



When I connect from the xp sp2 client it says:
TEST ROUTES: 0/0 succeeded len-1 ret=0 a=0 u/d=down
Route: Waiting for TUN/TAP interface to come up...
TEST ROUTES: 0/0 succeeded len-1 ret=0 a=0 u/d=down
Route: Waiting for TUN/TAP interface to come up...TEST ROUTES: 0/0 succeeded len-1 ret=0 a=0 u/d=down
Route: Waiting for TUN/TAP interface to come up...TEST ROUTES: 0/0 succeeded len-1 ret=0 a=0 u/d=down
Route: Waiting for TUN/TAP interface to come up...TEST ROUTES: 0/0 succeeded len-1 ret=0 a=0 u/d=down
Route: Waiting for TUN/TAP interface to come up...
TEST ROUTES: 0/0 succeeded len-1 ret=0 a=0 u/d=up
route ADD 10.100.100.0 MASK 255.255.255.0 10.100.100.100

Route addition via IPAPI succeeded
Initialization Sequence Completed


But I can't ping anything on the 10.100.100.0 network

Thank You

Last edited by perlchun; 06-24-2008 at 10:56 AM.
 
Old 06-25-2008, 04:44 AM   #4
San-Raal
LQ Newbie
 
Registered: Apr 2008
Distribution: debian, redhat el4
Posts: 18

Rep: Reputation: 0
Thanks for all the configs, but you got it messed up a little (luckily not too much).

First of all, I want to mention, that I got a Debian 3 interface router+OpenVPN+shorewall configuration for multiple clients connecting to the VPN, with access to the loc zone. I don't use bridged interfaces (and don't know why are you...), because without them the configuration is in my opinion simplier and does its job 100% :-).

From the configs I assume that you are trying to connect two networks using OpenVPN bridge mode. The problem is that you have probably misconfigured the interfaces/zones part.

You have kinda too much in logs (the "info" part after rules) from your firewall, so I would recommend removing this logging. Then you could see, what rule is blocking the traffic. The traffic from the VPN probably ends on the rule "ALL ALL REJECT info". The reason is, that you are setting rules for the "road" zone, but you probably should be using the "vpn" zone.

Your interfaces:
#ZONE INTERFACE BROADCAST OPTIONS
road br0 detect routefilter,bridge << "road" is the whole bridge
net eth2 detect tcpflags,dhcp,routefilter,nosmurfs,logmartians,routeback
loc br0:eth0 # detect routeback,routefilter,dhcp,bridge
dmz eth1 detect routeback
vpn br0:tap0 << "vpn" is the tap0 part of the bridge

I would suggest, that you first try to remove some logs generation from the shorewall policy config file (if you have that many, you probably don't inspect them 100%). Log only the VPN parts you are trying to get working. Then try looking into your logs and find the traffic that is blocked, and where it is blocked. Afterwards I recommend a revision of your zones/interfaces files, to check if you are using the correct zones in your rules/policy. But I think, you will probably find it in the logs, why your pings are blocked.

My last recomendation is not regarding your problem, but will probably "clean" your config a little :-) You can remove the rules:
ACCEPT loc net << this is already in your policy file "loc all ACCEPT info", remov it from rules, it's ok in the policy file
DNAT road loc:10.100.100.200 udp 1194 <<don't know why are your DNATing it, but you already have a ACCEPT rule created from the tunnels file, and everything required can be configured there.

The last thing is regarding your "dmz all ACCEPT info" policy. With that you are rewriting all your custom rules like "DNS/ACCEPT dmz loc", and make them not needed. I would recommend setting it to "dmz all REJECT info", because this rule makes the DMZ a DMZ. If you can connect from the DMZ to the local zone, you don't need the DMZ zone, because the point of DMZ is layered approach to network defense. If someone compromises a system in a DMZ, he is in a restricted zone, and can't access any systems in the local zone. In your configuration, he has got open doors :-)

Sorry for the wall of text, but hope it will be helpfull.

Last edited by San-Raal; 06-25-2008 at 04:47 AM.
 
Old 06-25-2008, 09:13 PM   #5
perlchun
LQ Newbie
 
Registered: Sep 2007
Posts: 4

Original Poster
Rep: Reputation: 0
I now have my policy setup with
vpn road ACCEPT info

and now everytime I try to ping from the vpn client I see this in my syslog:
Jun 26 16:40:52 localhost kernel: Shorewall:vpn2road:ACCEPT:IN=br0 OUT=br0 PHYSIN=tap0 PHYSOUT=eth0 SRC=10.100.100.117 DST=255.255.255.255 LEN=45 TOS=0x00 PREC=0x00 TTL=128 ID=65117 PROTO=UDP SPT=62516 DPT=62516 LEN=25

Jun 26 16:40:52 localhost kernel: Shorewall:vpn2road:ACCEPT:IN=br0 OUT=br0 PHYSIN=tap0 PHYSOUT=eth0 SRC=192.168.1.65 DST=255.255.255.255 LEN=45 TOS=0x00 PREC=0x00 TTL=128 ID=65119 PROTO=UDP SPT=62516 DPT=62516 LEN=25
------------------

the 10.100.100.117 address is assigned to the tap interface on the xp client,

the 192.... address is assigned by my internet provider to the client.

------------------

I can see these packets coming in but I still can't ping anything from the client to the 10.100.100.0 network.

please help.

thanks.

Last edited by perlchun; 06-26-2008 at 06:46 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Filter traffic between computers same subnet matters Slackware 9 10-19-2007 02:42 AM
no outgoing ssh connection in subnet with shorewall/squid linux_marine Linux - Networking 2 11-21-2006 02:30 PM
HOWTO configure VPN in Local LAN. kitcha Linux - Networking 1 02-27-2006 12:41 AM
Possible? 1 public subnet/1 private; 1 host: traffic out the way it came in? JMCraig Linux - Networking 8 10-17-2005 08:12 PM


All times are GMT -5. The time now is 06:35 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration