I have been working on this for a while now. Because of a variety of reasons that I can’t go into here some of my configuration was mandatory.
The Apple iOS (used on iPhone, iPad and iPod Touch) has an in-built VPN client that Cisco assisted with development. It supports PPTP, L2TP and IPSEC. Unless you are crazy you would only seriously use IPSEC. However, it only supports IPSEC using IKEv1 key negotiation. Unless you have a specific reason really only IKEv2 should be used a it has a number of performance and security benefits. So that causes a problem with iOS devices.
Using a IKEv1 in conjunction with a group/pre-shared key is well documented and simple to get working. If you are using Certificates then it gets a whole lot interesting.
One fix is to use the AnyConnect client from the App Store. This is free to download and can be deployed using the Apple Configurator utility from a Mac OSX device. This allows SSL VPN as well as IPSEC IKEv2 connections (in version 3.0 of the AnyConnect iOS/Andriod client) and has enterprise grade tools such as logging, diagnotics and a tool similar to the DART utility that the desktop AnyConnect has.
The difficulty with this is that even though you have purchased SSL VPN user licences (AnyConnect Essentials or Premium) Cisco still want some more money in the guise of ‘AnyConnect Mobile’ licence. These retail at around £500 but still another outlay you did not bargin for. Also your security policy may mandate the use of the built in client so its time to roll up your sleeves.
So what’s it doing ?
As with most things, being able to see what the iOS device is actually doing would be a good start. In Apples infinite wisdom any user messages are usually “cannot connect”, “unable to verify server” and not a lot else.
Armed with a Mac you do have a number of tools at your disposal. Of course if you are reading this it stands a good chance you are doing this is a company and you will need a Mac to deploy Enterprise profiles to iOS devices as lets face it you really, really should lock those babies down.
1) Remember the Mac OSX VPN client is very similar to the iOS VPN client so if its possible to replicate the configuration on the Mac, you may see something more useful to start with. In my experience you don’t but its worth mentioning.
2) Using Xcode its possible to see the iOS devices system log in realtime (equivalent of the /var/log/messages file) From this you can see more useful messages from the client. To do this:
- Install either Xcode or the Apple Enterprise Configurator from http://www.apple.com/support/iphone/enterprise/ I used Xcode
- Open Xcode, then select Window > Organiser
- Connect to iOS device to your Mac using a USB cable
- You should then be able to select the device then Console Log
3) For a low level view of what’s going on you can use the Mac to create a virtual interface to tunnel the iOS devices network traffic over. From then you can use TcpDump to take packet captures.
You again need a Mac, USB cable and a utility from the App Store that you an pull the iOS’s UUID device down. This is important. I used UDID+ but there are others. Quite how this will work when Apple remove it from iOS 6 is not well known…… anyhooo….. Once you have the UDID run the following on the Mac
$ # First get the current list of interfaces. $ ifconfig -l lo0 gif0 stf0 en0 en1 p2p0 fw0 ppp0 utun0 $ # Then run the tool with the UDID of the device. $ rvictl -s 74bd53c647548234ddcef0ee3abee616005051ed
Starting device 74bd53c647548234ddcef0ee3abee616005051ed [SUCCEEDED]
$ # Get the list of interfaces again, and you can see the new virtual $ # network interface, rvi0, added by the previous command. $ ifconfig -l lo0 gif0 stf0 en0 en1 p2p0 fw0 ppp0 utun0 rvi0
$ sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.rpmuxd.plist
Now that you know the name of the RVI, you can point your packet trace tool at it. For example, he’s how you might run tcpdump to take a packet trace from the RVI.
$ sudo tcpdump -i rvi0 -n
tcpdump: WARNING: rvi0: That device doesn't support promiscuous mode (BIOCPROMISC: Operation not supported on socket) tcpdump: WARNING: rvi0: no IPv4 address assigned tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on rvi0, link-type RAW (Raw IP), capture size 65535 bytes
When you’re done you can remove the RVI with the following command.
$ rvictl -x 74bd53c647548234ddcef0ee3abee616005051ed
Stopping device 74bd53c647548234ddcef0ee3abee616005051ed [SUCCEEDED]
That should get you into a position you can debug the client traffic. Simply open the captured traffic up in WireShark and you may have a clue…….
In part 2, Ill discuss ASA configuration and what works, what does not and what is an Cisco ASA bug !