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.
  • Hi, Björn, and welcome to the User BB!

    IPsec can be picky about NAT.  In the Astaro 'Remote Gateway' definition for the branch, set 'VPN ID: IP Address' and 'VPN ID (Optional): 192.168.100.10'.

    I haven't read your post very closely - I'm just hoping I can avoid it with a lucky guess! [;)]

    Cheers - Bob
  • Hi, Björn, and welcome to the User BB!

    IPsec can be picky about NAT.  In the Astaro 'Remote Gateway' definition for the branch, set 'VPN ID: IP Address' and 'VPN ID (Optional): 192.168.100.10'.

    I haven't read your post very closely - I'm just hoping I can avoid it with a lucky guess! [;)]

    Cheers - Bob


    Hi Bob,
    thanks for helping. Site-to-Site without NAT is so much easier... anyway

    I changed the Identifier in the Remote Gateway definition to IP. Now I'm getting various errors, a progress [[:)]]

    Astaro:
    "Informational Exchange message must be encrypted"
    "sending encrypted notification INVALID_KEY_INFORMATION"

    Openswan:
    "ignoring informational payload, type INVALID_KEY_INFORMATION msgid=00000000"
    "sending notification PAYLOAD_MALFORMED"

    ISAKMP seems to be up and there is something wrong with esp/crypto now. 
    STATE_MAIN_R3: sent MR3, ISAKMP SA established {auth=OAKLEY_RSA_SIG cipher=aes_256 prf=OAKLEY_SHA2_256 group=modp1536}

    Guess I have to digg again, I will post updates (and questions [[:)]]

    Cheers, Björn
  • Hi,

    Meanwhile I got the tunnel with the Gateway Identifier IP up and running again. But sadly I can't send any data over it in any direction.

    I see the connection as NAT-T on my Astaro.
    [FONT="Courier New"]root@astaro : ip xfrm state
    src 1.1.1.1 dst 2.2.2.2
    proto esp spi 0xe506d652 reqid 16485 mode tunnel
    replay-window 32 flag noecn nopmtudisc af-unspec
    auth hmac(sha256) 0xb63698da9bb68bc9b7d60831a49363ae2d43e203dd8a1b08de32a581c97b7262
    enc cbc(aes) 0xcde28bd947cffee7a1750b37a8248a2bb00440bbcb135d883b414d17fe2d050a
    encap type espinudp sport 4500 dport 4500 addr 0.0.0.0[/FONT]

    ... and on openswan

    [FONT="Courier New"]root@astaro : ip xfrm state
    src 192.168.100.10 dst 1.1.1.1
    proto esp spi 0xe82e6f22 reqid 16385 mode tunnel
    replay-window 32 flag af-unspec
    auth-trunc hmac(sha256) 0x3ea6dc9cad4700bad088b7e4a44d2c0939ba6ddb3e423675366eb6641d6c413e 96
    enc cbc(aes) 0xfe466f7d7faf2c9db24657feca18a24a40fb16bb6bb50a335a8f780af6a1159b
    encap type espinudp sport 4500 dport 4500 addr 0.0.0.0[/FONT]

    1.1.1.1 is the external IP of the Astaro
    2.2.2.2 is the external IP of the NAT-Router

    I don't get the point, it should work...

    Is there anything I forgot?

    Björn
  • 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
  • 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
  • I could have helped if I signed on to see this. But I have to re-iterate NAT and VPN are TOTALLY FINE AND GOOD. The problem is Astaro's GUI does not expose the complete  StrongSWAN configuration that it uses. Only a couple of the configurations would be needed to expose and you would not have any issues. You can do this via hacking the config files, but that is not supported.  Check out thread about Astaro VPN with NAT.

    https://community.sophos.com/products/unified-threat-management/astaroorg/f/58/t/54446