Guest User!

You are not Sophos Staff.

This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

VPN Connection only for some Target Addresses

Hi,

I've kind of a special requirement:
I've an Internet connection with a govermental firewall and so I have a VPN Connection, to allow access to some needed blocked websites.
But the traffic through the VPN is slower so I want to route the traffic depending on a configurable list of IPs/Hostnames. 
But now after establishing the SSL-VPN with Sophos all the traffic is routet through this VPN. I couldn't find a configuration menu to change this. Is there a way directly with Sophos to handle this or how can you run this setup with sophos?

thanks,
linuxadmin


This thread was automatically locked due to age.
  • Sorry, I should have made it clear that this is a site-to-site configuration where the other side does "not have any access to the Sophos and the network behind the Sophos" and only certain IPs are routed through the tunnel.  It can be accomplished with either IPsec or SSL VPN site-to-site connections.

    I don't think there's a way to do this with Remote Access instead of Site-to-Site.

    Cheers - Bob
     
    Sophos UTM Community Moderator
    Sophos Certified Architect - UTM
    Sophos Certified Engineer - XG
    Gold Solution Partner since 2005
    MediaSoft, Inc. USA
  • It's not Remoteaccess.
    It's site by site, but the SSL Site-by-Site.
    If the Site-by-Site Connection is established ALL the traffic is only routet through this SSL VPN. That is not what I want, so I deleted the routes that cause this.
    So the problem is, to find a good way to configure which target hosts/dns hosts are routed how.
    I found a way by creating routing tables (ip route tables) and choosing the right table with iptables. That was my last post.
    But I'd like to find a more "standard" way, that is also supported by the GUI of the Sophos UTM.

    Hope it get's clearer what I did and want [:)]
    Thanks,
    linuxadmin
  • If the Site-by-Site Connection is established ALL the traffic is only routet through this SSL VPN. That is not what I want, so I deleted the routes that cause this.

    It's not possible for all traffic to go through the tunnel, so there must be a misunderstanding.  Please click on [Go Advanced] and attach pictures of the NAT rule and the SSL VPN Connection.

    Cheers - Bob
     
    Sophos UTM Community Moderator
    Sophos Certified Architect - UTM
    Sophos Certified Engineer - XG
    Gold Solution Partner since 2005
    MediaSoft, Inc. USA
  • Hi,

    I attached the SSL Configuration with pictures (the apc config file is nothing special, very basic, but because of security reasons I cannot post it...)
    and the routing table after establishing the connection.
    My only NAT rule is: iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE

    Routing Table after the SSL VPN is connected:

    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    0.0.0.0         10.8.0.9        128.0.0.0       UG    0      0        0 tun0
    10.8.0.1        10.8.0.9        255.255.255.255 UGH   0      0        0 tun0
    10.8.0.9        0.0.0.0         255.255.255.255 UH    0      0        0 tun0
    127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
    128.0.0.0       10.8.0.9        128.0.0.0       UG    0      0        0 tun0
    192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1
    192.168.1.0     192.168.0.2     255.255.255.0   UG    5      0        0 eth1
    192.168.2.0     0.0.0.0         255.255.255.0   U     0      0        0 eth2
    192.168.99.0    0.0.0.0         255.255.255.0   U     0      0        0 eth1
    199.x.x.x 192.168.2.4     255.255.255.255 UGH   0      0        0 eth2


    with these routes, local traffic directly attached to the server is working, but everything routet is going through tun0. Networks attached to eth2 through local routers cannot be reached with these routing settings.

    eth1 - 192.168.0.1 / 24 local network
    eth2 - 192.168.2.1 / 24 ldevice to internet router 192.168.2.4
    tun0 - vpn to vpn server 199.x.x.x

    What I did is deleting the route 128.0.0.0 netmask 128.0.0.0, and added to ip route tables for internet traffic through tun0 and through eth2. But I only managed to choose the ip route tables with the iptables mark feature. that works, but I don't want to add manually firewall scripts etc and prefer to do anything with the gui.


    ip route add default dev tun0 table net_vpn1
    ip rule add fwmark 0x1 table net_vpn1

    iptables -A OUTPUT -t mangle -d www.heise.de -j MARK --set-mark 1
    iptables -t nat -A PREROUTING -t mangle -d www.heise.de -j MARK --set-mark 1
    ...


    hope it gets clearer... [:)]
    linuxadmin
  • Please attach pictures of the NAT rule opened in Edit mode and the SSL VPN Connection open in Edit mode.  If you've made command line changes that survive a reboot, I don't think anyone here will be able to help you until you restore a configuration backup made prior to the command line changes.

    Cheers - Bob
     
    Sophos UTM Community Moderator
    Sophos Certified Architect - UTM
    Sophos Certified Engineer - XG
    Gold Solution Partner since 2005
    MediaSoft, Inc. USA
  • Please attach pictures of the NAT rule opened in Edit mode and the SSL VPN Connection open in Edit mode.  If you've made command line changes that survive a reboot, I don't think anyone here will be able to help you until you restore a configuration backup made prior to the command line changes.

    Cheers - Bob



    oh, sorry, I just recognized I didn't post the SSL Config Edit picture, but there are not really options to see...
    I also attached the NAT settings, but they are not active. I only have one NAT rule that everything outgoing on tun0 is masqueraded, but I added this on the commandline. 

    There are no command line changing surviving a reboot, except the added routing table names in /etc/iproute2/rt_tables, but that has only an influence if I add routing tables. Basically the command line changes are already gone after restarting the VPN. But I also restarted the whole UTM several times and hat to make my changes again. I have no startup script yet.
    Is there a way to add a ifup / ifdown script for the VPN connection? Is it just the standard linux way?

    thanks,
    linuxadmin
  • I see that you've constructed your own apc from an ovpn file.  Assuming that "Internal (Network)" on the client side is a /24 subnet, the definition for the server should correspond to the following definition that would be made if the device on the Server side were a UTM:



    The NAT on the Client side should be:



    I haven't tried this with the SSL VPN, but it should work if the default is not strict routing.  If it is, then your only possibility is an IPsec tunnel.

    Cheers - Bob
     
    Sophos UTM Community Moderator
    Sophos Certified Architect - UTM
    Sophos Certified Engineer - XG
    Gold Solution Partner since 2005
    MediaSoft, Inc. USA
  • Hi Bob,

    thanks for all your help. I did a lot of researches the last days.
    It seems that the manual iptables / iproute2 solution is a good way to go, although it's not with the UTM-GUI. To get this running without changing the system too much, I've too more questions:

    Are you familiar with the APC-File layout? I'd like to setup my Site-to-Site Openvpn Client, so that it will not accept the pushed routes, dns server etc. by the server (route-nopull, route-noexec). I only need the IP Address. These routes don't do what I want and I would have to delete them.

    The second thing I'm looking for is a way to run an IP-UP and IP-DOWN script for the VPN connection. Any idea?

    thanks so much for your help,
    linuxadmin
  • Hi,

    I decided now to do it with the iptables / iproute2 way. I cannot get the other thing runnig. 
    I'll create a VPN-IF-UP Script, that sets my firewall and routing rules and after disconnection the firewall handles that as well. I think that is the easiest way to configure it. I don't have to go to deep into the sophos utm system, just the up / down scripts.

    At the moment I only have the problem that the firewall rules are not created from the if-up script, I guess it's a privilege/directory problem caused by the changeroot environment. But I'll be able to fix that somehow [:)]

    thanks,
    linuxadmin
  • I think you'd be happier without using the Sophos software.  You're setting yourself up for nasty surprises when there's a major upgrade, and possibly with each Up2Date.  Changes made without cc aren't backed up, nor are the various conf files.  The genius of the Sophos package is the WebAdmin GUI that facilitates elegant configuration and simplifies ongoing maintenance.

    That said, it's great to have someone with iptables experience join us here! [;)]  For me, iptables is a bit like Nederlans - Since I speak German and English, I understand it, but I never learned to speak it. [:)]

    Cheers - Bob
     
    Sophos UTM Community Moderator
    Sophos Certified Architect - UTM
    Sophos Certified Engineer - XG
    Gold Solution Partner since 2005
    MediaSoft, Inc. USA