StrongSwan with several rightsubnet's - ikev1
ISSUE TYPE
- Bug Report
COMPONENT NAME
VR
StrongSwan
CLOUDSTACK VERSION
ACS 4.11.2.0
CONFIGURATION
Advanced Network VPC
OS / ENVIRONMENT
SUMMARY
After upgrading ACS from 4.9.3 (openswan) to 4.11.2 (strongswan), all VPNs with multiple networks have stopped working. Only one of the networks declared in the encryption domain passed traffic.
rightsubnet=192.168.198.0/23,192.168.208.0/23,192.168.170.0/23,192.168.234.0/23,192.168.69.0/24
I changed the configuration manually by creating different Child SAs, one for each network, now all networks work. https://lists.strongswan.org/pipermail/users/2015-November/008966.html
Example: #conn for vpn-4.3.2.1 conn vpn-4.3.2.1 left=1.2.3.4 leftsubnet=192.168.101.0/24 right=4.3.2.1 type=tunnel authby=secret keyexchange=ike ike=aes128-sha1-modp1024 ikelifetime=1h esp=aes128-sha1-modp1024 lifetime=8h keyingtries=2 auto=start forceencaps=no dpddelay=30 dpdtimeout=120 dpdaction=restart
conn net-192.168.198.0 also=vpn-4.3.2.1 rightsubnet=192.168.198.0/23 auto=start
conn net-192.168.208.0 also=vpn-4.3.2.1 rightsubnet=192.168.208.0/23 auto=start
conn net-192.168.170.0 also=vpn-4.3.2.1 rightsubnet=192.168.170.0/23 auto=start
conn net-192.168.234.0 also=vpn-4.3.2.1 rightsubnet=192.168.234.0/23 auto=start
conn net-192.168.69.0 also=vpn-4.3.2.1 rightsubnet=192.168.69.0/24 auto=start
thanks for sharing!
We will have a look at this, this is for a single site-to-site VPN withc multiple remote subnets?
Hi, we encounter the same issues mainly with IKEv2. So far, we did not test changing the configuration manually – we migrated the affected networks to L2 networks with dedicated virtual routers which are managed outside of CloudStack. This is not a solution.
Please let us know if we can help somehow.
Well unfortunately, it seems that we have more problems with this issue.
As soon as we update the virtual router to 4.11.2.0 multiple subnets stop working (everything worked before). We run XenServer 7.0 with all latest patches. The virtual routers run as HVM - before PV. We upgraded from 4.10.0.0, CS Management Server currently runs on CentOS 7.6.1810.
So far, we did not find a way to get the affected customer gateways / VPNs up and running again. We currently migrated the affected VPCs to dedicated L2 networks like written before.
Maybe these links/info can help fixing or identifying this problem:
- [strongSwan] multiple traffic selectors per child_sa
- Cisco Bug: CSCue42170 - IKEv2: Support Multi Selector under the same child SA
- CSCue42170 - IKEv2 Support Multi Selector under the same child SA
These links are related to Cisco ASA and IOS models only. We encountered this issue with other firewalls and vendors too (for example: MikroTik, SecurePoint, Barracuda).
Any progress around this one ?
https://wiki.strongswan.org/projects/strongswan/wiki/FAQ#Multiple-subnets-per-SA
So, it looks like this is currently not possible with CloudStack. Too bad. :disappointed:
We experimented a bit and we discovered another possible bug: CloudStack writes StrongSwan config files into /etc/strongswan.d/, but only uses the IP address of the VPN endpoint for the file name. If multiple tunnels are defined for the same IP, only one of them will stick, as the config file gets overwritten. It would be better if CloudStack used a unique identifier instead.
OK, so after thorough testing with remote side being pfsense 2.4.4, with 2 remote/right subnets (local to pfsense), and IKEv1 (ancient) and IKEv2, here are the findings below:
- default CloudStack 4.11.2 configuration works FINE with IKEv2 (when having 2 remote/right subnets) - zero hacks or anything - works perfectly well (when configured properly on both sides...)
- virtually all HW/SW devices SHOULD support IKEv2, since it's almost 15 years old now !
- IKEv1 is dead old
StrongSwan that comes with 4.11.2 systemVM template, is versioned 5.5 - it's behavior (through CloudStack) is to define "keyexchange=ike" in IPsec configuration file for each IPsec tunnel/connection - which (in this 5.5 version means following):
" Since (version) 5.0.0 both protocols are handled by Charon and connections marked with ike will use IKEv2 when initiating, but accept any protocol version when responding. "
This ^^^ is quote from https://wiki.strongswan.org/projects/strongswan/wiki/Connsection - and in previous versions of StrongSwan there were different defaults, and unless you were very explicit with IKE version (which CloudStack is NOT, to be able to handle both IKEv1 and IKEv2, for compatibility reasons) - in certain setups on remote side (in my example pfsense) the connections might not work.
Example of what I mean:
- from above quote, if remote side is INITIATING the IPsec tunnel, then CloudStack (StrongSwan) will accept both IKEv1 and IKEv2 (per the config "keyexchange=ike" and the quote above), whilst if CloudStack is the one initiating connections, it will (per the config "keyexchange=ike" and the quote from above) initiate connection as IKEv2.
- As mentioned above, in some of my testing - thing did fail - i.e. pfsense set to IKEv1, but I initiate connection from CloudStack, which by default uses IKEv2
So solution for this multiple-right/remote-subnets is to make sure that on remote side you explicitly set IKEv2 in Phase1 configs, and also double-check other phase1 and phase2 configs which remains the common mistake even today (different algorithms, different DH group settings, etc - all these must match on both sides).
I would appreciate if someone (confident enough in their IPsec guru skills) can test this in their (problematic) production and confirm the behavior/solution.
Considering that we transitioned to StrongSwan, which was a needed step, and considering the IKEv2 is 15 years old now, I suggest we "encourage" users to actually use a newer IKEv2 standard (that is here for last 15 years, give or take) - simple as that - no need for workarounds with defining multiple child SAs etc. (which, I admit, have not tested myself).
Opinions ?
@pdion891 @ustcweizhou @JnSchl @onitake - can you please take a look.
@andrijapanic I'll get back to you soon, need time to digest and evaluate pros vs cons etc.
@dudarra Can you have a look if this helps? Thanks!
Yes, will do a test with riverbed and cloudstack! report to follow!
We need to review on our side, but report look pretty accurate @andrijapanic !
@andrijapanic did the test form our "test-cloud" to "main-cloud" --> Cloudstack 4.11.2 and it worked! Now i will try Riverbed between the two clouds! will report!
Update on the VPN! We tried with Riverbed - Cloudstack! Riverbed with 3 tiers and Cloudstack with 2. Everything worked from the beginning...
Cloudstack:
Status of IKE charon daemon (strongSwan 5.5.1, Linux 4.9.0-8-amd64, x86_64):
uptime: 12 days, since May 09 14:24:31 2019
malloc: sbrk 2797568, mmap 0, used 756512, free 2041056
worker threads: 11 of 16 idle, 5/0/0/0 working, job queue: 0/0/0/0, scheduled: 8
loaded plugins: charon test-vectors ldap pkcs11 aes rc2 sha2 sha1 md5 random n once x509 revocation constraints pubkey pkcs1 pkcs7 pkcs8 pkcs12 pgp dnskey sshk ey pem gcrypt af-alg fips-prf gmp xcbc cmac hmac ctr ccm curl attr kernel-netlin k resolve socket-default farp stroke updown eap-identity eap-aka eap-md5 eap-gtc eap-mschapv2 eap-radius eap-tls eap-ttls eap-tnc xauth-generic xauth-eap xauth- pam tnc-tnccs dhcp lookip error-notify certexpire led addrblock unity
Listening IP addresses:
10.100.9.150
172.16.2.1
172.16.1.1
Connections:
vpn-14: 16...14 IKEv1/2
vpn-14: local: [6] uses pre-shared key authentication
vpn-14: remote: [14] uses pre-shared key authenticatio n
vpn-14: child: 172.16.0.0/16 === 10.100.0.0/24 10.100.45.0/24 10. 100.11.0/24 TUNNEL
L2TP-PSK: 172.26.0.151...%any IKEv1/2
L2TP-PSK: local: [172.26.0.151] uses pre-shared key authentication
L2TP-PSK: remote: uses pre-shared key authentication
L2TP-PSK: child: dynamic[udp/l2f] === 0.0.0.0/0[udp] TRANSPORT
Routed Connections:
L2TP-PSK{504}: ROUTED, TRANSPORT, reqid 29
L2TP-PSK{504}: 0.0.0.0/0[udp/l2f] === 0.0.0.0/0[udp]
vpn-14{503}: ROUTED, TUNNEL, reqid 28
vpn-14{503}: 172.16.0.0/16 === 10.100.0.0/24 10.100.11.0/24 10.100 .45.0/24
Security Associations (1 up, 0 connecting):
vpn-14[129]: ESTABLISHED 70 minutes ago, 16[16 ]...14[14]
vpn-14[129]: IKEv2 SPIs: 0b23c16db510c360_i 65114284d4d78125_r*, pre -shared key reauthentication in 94 minutes
vpn-14[129]: IKE proposal: AES_CBC_128/HMAC_MD5_96/PRF_HMAC_MD5/MODP _1536
Riverbed;
Status of IKE charon daemon (strongSwan 5.5.2, Linux 4.4.89, x86_64):
uptime: 62 days, since Mar 20 22:56:49 2019
worker threads: 11 of 16 idle, 5/0/0/0 working, job queue: 0/0/0/0, scheduled: 44
loaded plugins: charon sha1 nonce x509 revocation constraints pubkey pkcs1 pgp pem openssl fips-prf xcbc gcm attr kernel-netlink resolve socket-default stroke updown eap-identity eap-mschapv2 eap-tls xauth-generic xauth-noauth whitelist unity
Virtual IP pools (size/online/offline):
172.16.16.0/24: 254/0/1
Listening IP addresses:
10.100.1.4
10.100.1.1
192.168.204.4
192.168.205.1
10.100.44.4
10.100.45.1
10.100.0.4
10.100.0.1
Connections:
endpoint: %any...%any IKEv2, dpddelay=300s
endpoint: local: [ID_DER_ASN1_DN:O=Ocedo, OU=OO941A08C70956A7, CN=sie2da8563.oo941a08c70956a7.dnslabel.net] uses public key authentication
endpoint: ca: "O=Ocedo, OU=OO941A08C70956A7, CN=IPSec CA"
endpoint: cert: "O=Ocedo, OU=OO941A08C70956A7, CN=sie2da8563.oo941a08c70956a7.dnslabel.net"
endpoint: remote: uses public key authentication
endpoint: ca: "O=Ocedo, OU=OO941A08C70956A7, CN=IPSec CA"
endpoint: child: 0.0.0.0/0 === dynamic TUNNEL, dpdaction=clear
endpoint_osx1: %any...%any IKEv1, dpddelay=300s
endpoint_osx1: local: [ID_FQDN:sie2da8563.oo941a08c70956a7.dnslabel.net] uses public key authentication
endpoint_osx1: ca: "O=Ocedo, OU=OO941A08C70956A7, CN=IPSec CA"
endpoint_osx1: cert: "O=Ocedo, OU=OO941A08C70956A7, CN=sie2da8563.oo941a08c70956a7.dnslabel.net"
endpoint_osx1: remote: uses public key authentication
endpoint_osx1: ca: "O=Ocedo, OU=OO941A08C70956A7, CN=IPSec CA"
endpoint_osx1: remote: uses XAuth authentication: noauth
endpoint_osx1: child: 10.100.0.0/24 10.100.1.0/24 10.100.45.0/24 192.168.205.0/24 192.168.204.0/24 172.16.16.0/24 10.100.11.0/24 === dynamic TUNNEL, dpdaction=clear
endpoint_osx2: %any...%any IKEv2, dpddelay=300s
endpoint_osx2: local: [ID_FQDN:sie2da8563.oo941a08c70956a7.dnslabel.net] uses public key authentication
endpoint_osx2: ca: "O=Ocedo, OU=OO941A08C70956A7, CN=IPSec CA"
endpoint_osx2: cert: "O=Ocedo, OU=OO941A08C70956A7, CN=sie2da8563.oo941a08c70956a7.dnslabel.net"
endpoint_osx2: remote: uses public key authentication
endpoint_osx2: ca: "O=Ocedo, OU=OO941A08C70956A7, CN=IPSec CA"
endpoint_osx2: child: 10.100.0.0/24 10.100.1.0/24 10.100.45.0/24 192.168.205.0/24 192.168.204.0/24 172.16.16.0/24 10.100.11.0/24 === dynamic TUNNEL, dpdaction=clear
@dudarra - do I read this as "it works"?
@andrijapanic yes!
As I see it, this is not a bug or issue. @andrijapanic @DagSonsteboSB can you confirm this?
If this is not an issue can this be closed, or if needed be documented in the doc site?
@rhtyd Not an issue - correct. It's a configuration thing to be aware of.