IPSec VPN server and iPhone / iPad ? reddit / BSD ---------------------------------------------------------------------- ziggyx · 2011-03-26 12:40 Has anyone successfully configured a IPSec VPN server on BSD that works natively with the racoon client on iPhone / iPad and Mac OS X? I've tried configuring isakmpd on OpenBSD but the racoon client seem to fail go in phase 2 authentication.. The following protocols are supported on iOS devices: http://support.apple.com/kb/HT1288?viewlocale=en_US ---------------------------------------------------------------------- ziggyx · 2011-03-26 16:03 Basically I want to setup a VPN server that works natively with iPhone, iPad and Mac OS X without installing 3rd party applications. I have looked into l2tpd, poptop, but I keep going back to isakmpd + ipsec.conf (OpenBSD) as I think this is the most robust solution. ---------------------------------------------------------------------- kurin · 2011-03-26 19:25 I do have racoon working with OpenBSD's isakmpd, but (a) I haven't touched it in two years, and (b) I avoid so much as rebooting the racoon machine, because I'm afraid it will fall too easily. That said, here's my racoon.conf: path pre_shared_key "/etc/racoon/psk.txt"; path certificate "/etc/racoon/certs"; remote he.rp.de.rp { exchange_mode main; proposal { encryption_algorithm aes; hash_algorithm sha1; authentication_method pre_shared_key; dh_group modp1024; lifetime time 3600 seconds; } passive on; proposal_check claim; } sainfo anonymous { lifetime time 1200 seconds; pfs_group modp768; encryption_algorithm aes; authentication_algorithm hmac_sha256; compression_algorithm deflate; } ---------------------------------------------------------------------- ziggyx · 2011-03-26 19:32 cool, i'm going to try this!.. can you maybe also post your OpenBSD's /etc/ipsec.conf? ---------------------------------------------------------------------- kurin · 2011-03-26 19:41 ike passive esp from \ { 192.168.7.0/24, 192.168.10.0/24 } \ to 192.168.13.0/24 \ peer rem.ote.ip.here \ main enc aes-128 \ psk heylookitisakey Note that this is from 4.3. The syntax may have changed lately. Oh, actually, OpenBSD recently (4.7?) changed the algorithm they use for the default HMAC, so try using `hmac-sha1` or `hmac-md5` (as well as on racoon, obviously). ---------------------------------------------------------------------- ziggyx · 2011-03-26 20:33 What do you actually use on your Mac to connect to the vpn server? If i make a VPN profile in my netwerk preferences with IPSec it automatically uses the Cisco xauth protocol. It writes a dynamic config to /var/run/racoon/rem.ote.ip.here.conf which racoon will use to connect... this is how the iOS devices work too btw. If i modify my /etc/racoon/racoon.conf so it always uses my custom conf it does not seem to work, it establishes the connection but then racoon sends some more packets and it will timeout.. But if i use 'racoonctl vpn-connect re.mote.ip.here' it looks it works (no timeout and other packets following the establishment): 2011-03-26 21:23:40: [23778] INFO: ISAKMP-SA established 192.168.1.76[4500]-re.mote.ip.here[4500] spi:837f512b1f56b7ce:7ef750c6b0e8d0b2 2011-03-26 21:23:40: [23778] DEBUG: === 2011-03-26 21:23:40: [23778] DEBUG: sending vpn_control phase change status Not sure if at this point my VPN connection is fully established though, as I cannot seem to ping the remote machines locally on my Mac. ---------------------------------------------------------------------- kurin · 2011-03-26 20:37 I don't have a Mac, this is Linux to OpenBSD. If, on the OpenBSD machine, `ipsecctl -sa` shows both SAs and flows, then you probably need to change the HMAC. If not, it's something else. Also there are other things you need to do if one of your IPs is subject to change, and I have no experience with them. ---------------------------------------------------------------------- ziggyx · 2011-03-26 20:48 Ah, I was under the impression you were on a Mac, sorry :) After racoon says ISAKMP-SA established: # ipsecctl -sa FLOWS: No flows SAD: No entries Guess racoon on OS X is a bit more customized.. :( Thanks for your help, I might test racoon on my FreeBSD box and see if i can get it working from there. If I do I will post back here ;) ---------------------------------------------------------------------- konbanwa · 2011-03-31 03:07 See /usr/src/usr.sbin/npppd/ and then let us know if it works for you :D ---------------------------------------------------------------------- yzh · 2011-04-01 21:40 Hi ziggyx, konbanwa. I was also looking for a way to setup a VPN server on OpenBSD that is compatible with iOS. Thanks for mentioning npppd :) I've been having troubles with it though, it seems that isakmpd creates FLOWS that uses the internal ip of the client, thus L2TP packets sent to the outside are not encapsulated properly.. example after connecting with my iPhone: On isakmpd end it looks like this: 232920.313645 Default isakmpd: phase 1 done: initiator id 192.168.1.79, \ responder id $server_ip, src: $server_ip dst: $remote_client_ip 232921.404411 Default isakmpd: quick mode done: src: $server_ip dst: $remote_client_ip The created flows look like this: # ipsectl -s all FLOWS: flow esp in proto udp from 192.168.1.79 port 52588 to $server_ip port l2tp \ peer $remote_client_ip srcid $server_ip/32 dstid 192.168.1.79/32 type use flow esp out proto udp from $server_ip port l2tp to 192.168.1.79 port 52588 \ peer $remote_client_ip srcid $server_ip/32 dstid 192.168.1.79/32 type require SAD: esp transport from $server_ip to $remote_client_ip spi 0x08e6d7e3 auth hmac-sha1 enc aes-256 esp transport from $remote_client_ip to $server_ip spi 0x2f3c875b auth hmac-sha1 enc aes-256 I replaced my ip addresses with $remote_client_ip and $server_ip. But as you can see it uses my iPhone's internal ip 192.168.1.79 instead of $remote_client_ip for the FLOW.. and it causes a timeout on the client. I'm on OpenBSD 4.7 btw. ---------------------------------------------------------------------- Neco_ · 2011-07-05 09:00 Might wanna check out: http://www.lobotomo.com/products/IPSecuritas/ for troubleshooting it from your mac.