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

Site-to-Site IPSec VPN between Astaro and Openswan (routing, parameters)

Hello @all,

I'm trying to create a Site-to-Site VPN between an Astaro Security Gateway (v8.301) and openswan (2.6.28 on ubuntu server). Auth is handled through RSA-Keys on both sides. Currently I'm able to establish the IPSec tunnel without errors (STATE_QUICK_R2: IPSec SA established tunnel mode {..para..}), but I can't send packets over the connection in any direction. 

This is my setup:
Site-to-site between 10.10.10.0/24 (office) and 192.168.100.0/24 (branch)

10.10.10.0/24===10.10.10.1office.dyn.ip---{internet}---branch.dyn.ip192.168.100.1===192.168.100.10192.168.100.0/24

Openswan is located behind a NAT-Router. Because the fact that everything is fine with IPSec (IKE, ESP, SA, RSA-Pubkeys) itself I assume that the problem don't relate to this parameters. No, I'm sure I made something wrong related to the routing. 

So without any specific configuration files, just to understand the topic and for qualified bug hunting:

What do I have to put inside openswan config (local=left and remote=right) for left and right, especially behind a NAT-Router? My current settings:
left="192.168.100.10"
leftnexthop=%defaultroute
leftsourceip="192.168.178.10"
leftsubnet="192.168.178.0/24"
right="office.dyn.ip"
rightsourceip="10.10.10.1"
#rightnexthop=%defaultroute
rightsubnet="10.10.10.0/24"

My current routing table on openswan server:
[FONT="Courier New"]root@openswan:~# netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.100.1   0.0.0.0         UG        0 0          0 eth0
10.10.10.0     192.168.100.1   255.255.255.0   UG        0 0          0 eth0
192.168.100.0   0.0.0.0         255.255.255.0   U         0 0          0 eth0[/FONT]

Shouldn't 10.10.10.0 point to the gateway 192.168.100.10, because the tunnel starts/ends here? 

[FONT="Courier New"]root@openswan:~# ip xfrm policy show
src 192.168.100.0/24 dst 10.10.10.0/24 
dir out priority 2344 
tmpl src 192.168.100.10 dst 1.1.1.1(


This thread was automatically locked due to age.
Parents
  • But sadly I can't send any data over it in any direction

    Are you seeing any relevant packets blocked in the Astaro Firewall log?  How about anything unusual in the Intrusion Prevention log?

    Also, please [Go Advanced] below and attach a picture of 'Site-to-site VPN tunnel status'.

    Cheers - Bob
  • Are you seeing any relevant packets blocked in the Astaro Firewall log?  How about anything unusual in the Intrusion Prevention log?


    That's to easy [;)] I checked the IPS and disabled it for testing purpose. There was no change at all. I also checked the firewall rules, enabled and disabled automatic firewall rules. And I don't have any relating NAT rules defined on the astaro side. 

    Also, please [Go Advanced] below and attach a picture of 'Site-to-site VPN tunnel status'.


    I will. But first I will replace the "cheap" NAT-Router with another brand, because I read of some bugs with it's firmware. Also I will change the config on the Astaro side to match the "real" network, 10.10.10.0/24 is a playground and testing subnet. 

    I will post updates as soon as I have the tunnel up again.

    Thanks for help!
    Björn
Reply
  • Are you seeing any relevant packets blocked in the Astaro Firewall log?  How about anything unusual in the Intrusion Prevention log?


    That's to easy [;)] I checked the IPS and disabled it for testing purpose. There was no change at all. I also checked the firewall rules, enabled and disabled automatic firewall rules. And I don't have any relating NAT rules defined on the astaro side. 

    Also, please [Go Advanced] below and attach a picture of 'Site-to-site VPN tunnel status'.


    I will. But first I will replace the "cheap" NAT-Router with another brand, because I read of some bugs with it's firmware. Also I will change the config on the Astaro side to match the "real" network, 10.10.10.0/24 is a playground and testing subnet. 

    I will post updates as soon as I have the tunnel up again.

    Thanks for help!
    Björn
Children
  • Hi,

    I changed the NAT-Router, using the default IPv4 Subnet now, and changed the left subnet. I attached a graphic with the new configuration. 

    For debugging I deactivated the IPS (there wasn't something in it...), made very simple and global firewall rules (double checked them, see attachment) and checked that there is no interferring NAT/Masquerading. 

    After reconfiguring both sides of the tunnel I still got it up and running (see attached Astaro VPN Status). But ther is still no traffic passing the tunnel. It must be something on the linux/openswan side regarding to the NAT-T or routing...

    my ipsec.conf on openswan
    [FONT="Courier New"]
            left="192.168.178.10"
            leftnexthop=%defaultroute
            leftsourceip="192.168.178.10"
            leftsubnet="192.168.178.0/24"
            #
            # left security parameter (general)
            #
            leftid="192.168.178.10"
            leftrsasigkey="Public RSA Openswan Signatur"

            #
            # right aka remote endpoint
            #
            right="office.dyndns.org"
            rightid="@office.dyndns.org"
            rightrsasigkey="Public RSA Astaro Signatur"
            rightsourceip="192.168.6.1"
            rightnexthop=%defaultroute
            rightsubnet="192.168.6.0/24"[/FONT]

    Hint: I changed the dynamic hostnames and ID, and right is the Astaro Side in this config.

    The state of ipsec shows entries for encapsulating (espinudp) [FONT="Courier New"]
    src 1.1.1.1 dst 192.168.178.10
      proto esp spi 0x20aedc96 reqid 16385 mode tunnel
      replay-window 32 flag af-unspec
      auth-trunc hmac(sha256) 0x10598b4b6f6cab675057e071af64b341b50188b38f767a5e86d87cb60a821187 96
     enc cbc(aes) 0x478b38d9fbdcbf8139db97e29ce54a9bae25579c7379f7209cabbb3df6ffeaaf
      encap type espinudp sport 4500 dport 4500 addr 0.0.0.0
    src 192.168.178.10 dst 1.1.1.1
      proto esp spi 0xe3c2669b reqid 16385 mode tunnel
      replay-window 32 flag af-unspec
      auth-trunc hmac(sha256) 0x3c8f5ae3a9db8be7ffdbe5875cfa2f2983977a3321f4e71a59cf567506f041fb 96
      enc cbc(aes) 0x400fb86d2eea6d66bac4b767b967a204f8c2ea06710c5711244f1958ba986e45
      encap type espinudp sport 4500 dport 4500 addr 0.0.0.0[/FONT]

    routing is set, but maybe not right:
    [FONT="Courier New"]root@openswan:~# netstat -rn
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
    0.0.0.0         192.168.178.1   0.0.0.0         UG        0 0          0 eth0
    192.168.6.0     192.168.178.1   255.255.255.0   UG        0 0          0 eth0
    192.168.178.0   0.0.0.0         255.255.255.0   U         0 0          0 eth0[/FONT]

    What am I missing? Maybe MTU?

    I hope for any advice, thanks in advance!
    Björn
  • After looking for tcpdump a while I'am now more confused.

    running tcpdump -f udp -i eth0 on openswan (1.1.1.1 is the external IP of the astaro box):

    I can see NAT-T and some isakmp packages:
    [FONT="Courier New"]IP 192.168.178.10.4500 > 1.1.1.1.4500: NONESP-encap: isakmp: phase 2/others I inf[E]
    IP 1.1.1.1.4500 > 192.168.178.10.4500: NONESP-encap: isakmp: phase 2/others R inf[E]
    IP 192.168.178.10.4500 > 1.1.1.1.4500: NONESP-encap: isakmp: phase 2/others I inf[E]
    IP 192.168.178.10.4500 > 1.1.1.1.4500: isakmp-nat-keep-alive
    IP 192.168.178.10.4500 > 1.1.1.1.4500: isakmp-nat-keep-alive
    IP 1.1.1.1.4500 > 192.168.178.10.4500: NONESP-encap: isakmp: phase 2/others R inf[E]
    IP 192.168.178.10.4500 > 1.1.1.1.4500: NONESP-encap: isakmp: phase 2/others I inf[E]
    IP 1.1.1.1.4500 > 192.168.178.10.4500: NONESP-encap: isakmp: phase 2/others R inf[E]
    IP 192.168.178.10.4500 > 1.1.1.1.4500: NONESP-encap: isakmp: phase 2/others I inf[E][/FONT]

    ping from 192.168.6.1 to 192.168.178.10 (astaro endpoint to openswan endpoint):
    [FONT="Courier New"]IP 1.1.1.1.4500 > 192.168.178.10.4500: UDP-encap: ESP(spi=0x686d3f8a,seq=0x1a), length 136
    IP 1.1.1.1.4500 > 192.168.178.10.4500: UDP-encap: ESP(spi=0x686d3f8a,seq=0x1b), length 136
    IP 1.1.1.1.4500 > 192.168.178.10.4500: UDP-encap: ESP(spi=0x686d3f8a,seq=0x1c), length 136
    …[/FONT]

    ping from 192.168.178.10 to 192.168.6.1 (openswan endpoint to astaro endpoint):
    [FONT="Courier New"]IP 192.168.178.10.4500 > 1.1.1.1.4500: UDP-encap: ESP(spi=0x9e836dfb,seq=0x7), length 132
    IP 192.168.178.10.4500 > 1.1.1.1.4500: UDP-encap: ESP(spi=0x9e836dfb,seq=0x8), length 132
    IP 192.168.178.10.4500 > 1.1.1.1.4500: UDP-encap: ESP(spi=0x9e836dfb,seq=0x9), length 132
    …[/FONT]

    So my packages got routed and I see incoming encapsulated traffic, but can't get even 1 ping through? 

    I must forgot something very basic on the linux/openswan box.

    Still pondering...
    Björn

    Update:
    While initiating the ipsec I see two ICMP Packets T03/C03 dropped on the Astaro, which means "Destination unreachable, Port unreachable". Do I have to setup a firewall rule between both, or is this part of the NAT-T process? 

    [FONT="Courier New"]astaro ulogd[5181]: id="2001" severity="info" sys="SecureNet" sub="packetfilter" name="Packet dropped" action="drop" fwrule="60001" initf="ppp0" srcip="2.2.2.2" dstip="1.1.1.1" proto="1" length="152" tos="0x00" prec="0x00" ttl="58" type="3" code="3"[/FONT]
  • Regarding to the lack of success with my VPN I created a second one in exactly the same configuration to another Astaro but running V6.315. And Boom it's working!

    So I moved every configuration parameters to %default and made the only difference the right connection partner (including auth).

    As addition I made exactly the same firewall rules and disabled IPS, Anti Port Scan, every Web Security setting, nearly everything on the Astaro V8.301. It is not working! Don't know why.

    I see only one difference in the ipsec.log

    VPN to Astaro 8.301
    [FONT="Courier New"]
    #183: NAT-Traversal: Result using RFC 3947: peer is NATed
    #183: Peer ID is ID_FQDN: '******x'
    #183: we don't have a cert
    #183: Dead Peer Detection (RFC 3706) enabled
    ...
    #183: IPsec SA established {ESP=>0x09ee1a1c 0xc836141a 
  • Finally I found it, it is the HMAC SHA2 used in the setup. There might be problems with the strongswan/openswan packages on some linux distributions, such as Debian and Ubuntu (Server).

    [FONT="Courier New"]"It is required to build Openswan with USE_EXTRACRYPTO set to include proper SHA2 support."[/FONT]

    The HMAC is supported but NOT build in, nice.

    Astaro V6.x seems to have a fallback to SHA1 or it's hard coded, whatever. I found one option HMAC_SHA2_256_128 in the log to ASG v6, but HMAC_SHA2_256 to v8. 

    I changed it, it's working. 

    Good night